How to properly re-format spaces in inline monospace?
Asked Answered
D

0

6

I don't want the whitespaces in inline monospaced text to be monospaced. They should have the width of the normal font. The \intexttt (as in the example below) does this but it seems to be unnecessarily complicated.

\documentclass[a4paper]{article}    

\usepackage{xstring}
\newcommand{\intexttt}[1]{%
  \saveexpandmode\noexpandarg%
  \texttt{\StrSubstitute[0]{#1}{ }{\textnormal{ }}}%
  \restoreexpandmode%
}

\begin{document} 
\noindent
What does \texttt{SELECT FROM} do? \\
What does \texttt{SELECT} \texttt{FROM} do? \\
What does \intexttt{SELECT FROM} do?
\end{document}

Output of MWE

Is there a better way?

Disfigure answered 20/5, 2016 at 8:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.