I'm using the minted
package for code highlighting. The below is just a minimal example. What I find annoying about this package is that line numbers appear in the margin.
This causes several problems with \item
s but also in twocolumn
articles. What I would like is to have the line numbers aligned with the normal text, like so:
I have read through the documentation, but there doesn't seem to be such an option. The numbers=right
option doesn't help me either: I don't want numbers on the right, and even if I would, that option places numbers in the right margin.
I have tried putting it altogether in a minipage (i.e. \begin{minipage}{\linewidth}\begin{minted} ... \end{minted}\end{minipage}
), but couldn't get spacing work properly.
What would be the preferred way to move the numbers to the right?
\documentclass[10pt]{article}
\usepackage{minted,lipsum}
\begin{document}
\lipsum[1]
\begin{minted}[linenos,breaklines]{text}
Donec vehicula augue eu neque.
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Mauris ut leo.
Cras viverra metus rhoncus sem.
Nulla et lectus vestibulum urna fringilla ultrices.
\end{minted}
\lipsum[2]
\end{document}