Nicolas Goaziou <n.goaz...@gmail.com> writes:

> Hello,
>
> Andreas Leha <andreas.l...@med.uni-goettingen.de> writes:
>
>> I have a beamer presentation in org-mode that contains a line like
>> #+LaTeX_HEADER: \subtitle{foo}
>>
>> This prevents me from using 'org-preview-latex-fragment' as that one --
>> naturally, as it uses the article class -- fails with
>> 'Failed to create dvi file from /tmp/orgtex49760oq.tex'
>> due to
>>
>> ,----
>> | ERROR: Undefined control sequence.
>> | 
>> | --- TeX said ---
>> | l.38 \subtitle
>> `----
>>
>> What's the remedy here?
>
> Interesting. I put back use of #+latex_header keywords for latex
> snippets recently, but that is a double-edged sword. Overall, I'm not
> sure which is the right behaviour here. Is there one, anyway?
>
> To solve your problem, you can include your problematic header in a new
> latex class instead of relying on latex_header. Another solution is to
> put that latex_header line in an include file, or to generate it as
> a macro.

Thanks for the quick answer and for these hints.

In this particular situation (the \subtitle will always be document
specific) the latex class is not possible here -- I won't create latex
classes per document.

An include file just for a subtitle seems overkill.  So I went with the
macro.  If there were multiple offending lines, I'd probably use the
include file.

Anyway, just for reference, this is the macro:
#+begin_src org
#+MACRO: subtitle #+latex_header: \subtitle{$1}
{{{subtitle(foo)}}}
#+end_src

Downside is, that \ and , within the subtitle will have to be escaped.

Regards,
Andreas


Reply via email to