1

I have a document that has many uses of {/tt some text}, and I learned recently from reading this link: https://texfaq.org/FAQ-2letterfontcmd that apparently {\tt ...} is deprecated in favor of \texttt{...}. I've converted most of the document to use \texttt{...}, but when I try to update a block inside of an author tag the text renders in a weird font.

Original:

\author{
{\small My Name} \\
{\tt \small myEmail@stackexchange.com}
} % end author

With change:

\author{
{\small My Name} \\
\texttt{\small myEmail@stackexchange.com}
} % end author

In the original code, my email address renders in a nice, clean, teletype format. In the changed code, it renders in a pretty ugly italic format. That occurs with or without the \small.

Does anyone know if there is a supported way to render teletype font in an author block without rendering it in ugly italics?

  • 4
    You can use {\upshape\ttfamily ...}. – Werner Mar 25 at 20:59
  • Thank you @Werner, that worked. Would you mind explaining why \texttt renders in Italics? I understand that using \upshape\ttfamily is a modal command - does \texttt choose a different default value for the shape or something? – DIMMSum Mar 25 at 21:07
  • The default behaviour (under article) is to print the author in an upright teletype font. Are you using a special \documentclass? – Werner Mar 25 at 21:14
  • Nothing too fancy: \documentclass[letterpaper,twocolumn,10pt]{article}. – DIMMSum Mar 25 at 21:15
1

\tt switches to \normalfont and therefore changes the font family, series and shape compared to \texttt (or \ttfamily) that just changes the font family.

To see this, use

\def\pshow#1{{\let\protect\show #1}}
\pshow\tt
\pshow\normalfont
\pshow\texttt

Your .log should show

> \tt =\long macro:
->\@fontswitch {\normalfont \ttfamily }{\mathtt }.
\tt ->\protect \tt  

> \normalfont =\long macro:
->\usefont \encodingdefault \familydefault \seriesdefault \shapedefault \relax 
.
\normalfont ->\protect \normalfont  

> \texttt =\long macro:
#1->\ifmmode \nfss@text {\ttfamily #1}\else \hmode@bgroup \text@command {#1}\tt
family \check@icl #1\check@icr \expandafter \egroup \fi .
\texttt ->\protect \texttt  

It's also obvious when using

\itshape something {\tt something} \texttt{somthing}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.