Closed gepcel closed 5 years ago
Thanks for your feedback. I tested your example, and find it compiles if I use the --standalone
flag with pandoc. I'm not sure that the problem you are running into is due to the cleveref fakery of pandoc-xnos. It seems to me that you need a standalone TeX document.
The philosophy of the pandoc-fignos filter (and friends) is to allow cross-referencing with as little fuss as possible for pdf/TeX and html, and other formats where possible. The cleveref fakery was introduced to mitigate users having to manually insert the cleveref package into their latex template. If you want to use the cleveref package than you can turn off cleveref fakery by setting xnos-cleveref-fake
to False
.
Note that the change that you proposed (and code is always appreciated!) did not work with the integration tests in the pandoc-fignos project.
Nevertheless, please let me know if you still think there is a bug. I'm happy to help hunt it down and squash it.
Let me try explaining myself. I didn't use --standalone
on purpose to get a clear result to make an example. The problem exists either way.
Let's say there's a test.md
file, as following:
---
pandoc-latex-admonition:
- color: dodgerblue
classes: [con]
linewidth: 3
margin: 12
innermargin: 24
fignos-cleveref: True
---
```con
python
python
python
Following by a logo @fig:logo
{#fig:logo}
The file contains a front-matter and two parts of contents: admonition part and fignos part. Then try converting the `test.md` file to pdf with two commands:
**Command 1** (get's the expected pdf, because `fignos` runs before `admonition`)
pandoc -o test_xnos_before.pdf --filter=pandoc-fignos --filter=pandoc-latex-admonition test.md
**Command 2** (get's an error, because `fignos` runs afterward)
pandoc -o test_xnos_after.pdf --filter=pandoc-latex-admonition --filter=pandoc-fignos test.md
The error would be:
Error producing PDF. ! Undefined control sequence. l.254 Following by a logo \xrefname
The reason (at least the reason I think) would be that: the admonition filter generates an `\begin{env-****} ... \end{env-****}` environment, and `xnos` filter should insert tex code outside this env not inside it.
I'm pretty sure about the problem, and this fixed this specific problem. However I'm not sure this fix is the right way, and it won't cause more problems.
I've encountered this for a long time, every time I'll have to remember to put all `pandoc-*nos` filter family before the `pandoc-latex-admonition` filter, which is really annoying.
The cleveref fakery has been removed from the 2.0 branch of all of the filters. I think that a much more sane approach is now used. I am planning to do a full release quite soon. For now there are betas available.
When working with another filter pandoc-latex-admonition, if filter
pandoc-fignos
is applied afterpandoc-latex-admonition
, the "cleveref_fakery" raw tex is inserted into a wrong position.See an example:
Which
\begin{env-*************}
should be right before\begin{verbatim}
.After some testing, this commit fixed this specific issue. But I'm not sure I understand the philosophy of this filter, so tell me what to do if I'm wrong.