为 equation LaTex 创建环境
Create environment for equation LaTex
我正在尝试为 LaTex 中的方程创建一个新环境。
这是我试过的
\newenvironment{myeq}
{
\begin{fleqn}[\parindent]
\begin{equation*}
\begin{split}
}
{
\end{split}
\end{equation*}
\end{fleqn}
}
但是,当我尝试 运行 代码时,我得到了 "LaTex Error: \begin{split} ended by \end{myeq}"。
有人可以帮助我了解我做错了什么吗?谢谢!
您的代码中有一个小错误:\begin{split} 和 \end{split} 中的括号被调换了。
此外,如果您只想在一个方程中使用 fleqn,则必须包含包 \usepackage[fleqn]{nccmath}
。有一个类似的问题here,给出了解决方案:使用包environ
并将你的环境写成
\NewEnviron{myeq}{%
\begin{fleqn}[\parindent]
\begin{equation*}
\begin{split}
% your equation here...
\end{split}
\end{equation*}
\end{fleqn}
}
作为进一步的建议,我建议查看 https://tex.stackexchange.com/ 的 LaTeX 问题:您可能会比此处更快地找到答案。
我正在尝试为 LaTex 中的方程创建一个新环境。 这是我试过的
\newenvironment{myeq}
{
\begin{fleqn}[\parindent]
\begin{equation*}
\begin{split}
}
{
\end{split}
\end{equation*}
\end{fleqn}
}
但是,当我尝试 运行 代码时,我得到了 "LaTex Error: \begin{split} ended by \end{myeq}"。 有人可以帮助我了解我做错了什么吗?谢谢!
您的代码中有一个小错误:\begin{split} 和 \end{split} 中的括号被调换了。
此外,如果您只想在一个方程中使用 fleqn,则必须包含包 \usepackage[fleqn]{nccmath}
。有一个类似的问题here,给出了解决方案:使用包environ
并将你的环境写成
\NewEnviron{myeq}{%
\begin{fleqn}[\parindent]
\begin{equation*}
\begin{split}
% your equation here...
\end{split}
\end{equation*}
\end{fleqn}
}
作为进一步的建议,我建议查看 https://tex.stackexchange.com/ 的 LaTeX 问题:您可能会比此处更快地找到答案。