all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: outline -> latex
Date: Sun, 19 Oct 2003 16:04:03 +0200	[thread overview]
Message-ID: <u65il494c.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: mailman.1903.1066424745.21628.help-gnu-emacs@gnu.org

ray@nabuli.de writes:
[...]
> just a question here: Isn't there an easy way to convert outline into
> latex?  I am not realy sure, but I thought there was something.  Does
> somebody have a clue?

I am not aware of any package doing this, but unless I am
misunderstanding you, I dare say that this task is rather trivial,
since it is just about regexp matching and replacing.

Hmm, maybe:

(defconst ray-outline-to-latex-alist
  '((1 "\\section{%s}")
    (2 "\\subsection{%s}")
    (3 "\\subsubsection{%s}")))

(defun ray-outline-to-latex ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (ray-convert-heading-maybe)
    (while (= 0 (forward-line 1))
      (ray-convert-heading-maybe))))

(defun ray-convert-heading-maybe ()
  (when (looking-at outline-regexp)
    (let ((format (cadr (assq (funcall outline-level)
			      ray-outline-to-latex-alist)))
	  str)
      (when format
	(goto-char (match-end 0))
	(skip-syntax-forward "-")
	(setq str (buffer-substring (point) (line-end-position)))
	(delete-region (line-beginning-position)
		       (line-end-position))
	(insert (format format str))))))


    Oliver
-- 
28 Vendémiaire an 212 de la Révolution
Liberté, Egalité, Fraternité!

       reply	other threads:[~2003-10-19 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1903.1066424745.21628.help-gnu-emacs@gnu.org>
2003-10-19 14:04 ` Oliver Scholz [this message]
2003-10-20 12:54 ` outline -> latex Colin Marquardt
2003-10-17 20:21 ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u65il494c.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.