4

I'm using the Inconsolata font provided by the zi4 package. But for a single macro, I want to use the default typewriter font (so not Inconsolata). Every other occurrence of \texttt in the document should use Inconsolata.

\documentclass{article}

\usepackage[varqu]{zi4}

\newcommand{\csharp}{C\texttt{\#}} % How can I use the default typewriter font here?    

\begin{document}
  This should be \texttt{Inconsolata}.
\end{document}
4

You can use the \fontfamily command.

\documentclass{article}

\usepackage[varqu]{zi4}

\newcommand{\csharp}{C{\fontfamily{cmtt}\selectfont\#}}

\begin{document}
    \csharp\par
  This should be \texttt{Inconsolata}.
\end{document}
  • 1
    Thank you very much, works perfect for me :) – user143732 Mar 5 '19 at 7:52

Your Answer

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