1

I got a big fan of the split environment to share forumula numberings over multiple lines.

However I can't figure out how to use it multiple times inside an align environment. I have an equation that needs to be split in multiple lines, some group of lines form one formula I want to label. How would one do that? the code below doesn't work...

A more precise working example of what I am trying to do:

\documentclass[]{article}
\usepackage{amsmath}
\begin{document}

\begin{align}
\begin{split}
x^{(2)} &= \frac{1}{10} ( \varphi(x_1) +\varphi(-x_1) \\
& + \cdots \\
& + \varphi(100x_1) +\varphi(-100x_1) ) \\
\label{one}
\end{split}
\begin{split}
& + \frac{1}{10}\varphi_{tanh}( 100x_2)  +\frac{1}{10}\varphi_{tanh}(-100x_2)\\
& + \varphi_{tanh}(x_3)
\label{two}
\end{split}
\end{align} 

\end{document}

this produces the output, where I would expect the lines to be below each other:

enter image description here

  • 1
    Your code having two \end{split} but only one \begin{split} which caused compilation error, and can you explain your requirement with little more clear (sorry)... – MadyYuvi Sep 11 at 10:39
  • Dang you're right, but that's not solving the issue. I will elaborate a bit more precisely in my question – Quastiat Sep 11 at 10:53
  • 1
    you are missing a \\ between the two split environments, but also please always post complete documents not fragments – David Carlisle Sep 11 at 11:50
  • Yeah I wasn't sure whether to use `\\` in the last column of a split environment or not but both variants produce the same output – Quastiat Sep 11 at 12:03
  • 1
    no you have no \\ in the align so nothing to make one come above the other (see Bernard's answer with aligned but split is the same) note your example is still not a document that anyone can run to see the issue. – David Carlisle Sep 11 at 12:05
2

Per David comment, \\ required to separate both the lines and use \quad to align the operators. Off topic, in general, trignometry terms like cos, sin and tan should come in roman font only, so please use \tanh instead of tanh and the modified tags are:

\documentclass{book}
\usepackage{mathtools}
\begin{document}

\begin{align}
\begin{split}
x^{(2)} &= \frac{1}{10} ( \varphi(100x_1+175) +\varphi(-100x_1+150) \\
&\quad + \cdots \\
&\quad + \varphi(100x_1-125) +\varphi(-100x_1-150) ) -\frac{1}{10}
\label{one}
\end{split}\\
\begin{split}
&\quad + \frac{1}{10}\varphi_{\tanh}( 100x_2+150)
+\frac{1}{10}\varphi_{\tanh}(-100x_2+150)\\
&\quad + \varphi_{\tanh}(x_5)
\label{two}
\end{split}
\end{align}

\end{document}
  • thank you thats what I was looking for. The problem is I don't want to break style and I am also using \varphi_{sig} ad \varphi_{smax} etc. they should all have the same font. Is there a way to make _{sig} look like _{\tanh} ? – Quastiat Sep 11 at 12:52
  • 2
    Glad to help you, you can define your own like \DeclareMathOperator{\smax}{smax} and the usage is \varphi_{\smax}... – MadyYuvi Sep 11 at 13:06
  • 2
    thanks yeah you're right I didnt think of that – Quastiat Sep 11 at 13:17
3

I would do it with aligned, in this way:

\documentclass[]{article}
 \usepackage{amsmath,mathtools, nccmath}

\begin{document}

\begin{align}
\label{one}
 & \begin{aligned}x^{(2)} = & \mfrac{1}{10} ( \varphi(100x_1+175) +\varphi(-100x_1+150) + \cdots {}\\
& + \varphi(100x_1-125) +\varphi(-100x_1-150) ) -\smash{\mfrac{1}{10}}
\end{aligned}
\\[1ex]
  & \begin{aligned}
\phantom{x^{(2)} = }& + \mfrac{1}{10}\varphi_{\tanh}( 100x_2+150) +\mfrac{1}{10}\varphi_{\tanh}(-100x_2+150)\\
& + \varphi_{\tanh}(x_5)
\end{aligned}
\label{two}
\end{align}

\end{document} 

enter image description here

  • 1
    thanks that works with split, as well. The hint to increase space between splits was helpful as well! – Quastiat Sep 11 at 12:49
1

I would suggest using aligned in the following way, placing equation numbers at the top of each group and using extra indentation for visual grouping. I also provide an alternative with just aligned, but then you have to remember to use \notag often.

Sample output

\documentclass{book}

\usepackage{mathtools}

\begin{document}

Using \verb+aligned+
\begin{align}
  x^{(2)}
  &=
    \begin{aligned}[t]
      &\frac{1}{10} \bigl( \varphi(100x_1+175) +\varphi(-100x_1+150) \\
      &\qquad + \dotsb \\
      &\qquad + \varphi(100x_1-125) +\varphi(-100x_1-150) \bigr)
      -\frac{1}{10}
    \end{aligned}
        \label{one}
  \\
  &\hphantom{{}={}}
    \begin{aligned}[t]
      & + \frac{1}{10}\varphi_{\tanh}( 100x_2+150)
      +\frac{1}{10}\varphi_{\tanh}(-100x_2+150)\\
      &\qquad + \varphi_{\tanh}(x_5)
    \end{aligned}
        \label{two}
\end{align}

Or with just \verb+align+ and \verb+\notag+
\begin{align}
  x^{(2)}
  &=
    \frac{1}{10} \bigl( \varphi(100x_1+175) +\varphi(-100x_1+150) 
    \label{three}\\
  &\qquad + \dotsb \notag\\
  &\qquad + \varphi(100x_1-125) +\varphi(-100x_1-150) \bigr)
    -\frac{1}{10} \notag \\
  &\quad + \frac{1}{10}\varphi_{\tanh}( 100x_2+150)
    +\frac{1}{10}\varphi_{\tanh}(-100x_2+150) \label{four}\\
  &\qquad + \varphi_{\tanh}(x_5) \notag
\end{align}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.