emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Florian Beck <fb@miszellen.de>
To: emacs-orgmode@gnu.org
Subject: org-latex-classes with functions, incomplete doc
Date: Sun, 10 Feb 2013 17:09:53 +0100	[thread overview]
Message-ID: <87txpkrvzi.fsf@sophokles.streitblatt.de> (raw)

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	other threads:[~2013-02-10 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10 16:09 Florian Beck [this message]
2013-02-10 17:06 ` org-latex-classes with functions, incomplete doc Nicolas Goaziou
2013-02-10 17:51   ` Florian Beck
2013-02-10 18:20     ` Nicolas Goaziou
2013-02-10 18:59       ` Florian Beck
2013-02-10 21:52         ` Nicolas Goaziou
2013-02-12 23:27           ` Modifying the exporter (was: org-latex-classes with functions, incomplete doc) Florian Beck
2013-02-13 14:03             ` Modifying the exporter Nicolas Goaziou

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87txpkrvzi.fsf@sophokles.streitblatt.de \
    --to=fb@miszellen.de \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).