![如何在打字機字體中產生穩定的數學符號?](https://rvso.com/image/475714/%E5%A6%82%E4%BD%95%E5%9C%A8%E6%89%93%E5%AD%97%E6%A9%9F%E5%AD%97%E9%AB%94%E4%B8%AD%E7%94%A2%E7%94%9F%E7%A9%A9%E5%AE%9A%E7%9A%84%E6%95%B8%E5%AD%B8%E7%AC%A6%E8%99%9F%EF%BC%9F.png)
答案1
您可以考慮用 包裹 & 符號\textnormal
,然後將內部字體變更為等寬字體,以防止同一範圍內其他字體命令的干擾。這可確保 & 符號始終排版為中等粗細、直立和等寬字體。
\documentclass{article}
\newcommand*{\ttand}{\mathord{\textnormal{\ttfamily\&}}}
\begin{document}
\itshape $\ttand$ % shape
\bfseries$\ttand$ % weight
\sffamily$\ttand$ % family
\sffamily\scshape\bfseries$\ttand$ % or even all three!
\end{document}
答案2
我會用\mathtt
.
\documentclass{article}
\newcommand*\ttand{\mathtt{\mathchar\inteval{"7000+`\&}}}
\begin{document}
text $\ttand$ text
\textit{text $\ttand$ text}
\end{document}
解釋:我們想要得到一個尊重目前數學組的符號,因此它的數學代碼應該是"70xx
,其中"xx
是 的 ASCII 代碼&
。由於我懶得找後者,所以我使用簡單的算術。