# Use default typewriter font only for a part of the document

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}


## 1 Answer

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}

• Thank you very much, works perfect for me :) – user143732 Mar 5 '19 at 7:52