# How can I get consistent line spacing with highlighted, minted material in a paragraph?

I'm using a lot of inline minted material. To distinguish between code elements and text elements in my document, I'm giving everything a light background color. (The color used below is exaggerated for improved contrast.) Sadly, this has exposed (or perhaps introduced?) a problem in how minted material is set in my document:

% arara: xelatex: { shell: yes }
% arara: xelatex: { shell: yes }
\documentclass{article}
\usepackage{minted}
\newmintinline{csharp}{bgcolor=black!15}

\textwidth=10cm

\begin{document}
We're going to start writing our desktop calculator.  The first step
is to distinguish between different kinds of \emph{tokens}.  Write a
method that will receive this token as a string and determine what
kind of token it is.  Define an enumeration of the values
\csharpinline{Operand}, \csharpinline{Operator},
\csharpinline{LeftParen}, \csharpinline{RightParen}, and
\csharpinline{Unknown}.  Use a \csharpinline{switch} statement in your
implementation.  Note you can have multiple \csharpinline{return}
statements in one method.
\end{document}


For anyone who notices, this will make them twitch. How can I get consistent leading / box-heights?

• Basically you could add a strut to all boxes which would consistently destroy spacing... – TeXnician Feb 11 at 5:39
• @TeXnician Yeah, I'd thought of that -- and the downside you mention :-( There's a conceptual idea of adding some sort of minimum leading equivalent to the maximum height of one of those boxes (should work in most cases; wouldn't work if font size of body text suddenly changed). If every line has the same minimum height, then if stretching needs to happen, it should theoretically happen consistently to every line. – Sean Allred Feb 11 at 16:22