Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandoc 3.2.1 introduced new LaTex macro \pandocbounded #391

Closed
sonic-martin opened this issue Jun 25, 2024 · 18 comments
Closed

Pandoc 3.2.1 introduced new LaTex macro \pandocbounded #391

sonic-martin opened this issue Jun 25, 2024 · 18 comments

Comments

@sonic-martin
Copy link

sonic-martin commented Jun 25, 2024

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

@iandol
Copy link

iandol commented Jun 25, 2024

jgm/pandoc-templates@6c0e7b0#diff-f218051b4ca8f740a9f585a149101d4a3025037c568b391b5216edf7b14cfadc

@jvsteiner
Copy link
Contributor

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

@ingcsmoreno
Copy link

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

@iandol
Copy link

iandol commented Jun 28, 2024

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

@iandol
Copy link

iandol commented Jun 28, 2024

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

@jvsteiner
Copy link
Contributor

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.

@jvsteiner
Copy link
Contributor

#392

@sonic-martin
Copy link
Author

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

@jvsteiner
Copy link
Contributor

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

@siddjellali
Copy link

up, appreciate

@chdemko
Copy link

chdemko commented Aug 8, 2024

See #192

@class101
Copy link

class101 commented Sep 5, 2024

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.

@fujohnwang
Copy link

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.

@appomsk
Copy link

appomsk commented Sep 18, 2024

When exporting jupyter notebook in pdf, pandoc 3.3

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

@fujohnwang
Copy link

fujohnwang commented Sep 19, 2024

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.

@simondueckert
Copy link

I have the same error

Error producing PDF. ! Undefined control sequence.

Since I work with the pandoc/extra docker image I cannot modify latex templates. Anything else I can do to fix the problem in my setting?

@sonic-martin
Copy link
Author

I have the same error

Error producing PDF. ! Undefined control sequence.

Since I work with the pandoc/extra docker image I cannot modify latex templates. Anything else I can do to fix the problem in my setting?

Based on the pandoc/extra container image I built an own image adding the eisvogel.tex file from #392.

FROM pandoc/extra:3.4.0
COPY eisvogel.latex /usr/local/share/pandoc/templates

But see #392, the maintainer of the Eisvogel template will shortly release a new fixed version.

@Wandmalfarbe
Copy link
Owner

This issue should be fixed in version 2.5.0. Thank you @jvsteiner for providing a Pull Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests