Search code examples
pdfmarkdownpandocxelatexmiktex

Error converting pandoc tables from .md to PDF


I try to convert Markdown files to PDF with

FOR %%i IN (*.md) DO pandoc "%%~fi" -o "%%~dpni.pdf" --template=weber-export.tex --pdf-engine=xelatex

But it wont convert pandoc-tables. instead there occurs an error saying

Error producing PDF.
! Missing number, treated as zero.
<to be read again>
                   (
l.357 ...columnwidth - 2\tabcolsep) * \real{0.33}}

Simply Version of the tables it wont convert are :

 Consumption / yield
---------------------

+--+---+--+
|  |   |  |
|  |   |  |
|  |   |  |
+--+---+--+
|  |   |  |
|  |   |  |
|  |   |  |
+--+---+--+
|  |   |  |
|  |   |  |
|  |   |  |
+--+---+--+

and

  -------------------------------------------------------------------
  Type                            Sales unit   Number
  ------------------------------- ------------ ----------------------
  Plastic bucket                  30 liters    18 buckets
  -------------------------------------------------------------------

like its explained in the Pandoc User's Guid

I have installed Miktex 2.9 and pandoc 2.11.2 on Win 10

Without the tables, the conversion is doing well, even when i try out tables without the first line like

  Type                            Sales unit   Number
  ------------------------------- ------------ ----------------------
  Plastic bucket                  30 liters    18 buckets
  -------------------------------------------------------------------

it works.

any suggestions? Is it a bug, or what am i doing wrong?


Solution

  • It seems that your custom template does not load all necessary packages.

    Add

    \usepackage{calc,array}
    

    to your template to ensure the necessary commands are available.