I'd like to setup a simple workflow allowing me to type document segments in their own files using Markdown, then convert them to LaTeX using a common library such as pandoc
, before finally collating all my document segments into a main file that would be output as PDF.
I've created a table that looks like the below in Markdown:
$x$ | $F(x)$
--------|------------------
$0$ | $\frac{2}{8}$
$1$ | $0$
$2$ | $\frac{1}{2}$
$3$ | $2\frac{1}{2}$
$4$ | $6\frac{3}{4}$
$5$ | $14$
This renders pleasantly enough in the markdown preview window I've got setup in Atom, but after I've converted this document using the commandline:
pandoc -f markdown+tex_math_dollars+pipe_tables table.md -o table.tex
The above construction is converted to:
\begin{longtable}[c]{@{}ll@{}}
\toprule\addlinespace
$x$ & $F(x)$
\\\addlinespace
\midrule\endhead
$0$ & $\frac{2}{8}$
\\\addlinespace
$1$ & $0$
\\\addlinespace
$2$ & $\frac{1}{2}$
\\\addlinespace
$3$ & $2\frac{1}{2}$
\\\addlinespace
$4$ & $6\frac{3}{4}$
\\\addlinespace
$5$ & $14$
\\\addlinespace
\bottomrule
\end{longtable}
Which when piped through:
pandoc table.tex -o table.pdf
Doesn't resolve into a table, the initial line particularly looks fishy.
I can manually re-jig this to something like:
\begin{tabular}{c|c}
$x$ & $F(x)$ \\
\hline
$0$ & $\frac{2}{8}$ \\
$1$ & $0$ \\
$2$ & $\frac{1}{2}$ \\
$3$ & $2\frac{1}{2}$ \\
$4$ & $6\frac{3}{4}$ \\
$5$ & $14$ \\
\end{tabular}
Which is the result I want, but it takes time and I'd really like to be able to achieve this result directly from markup without human intervention.
pandoc -S pipetable.md -o pipetable.pdf
. I am using pandoc 1.15.2 on Kubuntu 14.04pandoc -s -S mermaid.md pipetable.md -o together.pdf
You can also customize the appearance of your PDF by tweaking the LaTex template withpandoc -D latex > latex.default