Wandmalfarbe/pandoc-latex-template

Pandoc 3.2.1 introduced new LaTex macro \pandocbounded

Opened this issue · 15 comments

Explain the problem.

Pandoc introduced in release 3.2.1 new LaTex macro \pandocbounded which custom templates needs to provide:

LaTeX writer:

New method for ensuring images don’t overflow (#9660). Previously we relied on graphicx internals and made global changes to Gin to force images to be resized if they exceed textwidth. This approach is brittle and caused problems with \includesvg (see #9660). The new approach uses a new macro \pandocbounded that is now defined in the LaTeX template. (Thanks here to Falk Hanisch in mrpiggi/svg#60.) The LaTeX writer has been changed to enclose \includegraphics and \includesvg commands in this macro when they don’t explicitly specify a width or height. In addition, the writer now adds keepaspectratio to the \includegraphics or \includesvg options if height is specified without width, or vice versa. Previously, this was set in the preamble as a global option. Users should attend to the following compatibility issues:
If custom templates are used with the new LaTeX writer, they will have to be updated to include the new \pandocbounded macro, or an error will be raised because of the undefined macro.

pandoc readme.md -o doc.pdf --template=eisvogel

with readme.md:

# Reproducer
![image](picture.png "Random test image")

Pandoc version?

Pandoc 3.2.1 using the pandoc:extra docker image.

Reproducer

See https://github.com/sonic-martin/pandoc3.2.1-eisvogel-reproducer

Bump - I am stuck on on pandoc 3.2 because I use eisvogel extensively (thanks for the awesomeness BTW)

Hi, did you find any workarounds in the meantime? Facing this right now.

Add the code changes yourself, the diff is quite small (see my post above).

Here is my modified eisvogel template that works with Pandoc 3.2.1 (but note I made other changes to support academic metadata etc.):

https://github.com/iandol/dotpandoc/blob/master/templates/eisvogel.latex#L375

changes around line 375 -- iandol/dotpandoc@e51c754#diff-7cbc217435a06b6e85d604d450361df236dbad23dba7b6c12daec404e82f1d8e

I did it myself as well, however, I think it would be better to incorporate them into the repository. I will work up a PR later today.

I looked into the build process of the docker container images, and when your PR #392 would be merged, then in the next build it would be included in the pandoc docker files as well.

See https://github.com/pandoc/dockerfiles/blob/8ba91aaf8b81b44351044f706d557b97ad39470d/alpine/Dockerfile#L184

I think the next line, with the version number will need to be updated though.

up, appreciate

See #192

Thank you @iandol for pointing out the little modification and all for working on this awesome template, it produces PDFs over my expectation, well done.

block with same error。。。

Error producing PDF.
! Undefined control sequence.
l.220 \pandocbounded

$ pandoc --version
pandoc 3.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/fq/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

When exporting jupyter notebook in pdf, pandoc 3.3

...
! Undefined control sequence.
l.442 \pandocbounded
                    {\includegraphics[keepaspectratio]{image.png}}
? 
! Emergency stop.

block with same error。。。

Error producing PDF.
! Undefined control sequence.
l.220 \pandocbounded
$ pandoc --version
pandoc 3.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/fq/.local/share/pandoc
Copyright (C) 2006-2024 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

add default defintion of pandocbounded to my pdf template, everything goes well:

\newcommand{\pandocbounded}[1]{#1}

Hope this info helps.