I want to convert the following *.md
converted into proper LaTeX *.tex
.
Lorem *ipsum* something.
Does anyone know lorem by heart?
Since pandoc 1.16, this is possible:
pandoc --wrap=preserve
Since Pandoc converts the Markdown to an AST-like internal representation, your non-semantic linebreaks are lost. So what you're looking for is not possible without some custom scripting (like using --no-wrap
and then processing the output by inserting a line-break wherever there is a dot followed by a space).
However, you can use the --columns NUMBER
options to specify the number of characters on each line. So you won't have a sentence per line, but NUMBER of characters per line.
I figured out another way to address this problem – which is to not change the original *.md
s (under version control), but to simply read them in and to have them "pandoced" when building the PDF.
Here's how:
Some markdown.md
in project root:
Happy one-sentence-per-line **markdown** stuff.
And another line – makes for clear git diffs!
And some latexify.tex
in project root:
\documentclass{article}
\begin{document}
\immediate\write18{pandoc markdown.md -t latex -o tmp.tex}
\input{tmp.tex}
\end{document}
Works just dandy if you have some markdown components in a latex project, e.g. github READMEs or sth.
Requires no special package, but compilation with shell-escape
enabled.
A much simpler solution would be to add two spaces after "...something.". This will add a manual line break (the method is mentioned in the Pandoc Manual).