3

I would like to configure my document to use exactly the same font for \texttt and \Verb. I got as far as this, which still misses making \ttdefault smaller:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{fancyvrb}
\usepackage{relsize}
\fvset{fontfamily=fvm}
\fvset{fontsize=\relsize{-2}}
\renewcommand{\ttdefault}{fvm} % needs to be smaller...
\begin{document}

$\langle$ \Verb!foobar123! $\rangle$

$\langle \texttt{foobar123} \rangle$

\end{document}

enter image description here

So how to I apply the relsize{-2} by default to \texttt?

4

Instead of using low level \fontsize and \fontfamily commands or \relsize, you should load the package beramono that provides a scaled option for deciding the height of the characters.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scaled=.75]{beramono}
\usepackage{fancyvrb}

\begin{document}

Some text $\langle$\Verb!foobar123!$\rangle$ end.

Some text $\langle\texttt{foobar123}\rangle$ end.

\end{document}

Change the fraction .75 to what really suits you. In any case, since \texttt and \Verb by default use the same font, this will ensure the same result in both cases.

enter image description here

|improve this answer|||||
  • Thanks. I didn't know this font was beramono, but indeed it looks the same. I use it with scaled=0.73 and a baseline stretch of 0.95 which gives me approximately the same line spacing as before, so I don't have to go over the layout of >100 pages again. – Emit Taste Mar 9 '13 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.