# How to debug org-mode export to Beamer?

When using org-mode to create Beamer slides, sometimes the error shown is

"Pdf file ... wasn't produced"


or the previous PDF file generated is opened (without the changes made) when the command C-c C-e l o is issued to open the PDF directly.

However, the .tex file generated from export to Beamer when compiled separately does give the PDF.

Since there is no debug message given, I am not sure how to detect why the export to Beamer to open the slides directly is not working.

How can we detect the source of error in exporting org files ?

Thanks.

• Not sure if you made a typo, but the key sequence to create a beamer PDF and open it is C-x C-e l O and not C-x C-e l o, which is the sequence for creating a normal latex file and opening it. If that isn't the problem, do you get an error when you just do C-x C-e l P to generate the beamer PDF? If not, then at least you know the problem is likely with the view command or arguments and not with the PDF generation step – Tim X Feb 21 '15 at 9:10
• Sorry, should be C-c C-e l O etc. and not C-x C-e l O (I'm using the emacs SX package to browse the gorup and haven't worked out how to edit comments yet!) – Tim X Feb 21 '15 at 9:13
• @TimX There is no typo. C-c C-e with .org file shows all the options and difference between o and O is for latex and beamer option. The only difference between option o and p is whether the pdf is opened or not and therefore not the error or cause of error. Simply use the pen like symbol next to comment to edit. – Anusha Feb 21 '15 at 18:20
• I wasn't being clear enough. My point is that the command you show as causing the error is C-c C-e l o, but on my system, for a latex beamer presentation, it should be C-c C-e l O (upper case o). Finally, with Emacs SX package, I see no pen like symbol next to comment. – Tim X Feb 21 '15 at 22:32

As you mention, org-mode does not make use of the echo area to show export errors. Instead, it dumps all output that is produced during LaTeX export to a buffer called *Org PDF LaTeX Output*. If you want to get information about why the export process failed, you can switch to this buffer and search for error (or even warning).

### Example

Contents of .org file:

* Heading
\begin{algorithm}
...
\end{algorithm}


Contents of *Org PDF LaTeX Output* buffer (abbreviated to show relevant parts only):

This is pdfTeX, Version 3.14159265-2.6-1.40.15 ... (preloaded format=pdflatex) ...
LaTeX2e <2014/05/01>
...

LaTeX Warning: No \author given.

(.//beamer.toc)

! LaTeX Error: Environment algorithm undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.32 \begin{algorithm}

! LaTeX Error: \begin{document} ended by \end{algorithm}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.33 \end{algorithm}

...


In this case, the output tells us that the error was caused by the \begin{algorithm} declaration in line 32. Note that specifications of line numbers (l.32, l.33, etc.) refer to the .tex file, not to the original .org file.

• Thank you for the reply. But why does the .tex file generated compile properly ? It usually happens that the export to beamer is working properly and then after some more input, without changing the syntax and only plain text, or apparent reason, there is an error in org export to pdf but .tex file compiles. – Anusha Jan 8 '15 at 9:40
• @Anusha I can't really answer that because I've never had that happen. You could try checking the *Messages* buffer (C-h e) for complaints coming directly from org-mode when you run into this problem. If you want me (or anyone else who comes across your post) to be able to give you more detailed feedback, please add a minimal example to your question that allows us to reproduce the error (i.e., a version of the file that compiles cleanly and a portion of text that makes the export process fail when adding it to the file). – itsjeyd Jan 8 '15 at 10:06
• @Anusha You should also make sure that the problem isn't caused by your personal configuration. Try to reproduce the behavior with a minimal configuration that consists only of the code that is necessary to enable Beamer export (AFAIK, (require 'ox-beamer) is all you really need). Let me know if you need more help with that. – itsjeyd Jan 8 '15 at 10:22