org-mode文件导出的时候只有
\begin{document}
\maketitle
\tableofcontents
想变成如下的结果:
\begin{document}
\maketitle
\frontmatter
\tableofcontents
\mainmatter
不知道是否有方法达成此效果?
目前已经做了如下的配置:
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'(“elegantbook”
"\documentclass[cn,10pt]{elegantbook}
\extrainfo{Victory won\rq t come to us unless we go to it. — M. Moore}
\setcounter{tocdepth}{3}
\logo{logo-blue.png}
\cover{cover.jpg}
\usepackage{minted}
\newminted{cpp}{frame=single,linenos,breaklines}
[NO-DEFAULT-PACKAGES]
[NO-PACKAGES]
"
("\chapter{%s}" . “\chapter*{%s}”)
("\section{%s}" . “\section*{%s}”)
("\subsection{%s}" . “\subsection*{%s}”)
("\subsubsection{%s}" . “\subsubsection*{%s}”)
("\paragraph{%s}" . “\paragraph*{%s}”)
("\subparagraph{%s}" . “\subparagraph*{%s}”))
)
:PROPERTIES:
:LAST_MODIFIED: [2022-02-14 Mon 23:30]
:END:
#+OPTIONS: H:5 tags:nil toc:nil num:nil
#+title: emacs china test
#+LaTeX_CLASS: emacs_china_elegantbook
#+begin_export latex
\maketitle
\frontmatter
\tableofcontents
\mainmatter
#+end_export
* Test head
:PROPERTIES:
:LAST_MODIFIED: [2022-02-14 Mon 23:24]
:END:
Content.
* Step to reproduce
:PROPERTIES:
:LAST_MODIFIED: [2022-02-14 Mon 23:28]
:END:
1. run code
#+begin_src elisp
(add-to-list
'org-latex-classes
'("emacs-china-elegantbook"
"\\documentclass[cn,10pt]{elegantbook}
\\extrainfo{Victory won\\rq t come to us unless we go to it. — M. Moore}
\\setcounter{tocdepth}{3}
\\logo{logo-blue.png}
\\cover{cover.jpg}
\\usepackage{minded}
\\newminted{cpp}{frame=single,linenos,breaklines}[NO-DEFAULT-PACKAGES] [NO-PACKAGES]"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
#+end_src
2. jump into an org file
3. export to *.tex file
# Local Variables:
# org-latex-default-packages-alist: nil
# org-latex-packages-alist: nil
# End:
Result:
% Created 2022-02-14 Mon 23:30
% Intended LaTeX compiler: xelatex
\documentclass[cn,10pt]{emacs_china_elegantbook}
\extrainfo{Victory won\rq t come to us unless we go to it. — M. Moore}
\setcounter{tocdepth}{3}
\logo{logo-blue.png}
\cover{cover.jpg}
\usepackage{minded}
\newminted{cpp}{frame=single,linenos,breaklines}[NO-DEFAULT-PACKAGES]
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\date{\today}
\title{emacs china test}
\hypersetup{
pdfauthor={},
pdftitle={emacs china test},
pdfkeywords={},
pdfsubject={},
pdfcreator={Emacs 27.2 (Org mode 9.5)},
pdflang={English}}
\begin{document}
\maketitle
\frontmatter
\tableofcontents
\mainmatter
\chapter*{Test head}
\label{sec:orgdf2c93f}
Content.
\chapter*{Step to reproduce}
\label{sec:org54cf8bb}
\begin{enumerate}
\item run code
\end{enumerate}
\begin{verbatim}
(add-to-list
'org-latex-classes
'("emacs-china-elegantbook"
"\\documentclass[cn,10pt]{elegantbook}
\\extrainfo{Victory won\\rq t come to us unless we go to it. — M. Moore}
\\setcounter{tocdepth}{3}
\\logo{logo-blue.png}
\\cover{cover.jpg}
\\usepackage{minded}
\\newminted{cpp}{frame=single,linenos,breaklines}[NO-DEFAULT-PACKAGES] [NO-PACKAGES]"
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
\end{verbatim}
\begin{enumerate}
\item jump into an org file
\item export to *.tex file
\end{enumerate}
\end{document}
根据你的指导调整成如下的代码,可以正常输出,编译成PDF了,谢谢
#+LATEX_CLASS: elegantbook
#+STARTUP: overview
#+LATEX_COMPILER: xelatex
#+LaTeX_HEADER: \usemintedstyle{emacs}
#+OPTIONS: \n:nil
#+OPTIONS: H:5 toc:nil title:nil
#+begin_export latex
\maketitle
\frontmatter
\tableofcontents
\mainmatter
#+end_export