I am using pandoc to generate a pdf from some markdown. I am using h1 through h4 via hash symbols. Example h1=#, h4=####. When I generate my document like this:
pandoc input.md -o output.pdf
I get a document where h1, h2 and h3 have a newline after them but h4 does not have a new line. The text starts on the same line as the header (it isn't formatted the same way, but there isn't a newline character between).
I've tried adding spaces after the #### and adding manual line returns using my editor but nothing seems to work.
Any ideas?
There are actually two steps involved in converting a Markdown file to a PDF file: The Markdown source file is converted to a LaTeX source file. Pandoc invokes the pdflatex or xelatex or other TeX command and converts the . tex source file to a PDF file.
You can use the program pandoc on the SCF Linux and Mac machines (via the terminal window) to convert from formats such as HTML, LaTeX and Markdown to formats such as HTML, LaTeX, Word, OpenOffice, and PDF, among others.
Pandoc is a command line tool that you can use to automatically convert files from markup format to another. With Pandoc, you can write in something easy like Markdown, Microsoft Word, or LibreOffice, and convert it something hard like: HTML. Ebook formats.
Pandoc can convert between numerous markup and word processing formats, including, but not limited to, various flavors of Markdown, HTML, LaTeX and Word docx.
pandoc
generates PDFs via LaTeX. In LaTeX, "headers" are generated using the following commands:
\section
\subsection
\subsubsection
\paragraph
\subparagraph
As you can see, a "level four heading" corresponds to the \paragraph
command, which is rendered as you describe. There simply isn't a \subsubsubsection
command to use.
The only way to get what you want is to redefine the \paragraph
command, which is quite tricky. I haven't been able to make it work with Pandoc.
While the mentioned solutions work fine, pandoc offers a build-in variable to enable block-headings for \paragraph
.
pandoc -s -o out.pdf some.md -V block-headings
Pandoc Manual
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With