Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandoc adds extra paragraph breaks

I use pandoc to convert Markdown to Latex. My problem is that pandoc adds extra paragraph breaks around begin/end environments.

Source:

**First** phrase in a paragraph.
\begin{multline*}
some long formulae
\end{multline*}
Second phrase in a paragraph.

Doing pandoc my.md -o my.tex yields:

\textbf{First} phrase in a paragraph.

\begin{multline*}
some long formulae
\end{multline*}

Second phrase in a paragraph.

Clearly this is inappropriate behavior due to extra vertical space put by latex in resulting PDF when it sees extra blank lines around multline.

Is there a way to suppress extra blank lines in .tex output of pandoc?

like image 483
Artem Pelenitsyn Avatar asked Sep 20 '14 18:09

Artem Pelenitsyn


People also ask

Why does Pandoc require a line break at the beginning?

Pandoc does require this (except, of course, at the beginning of the document). The reason for the requirement is that it is all too easy for a > to end up at the beginning of a line by accident (perhaps through line wrapping).

Is there a way to use Pandoc with markdown?

For a more complete list, see the Pandoc Extras wiki page. PanWriter is a Markdown editor with live preview that can import and export using pandoc. Pandoc Mac OS X Services allows you to invoke pandoc from any text editor with the opened file as input.

How to adjust line spacing between paragraphs in Pandoc?

if true, pandoc will use document class settings for indentation (the default LaTeX template otherwise removes indentation and adds space between paragraphs) adjusts line spacing using the setspace package, e.g. 1.25, 1.5

How does Pandoc work with docx?

For docx output, styles will be defined in the output file as inheriting from normal text, if the styles are not yet in your reference.docx. If they are already defined, pandoc will not alter the definition. This feature allows for greatest customization in conjunction with pandoc filters.


2 Answers

Proper vertical multline


Modification:

**First** phrase in a paragraph.
\empty{
\begin{multline*}
some long formulae
\end{multline*}
}
Second phrase in a paragraph.

parses to

\textbf{First} phrase in a paragraph. \empty{
\begin{multline*}
some long formulae
\end{multline*}
} Second phrase in a paragraph.
like image 122
Thell Avatar answered Sep 22 '22 19:09

Thell


What about:

**First** phrase in a paragraph. \begin{multline*}
some long formulae
\end{multline*} Second phrase in a paragraph.

pandoc -t latex with the above input and pandoc 2.2.1 gives:

\textbf{First} phrase in a paragraph. \begin{multline*}
some long formulae
\end{multline*} Second phrase in a paragraph.
like image 20
mb21 Avatar answered Sep 19 '22 19:09

mb21