4

I have a document with some verbatim in it and I wanted to change the font to libertine, but this also changes the verbatim parts. Is there a way to keep the verbatim parts in computer-y font while changing the text to libertine font?

\documentclass[25pt]{article} 
\usepackage{libertine, verbatim}

\begin{document} 
\verb|looks odd| 
\end{document}
6

It is not a clash! Package libertine defines all three font families roman (Libertine), sans serif (Biolinum), and mono (Libertine Mono). Do not load the Libertine mono font if you do not want that:

\documentclass[12pt]{article} 
\usepackage[mono=false]{libertine}
\usepackage{verbatim}

\begin{document} 
\verb|looks good| 
\end{document}

However, using Bera Mono as typewriter font looks better. It also has a bold variant:

\documentclass[12pt]{article} 
\usepackage[T1]{fontenc}
\usepackage[mono=false]{libertine}
\usepackage[scaled=0.85]{beramono}%% or 0.82
\usepackage{verbatim}
\begin{document} 
Normal text \textsf{Biolinum} \verb|looks good| \texttt{bera mono}

Also available in bold \textbf{\texttt{bera mono bold}} 
\end{document}

enter image description here

  • Sorry, I think "clash" has a technical meaning but I meant it in a colloquial sense. Anyway, this looks good. Many thanks! – Flounderer Sep 24 '14 at 21:28
1

What about:

\documentclass[25pt]{article} 
\usepackage{libertine, verbatim}
    \makeatletter
    \g@addto@macro\verbatim\sffamily{}
    \makeatother
\begin{document} 
\verb|looks odd| 
\end{document}
1

Adjust \verbatim@font to choose cmtt - the Computer Modern Typerwriter font that looks computer-y:

enter image description here

\documentclass{article}
\usepackage{libertine}
\begin{document}
looks good \verb|looks odd| looks good

\makeatletter
\renewcommand{\verbatim@font}{\fontfamily{cmtt}\selectfont}
\makeatother

looks good \verb|looks odd| looks good
\end{document}

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.