TeX - LaTeX Asked on April 6, 2021
I would like my documents to be automatically sized to the width of the text they contain, that is the width of their longest line.
I have a directory of files of code (python scripts) and I’m generating a pdf image of each file (to include this in posters for teaching programming) using a shell script. These files are all varying in width.
I don’t really know much about latex document sizing but read on With pdflatex and the minted package, how do I eliminate whitespace and include entire document? that I can use {standalone}
and [varwidth=4cm,border=2mm]
which seems like it might be a step in the right direction… maybe.
That seems to get the height of the document to automatically be sized correctly… but the width is obviously 4cm. If I delete the varwidth=4cm
the pdf that gets produced is useless (line breaks are lost, all text is on a single line, document is enormously wide).
Does latex LaTex provide any kind of smarter sizing options?
I could probably customize my shell script to do count the number of characters of the longest line of each file with the command wc -L filename
and then multiplying that by X to get the cm
value to provide to varwidth
…but I’d much prefer to use a better LaTex option. Does one exist?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP