# How to prevent double quotes when using the verbatim package and fontenc?

Is there a way to disable LaTeX's transformation of all double quotes e.g. ''  << >> into formatted double quotes when using the verbatim package in conjunction with fontenc and redefining \verbatim@font such as:

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{verbatim}

\makeatletter
\renewcommand{\verbatim@font}{\fontsize{10pt}{12pt}\selectfont\ttfamily}%
\makeatother
\newenvironment{code}
{\topsep=0pt\partopsep=0pt\endgraf\verbatim}
{\endverbatim}

\begin{document}

\begin{code}
0x3333 << 1
\end{code}

\end{document}


The above turns << into a formatted french quote. If I don't use the fontenc package, or if I don't redefine \verbatim@font then it displays ok. For my document, I want to redefine the font (mainly to have better granularity than \small, \tiny etc) and I use the fontenc package because other parts of the document otherwise display wrong fonts.

Can I disable double quotes inside \verbatim or globally?

I could also ditch the verbatim package, but I want to define a command around verbatim text, and you can't do that by default.

It all works apart from those pesky quotes ... any help will be appreciated

• Please provide a complete small document that shows the problem (all questions should have such an example). What you describe is not the default behaviour, so it depends how you have defined < – David Carlisle Feb 28 '15 at 13:03
• Welcome to TeX.SX! – Mico Feb 28 '15 at 13:04
• You're right. I edited the question and provided a full example. The problem manifests itself in conjunction with the fontenc package and redefining \verbatim@font. Any ideas to prevent the formatting of << ? – Bogdan Feb 28 '15 at 14:21

Doh, I forgot to RTFM! It's in the manual section 3.2 which discusses \verbatim@font

To fix my problem, change the redefinition of \verbatim@font to the following:

\makeatletter
\renewcommand{\verbatim@font}{\fontsize{10pt}{12pt}\selectfont\ttfamily
\hyphenchar\font\m@ne
\let\do\do@noligs
\verbatim@nolig@list}
\makeatother

• yes if you redefine verbatim not to do verbatim, it stops doing verbatim +1 glad you got it working;-) – David Carlisle Feb 28 '15 at 14:44
• Indeed. Not enough coffee today. – Bogdan Feb 28 '15 at 15:45

TeX-style ligatures for character sequences such as << and >> are enabled in T1-encoded fonts even for monotype font faces. The following remedy should work: Insert the instructions

\usepackage{microtype}
\DisableLigatures{encoding = T1, family = tt* }


in the preamble.

Loading the microtype package may be a good idea in any case...

• Thanks for this. The microtype package is required for \DisableLigatures. I wanted a solution without having to use extra packages, but this is useful as it disables ligatures for all tt* fonts, including inline (text) which is quite handy for my current use case. – Bogdan Feb 28 '15 at 15:43