テキスト中の括弧は括弧としてではなく、fとgとして解釈されます。

テキスト中の括弧は括弧としてではなく、fとgとして解釈されます。

中括弧(別名ブレース\texttt{})モードから、それらは次のように解釈される。そして適切な中括弧を取得するにはどうすればいいですか?使用してみました\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{`\}}}

関連情報