Open robintw opened 6 years ago
I confirm the bug. Though knitty and pandoctools work well:
---
pandoctools:
out: "*.pdf"
...
# H1
t1
But this very file cannot be stitched to pdf...
Somebody has find way to solve this issue? I have no problem with html, but when importing to pdf I have the same 43 error.
Sorry @f1se4, I never found a way around this.
Switch from stitch to knitty is the only workaround that I know.
May be you can try downgrading pandoc to some earlier version - from the time when stitch was last updated.
Thank you all!!!! I am also stuck with knitty ^^ hahaha, I think that have some issues with py3.8... well... What I don't know is why R-Markdown alternative in Python (without have to be coding with jupyter etc...) is not something interesting for the comunity. Quick fine and quick non-format and post-compiled report... Who has worked with R or Latex for example, love to write in plain text (with highlight gimmiks etc.. but in plain text) and compile at the end... :-m
Please elaborate on knitty issues with py3.8
It's caused by the way the backslash escape sequence gets handled by passing it to pandoc after explicitly being added in stitch/cli.py,
here is the relevant block from cli.py
:
if to in ('latex', 'pdf') and not has_booktabs(extra_args):
extra_args.append('--metadata=header-includes:\\usepackage{booktabs}')
From the pandoc's man pages:
-M KEY[=VAL], --metadata=KEY[:VAL]
Set the metadata field KEY to the value VAL. A value specified on the command line overrides a value
specified in the document using YAML metadata blocks. Values will be parsed as YAML boolean or
string values. If no value is specified, the value will be treated as Boolean true. Like --vari‐
able, --metadata causes template variables to be set. But unlike --variable, --metadata affects the
metadata of the underlying document (which is accessible from filters and may be printed in some out‐
put formats) and metadata values will be escaped when inserted into the template.
Note the last sentence --> when compiling to latex by using stitch, some characters are indeed escaped and the header-includes metadata thus compiles to \textbackslash usepackage\{booktabs\}
.
The fix for me was removing the above if condition and including the booktabs package by specifying it as a YAML header in my stitch markdown file (see pandoc's man pages):
---
header-includes:
- \usepackage{booktabs}
---
(your stitch markdown text here)
I have tried running the example from here and converting to PDF with
stitch basic.md -o basic.pdf
and I get the following error:Any idea what's going on?