먼저 최소한의 작업 샘플은 다음과 같습니다.
\documentclass{article}
\newcommand*\ttand{\mathord{\texttt{\&}}}
\begin{document}
$\ttand$
\itshape$\ttand$
\end{document}
보시다시피 저는 타자기 글꼴에 수학 기호 &를 정의했습니다. 하지만 등 의 영향을 받을 수 \itshape
있으므로 안정적이지 않습니다 . 게다가 &에서는 작동하지 않기 때문에 by \bfseries
로 바꿔도 작동하지 않습니다 . 그 다음에\texttt
\mathtt
\mathtt
타자기 글꼴로 안정적인 수학 기호를 생성하는 방법은 무엇입니까?
답변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 코드는 입니다 &
. 나는 후자를 찾기가 귀찮기 때문에 간단한 산술을 사용합니다.