0

I am probably the thousandth person who wants to scale a tikzpicture to the size of \textwidth.

There is a solution for this problem given in https://tex.stackexchange.com/a/6391/193625 however it uses environ. I do not exactly know what that packages offers but it seems that it is redundant with NewDocumentEnvironment of xparse.

  1. Am I correct that xparse could/should be used here? Sadly I still understand LaTeX far to little to translate the older solution myself. Any help is appreciated.
  2. Does anyone know why this is not implemented directly into tikz/pgf?

Ty for your help.

Franz

(I am interested in a solution that works with the externalize option of tikz.)

Franz
  • 175
  • Doesn't \resizebox{\textwidth}{!}{...} do what you want? – Michael Fraiman Oct 26 '22 at 12:30
  • Joseph Wright wrote something comparing the xparse solutions against their old counterparts on his blog. And yes, you can use \NewDocumentEnvironment instead of \NewEnviron to use the content of an environment twice. But that's only about defining macros/environments, the usage is not affected (unless xparse deals better with catcodes). – Qrrbrbirlbel Oct 26 '22 at 12:34
  • But the externalizing of it is separate from the xparse part. externalize looks for \begin{tikzpicture} Have you tried any of these solutions with external? It may produce two PDFs, only the first one (that's too big) or none. – Qrrbrbirlbel Oct 26 '22 at 12:38
  • You know, 99.9% of the time questions like "why does program X not have feature Y" is "the author doesn't have time/think about it" kind of answer... -------- In any case, if I were you and the old answer works I would not care too much about whether the code looks pretty. (unless I want to modify it later) LaTeX kernel has too much "ugly" code already. – user202729 Oct 26 '22 at 12:38
  • 1
    Scaling with scale doesn't affect nodes and so relations between parts can change. You often have to make adjustments and to rearrange parts to get a pleasing result and imho a simple automatical solution doesn't exist. – Ulrike Fischer Oct 26 '22 at 13:38

0 Answers0