emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org-latex-classes with functions, incomplete doc


From: Florian Beck
Subject: [O] org-latex-classes with functions, incomplete doc
Date: Sun, 10 Feb 2013 17:09:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi,

the docstring for `org-latex-classes' says:

"Instead of a list of sectioning commands, you can also specify
a function name.  That function will be called with two
parameters, the (reduced) level of the headline, and a predicate
non-nil when the headline should be numbered.  It must return
a format string in which the section title will be added."

This is wrong. The way this function is called in `org-latex-headline'
requires it to return a string with TWO format specifiers, e.g.
"\section{%%s}%%s\n", the second where the CONTENT of the section is
being added. Maybe `org-latex-headline' should add "%%s\n" itself – as
it does for other cases?

Also, I'm using this to add an optional argument to my sections. Can I
expect this to work? (i.e. being called in a context where the variables
`info' and `headline' are defined?)

#+BEGIN_SRC emacs-lisp
(defun fb/latex-sections (level numbered)
    (let* ((level (1- level))
           (sec-name (nth level fb/latex-section-names))
           (sec (when sec-name
                  (format "\\%s%s%s{%%s}\n%%s"
                          sec-name
                          (if numbered "" "*")
                          ;; ""
                          (or (when (plist-get info :toc-title)
                                (let ((toc-title (org-element-property 
:toc-title headline)))
                                  (when toc-title (format "[%s]" toc-title))))
                                   "")
                          ))))
      sec))
#+END_SRC


Org-mode version 7.9.3e (7.9.3e-961-g521d47 @ /home/flo/.emacs.d/org-mode/lisp/)
-- 
Florian Beck



reply via email to

[Prev in Thread] Current Thread [Next in Thread]