3

How do I output two (or more) consecutive commas inside \texttt{} ?

,, displays a black square, \,\, displays nothing, \verb{,,} display three consecutive commas (what the heck!), \verb{\,\,} displays a single comma.

EDIT:

Apparently, the issue is with the ae package.

Here is the minimal example

\documentclass[a4paper, 11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{ae}
\begin{document}
\texttt{,,}
\end{document}
Norswap
  • 185
  • Just noticed it worked too in normal conditions, it's inside \texttt{} it pose problems. – Norswap Nov 21 '12 at 00:45
  • \, is a thin space. The syntax for \verb is not the normal argument syntax, but must begin and end with the same character, eg \verb!,,!. \texttt{,,} works for me as is though... – cyberSingularity Nov 21 '12 at 00:46
  • Problem is with package "ae", updated question. I don't need "ae" (I used a template file) so I just removed it. But if I needed it, would this be unavoidable? – Norswap Nov 21 '12 at 00:51
  • I actually need it... That or lmodern, but it also displays something which not quite two commas (two small vertical lines below the baseline of the text). – Norswap Nov 21 '12 at 00:58
  • 1
    @cyberSingularity {,}, works nicely. If you want to make an answer of it, I'll accept it. – Norswap Nov 21 '12 at 01:02
  • 3
    @Norswap Avoid the ae package in general. Letters consisting of a character and an accent (e.g. ü) will be displayed correctly in the pdf, but you won't be able to search the pdf for them or copy them properly because they're constructed out of u and ¨. Instead, use \usepackage[T1]{fontenc} in combination with either \usepackage{lmodern} or the cm-super fonts installed (the latter don't need to be loaded explicitly). I personally recommend the former, for a comparison see http://tex.stackexchange.com/questions/1390/latin-modern-vs-cm-super – doncherry Nov 21 '12 at 01:30

1 Answers1

8

The issue is caused because the fonts used by the ae package have ligatures for ,,

There are a few questions on this site about how to disable certain kinds of ligatures automatically, but if not in need of an automatic solution, one has to be careful to somehow separate the commas using braces to suppress the ligature, eg ,{},. (Thanks to Paul Gaborit for one form I missed!)

See the following code and resulting image for the various cases:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{ae}

\begin{document}
    Using the \texttt{ae} package:

    \begin{tabular}{ll}
        ,,           & Normal commas \\
        ,{},         & Normal commas with ligatures suppressed \\
        {,}{,}       & Normal commas with ligatures suppressed (2) \\
        {,},         & Normal commas with ligatures suppressed (3)\\
        ,{,}         & Normal commas with ligatures suppressed (4) \\
        \texttt{,,}  & Commas in texttt \\
        \texttt{,{},}& Commas in texttt with ligatures suppressed \\
        \verb!,,!    & Commas in verb \\
    \end{tabular}

\end{document}

illustration of ligatures in ae package and how to avoid them

David Carlisle
  • 757,742