Do a left double quote that looks right both as monospaced and non-monospaced fonts

fontsquotationtypewriter

As best I can tell, if I want a correct left double quote mark:

  • in all non-monospaced fonts I must do “X
  • in all monospaced fonts I must do "X

In my case this is an issue because I have a macro that needs to take some text as an argument that it may need to typeset using one, the other or even both kind of fonts.

Is there any combination of quote convention and monospaced/normal fonts that get left double quote correct both ways?

A Minimal Example That Demos The Problem.

\documentclass{article}

\usepackage [autostyle, english = american]{csquotes}

\newcommand{\Foo}[1]{ % format the same argument in different fonts.

% monospaced look like garbage
\medbreak\begin{empty}\fontfamily{pcr}\selectfont#1\end{empty}   Courier

% Okay, unless you really look
\medbreak\begin{empty}\fontfamily{ppl}\selectfont#1\end{empty}   Palatino 

% Easy to see issues.
\medbreak\begin{empty}\fontfamily{qag}\selectfont#1\end{empty}   TeX Gyre Adventor

}

\begin{document}
\Foo{``X'' ``X" "X" \enquote{X}}  % try different way to quote things.
\end{document}

What I've already tried

Most of the searching I've done just gets results talking about how to get correct left double quotes for non-monospaced fonts. I've found a small number of results about left double quote in monospaced fonts, but nothing that deal with both.

I found a hint that it might be possible to get something by installing a custom monospaced font, but I need as self contained a solution as practicable. (That pdflatex is breaking hermeticity already annoys me, but I can live with that.)

Best Answer

OT1 encoded monospaced fonts don't have the “double back quote” ligature, because in the cmtt fonts the place of the double open quote is used for a different glyph (the backslash).

Add \usepackage[T1]{fontenc}; all T1 encoded fonts should have that ligature (and also the undirected double quote if you type ").

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

\usepackage [autostyle, english = american]{csquotes}

\newcommand{\Foo}[1]{ % format the same argument in different fonts.

% monospaced look like garbage
\medbreak{\fontfamily{pcr}\selectfont#1}   Courier

\medbreak{\fontfamily{cmtt}\selectfont#1}  CMTT

% Okay, unless you really look
\medbreak{\fontfamily{ppl}\selectfont#1}   Palatino

% Easy to see issues.
\medbreak{\fontfamily{qag}\selectfont#1}   TeX Gyre Adventor

}

\begin{document}

\Foo{``X'' ``X" "X" \enquote{X}}  % try different way to quote things.

\end{document}

enter image description here