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.

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}
share|improve this question
    
Just noticed it worked too in normal conditions, it's inside \texttt{} it pose problems. –  Norswap Nov 21 '12 at 0: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 0: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 0:51
1  
@cyberSingularity {,}, works nicely. If you want to make an answer of it, I'll accept it. –  Norswap Nov 21 '12 at 1: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 tex.stackexchange.com/questions/1390/latin-modern-vs-cm-super –  doncherry Nov 21 '12 at 1:30

1 Answer 1

up vote 8 down vote accepted

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

share|improve this answer
    
Here is another solution: \texttt{,{},}. –  Paul Gaborit Nov 21 '12 at 1:24
    
@PaulGaborit: Thanks, completely overlooked that! Have now added it into my answer. –  cyberSingularity Nov 21 '12 at 1:29
2  
My recommendation would be not to use ae at all. –  egreg Nov 21 '12 at 9:49
    
The issue is the same with lmodern, and the same solution applies. –  Norswap Nov 21 '12 at 15:10

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.