-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LaTeX writer: new method for ensuring images don't overflow.
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. 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. Closes #9660.
- Loading branch information
Showing
7 changed files
with
31 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72ce03d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question about this change. Wouldn't this create an issue with figures in two-column texts? I think this could eliminate the possibility of switching between page-width and text-width figures. I'm thinking about the discussion on this in #9268. Personally, losing the possibility of page-wide figures (in two-column texts) seems to me to be a problem.
72ce03d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't thought about this. Can you try it? (If you don't want to build from source, there are binary nightlies you can download from the Actions tab.) Perhaps there's a workaround?
Perhaps @mrpiggi who suggested this approach could comment.
72ce03d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that using
\textwidth
instead of\linewidth
would preserve the ability to have full-width figures.72ce03d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that when an explicit image size is specified,
\pandocbounded
is not used. So you could always just specify an explicit size for full-width images.72ce03d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to test it. I'm not very good at latex, but I think I can experiment with the codes I used before and see what the result is. I don't think I'll be able to do it for a few days, if that's ok (I see this commit is going fast).
72ce03d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usage of
\linewidth
comes right from the code-snippet posted at mrpiggi/svg#60 (comment) which was the base for\pandocbounded
. It could be changed to\textwidth
but this will give probably unintended result when used in a indented environment likequote
or similar. IMHO it would be better to stick to\linewdith
especially for two-column layout as this is often tedious and typesetting images over multiple columns needs manual intervention almost always with LaTeX.