3

I want to export an Org file into PDF, with any depth titles showed in TOC; however, cannot works. Even though adding \setcounter{tocdepth}{5}, TOC still only contains the title of 3rd depth (\subsubsection).

I check the TeX file it exported: org-export seemed to ignore my setting for org-latex-classes, and just convert **** into '\item instead of \paragraph. But I cannot find some worked solution for this...

Following is my org-latex-classes:

(setq org-latex-classes
  '(("article"         "
\\documentclass[10pt,a4paper]{article}
\\usepackage[margin=2cm]{geometry}
\\usepackage{fontspec}

\\XeTeXlinebreakskip = 0pt plus 1pt
\\linespread{1.36}

\\setcounter{tocdepth}{5}

\\usepackage{multicol}

\\usepackage{hyperref}
\\hypersetup{
  colorlinks=true,
  linkcolor=[rgb]{0,0.37,0.53},
  citecolor=[rgb]{0,0.47,0.68},
  filecolor=[rgb]{0,0.37,0.53},
  urlcolor=[rgb]{0,0.37,0.53},
  pagebackref=true,
  linktoc=all,}
"
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
    )
  )
  • This isn't really about TOCs. It's about headlines not getting exported as paragraphs (there's a setting for that, the name eludes me now). – Malabarba Dec 28 '14 at 23:01
3

Try something like this:

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.

(let ((org-latex-classes
   '(("my-article" "
\\documentclass[10pt,a4paper]{article}
\\usepackage[margin=2cm]{geometry}
\\usepackage{fontspec}

\\XeTeXlinebreakskip = 0pt plus 1pt
\\linespread{1.36}

\\setcounter{tocdepth}{5}

\\usepackage{multicol}

\\usepackage{hyperref}
\\hypersetup{
  colorlinks=true,
  linkcolor=[rgb]{0,0.37,0.53},
  citecolor=[rgb]{0,0.47,0.68},
  filecolor=[rgb]{0,0.37,0.53},
  urlcolor=[rgb]{0,0.37,0.53},
  pagebackref=true,
  linktoc=all,}"
      ("\\section{%s}" . "\\section*{%s}")
      ("\\subsection{%s}" . "\\subsection*{%s}")
      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
      ("\\paragraph{%s}" . "\\paragraph*{%s}")
      ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))))
  (with-temp-buffer
(insert
 (mapconcat 'identity
        '("#+LATEX_CLASS: my-article"
          "#+OPTIONS: h:5 num:3"
          "* section"
          "** subsection"
          "*** subsubsection"
          "**** paragraph"
          "***** subparagraph")
        "\n"))
(org-latex-export-as-latex nil nil nil t)))

=>

\section{section}
\label{sec-1}
\subsection{subsection}
\label{sec-1-1}
\subsubsection{subsubsection}
\label{sec-1-1-1}
\paragraph*{paragraph}
\label{unnumbered-1}
\subparagraph*{subparagraph}
\label{unnumbered-2}

For more info see http://orgmode.org/org.html#Export-settings.

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.