2

There appears to be a problem with how org-mode (or my configuration, maybe?) is handling latex documents. Here is the sample file that I'm trying to export:

\documentclass[12pt, letterpaper, twoside]{article}
\usepackage[utf8]{inputenc}

\begin{document}

\begin{abstract}
This is a simple paragraph at the beginning of the document. A brief introduction to the main subject.
\end{abstract}

In this document some extra packages and parameters
were added. There is an encoding package,
and pagesize and fontsize parameters.

This line will start a second paragraph. And I can
 break\\ the lines \\ and continue on a new line.

\end{document}

As you can see, all preamble items occur before \begin{document}, and yet when I export as a pdf, I get the following errors:

l.31 \documentclass
                   [12pt, letterpaper, twoside]{article}

! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.32 \usepackage
                [utf8]{inputenc}

! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.34 \begin{document}
                     
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (.//test.tex.aux) )
(\end occurred inside a group at level 1)

### semi simple group (level 1) entered at line 34 (\begingroup)
### bottom level
(see the transcript file for additional information) </home/josh/.texlive2017/t
exmf-var/fonts/pk/ljfour/jknappen/ec/ecrm1000.600pk> </home/josh/.texlive2017/t
exmf-var/fonts/pk/ljfour/jknappen/ec/ecbx1000.600pk> </home/josh/.texlive2017/t
exmf-var/fonts/pk/ljfour/jknappen/ec/ecrm1095.600pk> </home/josh/.texlive2017/t
exmf-var/fonts/pk/ljfour/jknappen/ec/ecbx1440.600pk> </home/josh/.texlive2017/t
exmf-var/fonts/pk/ljfour/jknappen/ec/ecrm1200.600pk> </home/josh/.texlive2017/t
exmf-var/fonts/pk/ljfour/jknappen/ec/ecrm1728.600pk>
Output written on .//test.tex.pdf (1 page, 25588 bytes).
Transcript written on .//test.tex.log.

The document exports as a PDF, and the preamble appears under the "Contents" section, but doesn't actually affect the document. Has anyone else experienced something similar when using org-latex-export-to-pdf, or does anyone know of an alternative way of exporting this document through emacs?

Many thanks in advance!

0

Try this:

#+LATEX_CLASS_OPTIONS: [12pt, letterpaper, twoside]

#+BEGIN_abstract
This is a simple paragraph at the beginning of the document. A brief introduction to the main subject.
#+END_abstract

In this document some extra packages and parameters
were added. There is an encoding package,
and pagesize and fontsize parameters.

This line will start a second paragraph. And I can
 break @@latex:\\@@ the lines @@latex:\\@@ and continue on a new line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.