texttt의 중괄호는 중괄호로 해석되지 않고 f 및 g로 해석됩니다.

texttt의 중괄호는 중괄호로 해석되지 않고 f 및 g로 해석됩니다.

중괄호(일명바지 멜빵) \texttt{}모드에서는 다음과 같이 해석됩니다.에프그리고g. 적절한 중괄호를 얻으려면 어떻게 해야 합니까? 사용하려고 했지만 \string여러 줄로 분할할 수 없는 것 같습니다.


다음은 최소한의 작업 예입니다.

\documentclass{article}
\usepackage{empheq}
\newcommand*\widefbox[1]{\fbox{\hspace{2em}#1\hspace{2em}}}

\begin{document}

Compiles but gives "f g"-problem:
\begin{empheq}[box=\fbox]{align*}
&\texttt{\{}\\
&\texttt{something}\\
&\texttt{\}} 
\end{empheq}

Compiles and gives proper curly brackets, but I need three lines not one:
\begin{empheq}[box=\fbox]{align*}
\texttt{\string{ something \string}}
\end{empheq}

\iffalse
Does not compile:
\begin{empheq}[box=\fbox]{align*}
\texttt{\string{ \\
 something \\
 \string}}
\end{empheq}
\fi

\end{document} 

답변1

문제를 재현할 수 없습니다. 반면에 고정 폭 글꼴로 중괄호를 얻으려면 다음 중 하나를 로드할 수 있습니다.

\usepackage[T1]{fontenc}

또는 다음과 같이 입력하세요.

\texttt{\symbol{`\{}}

그리고

\texttt{\symbol{`\}}}

관련 정보