texttt 中的大括號不解釋為大括號,而是解釋為 f 和 g

texttt 中的大括號不解釋為大括號,而是解釋為 f 和 g

當我複製貼上大括號(又名大括號)從\texttt{}模式,它們被解釋為FG。我該怎麼做才能得到正確的大括號?我嘗試使用\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{`\}}}

相關內容