18

I use pandoc to create latex and PDF from Markdown. Markdown, being designed for HTML, allows 6 levels of headers H1...H6. But when converting to PDF, via tex, I get only three levels: 1 (\section), 1.1 (\subsection) and 1.1.1 (\subsubsection).

The tex source has no command around the deeper level headers. 1.1.1.1 simply does not exist and is treated as plain text.

Where should I look, in order to get latex to support deeper levels of headers/sections? Is that possible at all? Or should I consider restructuring the document so as never to go below 1.1.1, header level three, \subsubsection?

  • Some good answers here already. For a broader, fairly comprehensive look at the TeX document hierarchy, check out en.wikibooks.org/wiki/LaTeX/Document_Structure – naught101 Apr 3 '12 at 5:04
  • I have the same problem: I expected that in the output from pandoc the headers of level 4 or 5 would become \paragraph, but they are just plain text. Have you found a fix for this? – imz -- Ivan Zakharyaschev Jul 7 '13 at 14:42
  • (Neither of the answers below doesn't seem to answer the question about making pandoc generate \paragraph. I wonder why it is accepted then...) – imz -- Ivan Zakharyaschev Jul 7 '13 at 14:43
  • Imz, the answers at that time were in lines of "not possible, restructure your document". Mostly answering to my ignorance about levels in TeX. Which is a crude solution, but a solution nonetheless. Yours is indeed a better solution and should probably become the accepted answer. – berkes Jul 8 '13 at 7:14
17
\documentclass{report}
\setcounter{secnumdepth}{5}
\begin{document}
\part{Part}
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\subparagraph{Subparagraph}
\end{document}

You can change the formatting of these using the titlesec package.

12

There are two levels below \subsubsection which are \paragraph and \subparagraph. Whether some sectioning command is numbered or appears in the table of contents is selected by the secnumdepth and tocdepth counters, respectively.

10

Probably, newer versions of pandoc fix this problem. I've just run my simple example:

# Section
## Subsection
### Subsubsection
#### Paragraph
##### Subparagraph
###### Level 6

through Try Pandoc online!, and the output does use \paragraph:

\section{Section}

\subsection{Subsection}

\subsubsection{Subsubsection}

\paragraph{Paragraph}

\subparagraph{Subparagraph}

Level 6

It has been done with pandoc 1.11.1, whereas my installed older pandoc-1.6.0.1 produced:

\documentclass{article}
\usepackage{amssymb,amsmath}
\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}
\usepackage[breaklinks=true,unicode=true]{hyperref}
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setcounter{secnumdepth}{0}


\begin{document}

\section{Section}

\subsection{Subsection}

\subsubsection{Subsubsection}

Paragraph

Subparagraph

Level 6

\end{document}

without \paragraph.

(pandoc vs pandoc --standalone make no difference as to this issue.)

  • An answer is much better ;-) – Marco Daniel Jul 7 '13 at 16:08
  • 1
    Subparagraph being the deepest LaTeX level (as jgm elucidated here). – JosephHarriott Oct 7 '14 at 0:09

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.