"Barton, Mark" <mark.bar...@disney.com> writes:
> I manually check the pdf to see if it fits and use a code formatter to get the > line widths shorter. I use blacken for python and sqlformat for SQL within > Emacs. Even then I still hit limits where I recently changed to font size to > small for the code blocks. > > I use minted for syntax highlighting of code blocks. > #+LaTeX_HEADER: \usepackage{minted} > > I set a local variable for org using minted to change the fontsize. > # Local Variables: > # org-latex-minted-options: (("fontsize" "\\small")) > # End: > That is basically what I do as well. I use minted and a smaller font for code listings. I also ensure that when programming, I use a fill column of 80. In this day of large monitors, a fill column of 80 for programming languages can often seem frustrating as it means less code in a 'screen' (window). Increasing fill column to (lets say) 100 can work well, until it comes time to generate documentation and PDFs etc. Then I remember why 80 is a better default! I do use local variables more these days and will set a larger fill column setting for code when I know I won't be needing to print it or use it in Latex, but the default is 80 so that whenever I do org blocks, things wrap at a width which works better for export to PDF etc.