简体   繁体   中英

Create environment for equation LaTex

I am trying to create a new environment for equations in LaTex. This is what I have tried

\newenvironment{myeq}
{
\begin{fleqn}[\parindent]
\begin{equation*} 
\begin{split}
}
{
\end{split}
\end{equation*}
\end{fleqn}
}

However, when I try to run the code I get "LaTex Error: \begin{split} ended by \end{myeq}". Can someone please help me to understand what I am doing wrong? Thanks!

There is a little mistake in your code: the parenthesis in the \begin{split} and \end{split} are swapped.

Moreover, if you desire to use fleqn in just one equation you have to include the package \usepackage[fleqn]{nccmath} . There was a similar question here , where the solution was given: use the package environ and write your environment as

\NewEnviron{myeq}{%
  \begin{fleqn}[\parindent]
    \begin{equation*} 
      \begin{split}
        % your equation here...
      \end{split}
    \end{equation*}
  \end{fleqn}
}

As a further advice, I suggest to have a look at https://tex.stackexchange.com/ for LaTeX questions: you may find the answer more quickly than here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM