# Good settings for typesetting source code with wide lines?

I'd like to typeset some source code with minted. Unfortunately, a lot this source code runs over 80 columns, some of it up to 132.

What are good settings (and open source fonts?) to use with minted so that I can avoid as much line wrapping as possible?

• There's no technical solution to 'my text is too wide': usually this comes up with tables, but it's the same for source code. You'll have to make a human judgement about where line's can be altered. – Joseph Wright May 30 '16 at 8:10

I am not sure what the problem actually is ;) since minted does not do line wrapping. So to make 132 columns fit on the page, you'd have to make the font size smaller, that is all. All other settings of minted are not affected and can be changed as needed.

code

\documentclass{article}
\setlength\parindent{0pt}
\usepackage{minted}
\usepackage[margin=1in]{geometry}

\begin{document}

This is my 132 wide code in mint
\scriptsize
\begin{minted}[linenos]{matlab}
function foo()
%this is loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog
%comment, 132 long

x=sin(1); %my sinnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn function
end
\end{minted}
\normalsize

This is shorter code

\begin{minted}[linenos]{matlab}
function foo()
%this is not a long comment

x=sin(1); %my sine function
end
\end{minted}
\end{document}


Another option is to make it landscape, and keep the font size normal size, but now it will all fit. Just change the above line to

  \usepackage[landscape,margin=1in]{geometry}