0

How should I get a proper numbered header \subsubsubsection{The Header} instead of a numbered paragraph \paragraph{The Header} when exporting to LaTeX with header levels of more than 3?

Having this in my preamble:

% Set default Counter Depth 
\\setcounter{tocdepth}{5} 
\\setcounter{secnumdepth}{4}

And this in my Org file:

#+OPTIONS: H:5 num:t

Produces numbered paragraphs instead of proper headings at the fourth level and above.

The answer given over here did not solve the problem.


Sample Data:

#+OPTIONS: H:5

* Section
some text
** Subsection
some text
*** Subsubsection
some text
**** Subsubsubsection
some text

enter image description here

  • 1
    Standard LaTeX stops at subsubsection. Are you using a package that defines more sectioning? – Dan Mar 24 at 12:43
  • I am using titlesec to create more sectioning. (Max. 5 levels) – Sati Mar 24 at 13:22
0

After some research, here is my solution to the problem.

Below is part of the org-latex-classes code:

\\usepackage{titlesec}
\\usepackage{titling}
\\usepackage{fontspec} % packages for title and section-heading font setting.

% Set Header and Numbering Depth
\\setcounter{tocdepth}{5}
\\setcounter{secnumdepth}{5}

% Set formats for each heading level. 'sffamily' will point to the sans-serif font. In this case, 「楷體」.
\\titleformat*{\\section}{\\fontsize{20}{22}\\bfseries\\sffamily}
\\titleformat*{\\subsection}{\\fontsize{18}{20}\\bfseries\\sffamily}
\\titleformat*{\\subsubsection}{\\fontsize{16}{18}\\bfseries\\sffamily} 

% The `titlesec` package is used over here to make use of `\\paragraph` and `\\subparagraph` as headings. Up to five levels of headings can be implemented this way. 
\\titleformat{\\paragraph}
    {\\fontsize{14}{16}\\bfseries\\sffamily}{\\theparagraph}{1em}{} 
% New line after heading. (`\\paragraph` and `\\subparagraph` would not automatically generate a new line after the heading text. )
\\titlespacing*{\\paragraph}{\\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}

\\titleformat{\\subparagraph}
    {\\fontsize{12}{14}\\bfseries\\sffamily}{\\thesubparagraph}{1em}{}
\\titlespacing*{\\subparagraph}{\\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}

This lies right at the end of org-latex-classes to implement all 5 levels of subheadings:

         ("\\section{%s}" . "\\section*{%s}")
         ("\\subsection{%s}" . "\\subsection*{%s}")
         ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
         ("\\paragraph{%s}" . "\\paragraph*{%s}")
         ("\\subparagraph{%s}" . "\\subparagraph*{%s}")
| improve this answer | |

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.