sphinx-contrib / plantuml

BSD 2-Clause "Simplified" License
113 stars 40 forks source link

Support max-width option in tikz output #90

Closed HeinischValentin closed 4 months ago

HeinischValentin commented 4 months ago

Problem

When creating large diagrams using plantuml, they can quickly get too wide for a pdf page. For images in the png, pdf and svg format, this problem is handled by the sphinx-provided "sphinxincludegraphics" latex command, which resizes the included graphic if needed. As tikz images are embedded using the "\input" command, this resize logic is not applicable for them.

Solution

I would suggest to use the "max-width" option (which is already somehow implemented but not documented) to allow the user to specify a maximum width. The "adjustbox" macro, which is already being used for giving an absolute size for an image, also supports this type of maximum size. This way, the image is not resized if it fits, but only if it would exceed the given size.

yuja commented 4 months ago

Merged as 7ef52e40, thanks!