
我正在使用包Inconsolata
中提供的字體zi4
。但對於單一宏,我想使用預設的打字機字體(所以不是Inconsolata
)。\texttt
文件中出現的所有其他地方都應使用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
您可以使用該\fontfamily
命令。
\documentclass{article}
\usepackage[varqu]{zi4}
\newcommand{\csharp}{C{\fontfamily{cmtt}\selectfont\#}}
\begin{document}
\csharp\par
This should be \texttt{Inconsolata}.
\end{document}