org-mode(或者可能是我的配置?)处理 latex 文档的方式似乎存在问题。这是我尝试导出的示例文件:
\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}
如您所见,所有前言项都出现在 \begin{document} 之前,但当我导出为 pdf 时,出现以下错误:
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.
文档以 PDF 格式导出,前言出现在“目录”部分下,但实际上并不影响文档。在使用 org-latex-export-to-pdf 时,是否有其他人遇到过类似情况,或者是否有人知道通过 emacs 导出此文档的替代方法?
答案1
尝试这个:
#+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.