如何解决将长方程分解为多行这一老问题,但这次是在环境中lstlisting[mathescape]
。附件是最小工作示例。
\documentclass{standalone}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[mathescape]
$\displaystyle
a = b =c = d =e \\ =f =g =e =h = \alpha
$
\end{lstlisting}
\end{document}
答案1
如果你想要某种多行数学环境,例如aligned
\documentclass{standalone}
\usepackage{listings,amsmath}
\begin{document}
\begin{lstlisting}[mathescape]
$\begin{aligned}
a = b =c = d =e \\ =f =g =e =h = \alpha
\end{aligned}$
\end{lstlisting}
\end{document}