
我嘗試了以下建議:在 org-mode 中使用 KOMA-Script 文章
當我嘗試從 org 文件匯出到 LaTeX 文檔類別 koma-article 時,我收到訊息未知 LaTeX 類別「scrartcl」。
這是一個 MWE。
#+LATEX_CLASS: scrartcl
#+latex_class_options:
#+title: Mininum Working Example
* Opening Statement
This is a minimal working example.
以下是我的 init.el 中的內容
(require 'ox-latex)
(with-eval-after-load "ox-latex"
(add-to-list 'org-latex-classes
'("koma-article" "\\documentclass{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
我檢查了 'org-latex-classes,koma-article 資料就在那裡。
匯出到帶有文章類別的 LaTeX 檔案是有效的。然後我可以在 TeX 模式下將類別更改為 scrartcl 並創建 pdf。它有效,但我想知道是否有辦法跳過這一步。
謝謝。
答案1
這是以下文件字串org-latex-classes
:
org-latex-classes
是定義在 中的變數ox-latex.el
。LaTeX 類別以及相關標頭和結構的清單。如果
#+LATEX_CLASS
在緩衝區中設定了 ,則使用其值和相關資訊。以下是每個單元格的結構:(class-name header-string (numbered-section . unnumbered-section) ...)
每個清單中的第一個條目是您在 .org 檔案中class-name
設定的名稱。#+LATEX_CLASS:
因此,如果您想使用scrartcl
,初始化檔案中的條目應如下所示:
(with-eval-after-load "ox-latex"
(add-to-list 'org-latex-classes
'("scrartcl" "\\documentclass{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
(require 'ox-latex)
請注意,使用 時不需要該表單with-eval-after-load
。