Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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