I would like to always get vertical quotes for ' and " when using the tt font. I can get that with the upquote package for verbatim environments, and with the macros provided by textcomp, but I would also like it to be the default for \texttt and \ttfamily.
\documentclass{article}
\usepackage{textcomp, upquote}
\begin{document}
\verb|This is a vertical quote: '|
\texttt{I wish this were a vertical quote: '
(like this one: \textquotesingle)}
\end{document}
Is there a way to do that? And let me add, with pdflatex, before someone suggests some remapping command that only works with xelatex/lualatex.
Edit:
I have succeeded in implementing a solution via Heiko Oberdiek's lm-ec-tt.map method, at least via the \pdfmapfile command. (I have not yet tried to put the modified .map and .enc files in my ~/texmf area.)
But I also succeeded in getting \ttfamily redefined, which is a path I think I'd prefer. Unfortunately, \texttt still doesn't work. In my (obviously wrong) understanding of the code in article.cls, \texttt should be defined in terms of \ttfamily. So why doesn't the following work for \texttt?:
\documentclass{article}
\usepackage{textcomp, upquote}
\makeatletter
\renewcommand\ttfamily
{\not@math@alphabet\ttfamily\mathtt
\fontfamily\ttdefault\selectfont
\@noligs}% all I do is add this
\makeatother
\begin{document}
\texttt{texttt: quote:'; doublequote:"; grave:`}\par % doesn't work
{\ttfamily ttfamily: quote:'; doublequote:"; grave:`}\par % works
\verb| verb: quote:'; doublequote:"; grave:`|\par
\end{document}



\verband verbatim. I know about that (see my MRE). I'm looking for a way to get\textttto do the same thing. – dedded Jan 16 '17 at 16:16\textttwith\textquotesingle/dbl; what I want is for the characters'and"to be interpreted as vertical quotes within\texttt. – dedded Jan 16 '17 at 18:09\ttfamilyor whatever? Note that you certainly can get this to work in pdfTeX because you can always define a new font and use that for typewriter text. But you probably don't want to go to that much trouble. – cfr Jan 17 '17 at 01:41