1

I am working on an equation set with some long equations. I use split to divide the long equations into multiple lines. However, I keep getting the error. ! Missing } inserted. } l.231 \end{align}

I expect to create an equation set like this: Expected equations

Below is my code:

\begin{align} \label{eq:3.22}
  \begin{split}
  \left({PC}_i,{SV}_i\right) = &f_{PCA}(\bar{\frac{ds}{dt}},\sigma_\frac{dx_v}{dt},{CF}_\frac{dx_v}{dt},{\frac{ds}{dt}}_{max},\\
  &{\frac{ds}{dt}}_{rms},{IF}_\frac{ds}{dt},{SF}_\frac{ds}{dt},{ED}_\frac{ds}{dt},{CLF}_\frac{ds}{dt})
  \end{split}   \\
  \begin{split}
  d_{j,m}(k) = &\sqrt{(\frac{{SV}_1({PC}_1(k)-{{PC}_{1,m}}^j)}{{SV}_1+{SV}_2+\ldots+{SV}_n})^2\\
  &+(\frac{{SV}_2({PC}_2(k)-{{PC}_{2,m}}^j)}{{SV}_1+{SV}_2+\ldots+{SV}_n})^2+\ldots\\
  &+(\frac{{SV}_n({PC}_n(k)-{{PC}_{n,m}}^j)}{{SV}_1+{SV}_2+\ldots+{SV}_n})^2}
  \end{split}   \\
  P_{det,j}\left(k\right) = f_{det}(d_{j,m}\left(k\right),d_{j,m_1,m_2}\left(k\right))  \\
  \begin{split}
  s\left(k\right) = &s\left(k-1\right)+(m_3n_3\Delta T_j\left(k-1\right)^{n_3-1}\left(\Delta T_j\left(k\right)-\Delta T_j\left(k-1\right)\right)\\
  &+m_1n_1\Delta K\left(k-1\right)^{n_1-1}(\Delta K\left(k\right)-\Delta K\left(k-1\right)))e^{\omega\left(k\right)}
  \end{split}   \\
  l\left(k\right) = m_2{I_{load}}^{n_2}+m_3\Delta T_j\left(k\right)^{n_3}   \\
  y\left(k\right) = s\left(k\right)+v_1(k)  \\
  \Delta T_y\left(k\right) = \Delta T_j\left(k\right)+v_2\left(k\right) \\
  \left[s(0)  \Delta T_j(0)  I_{load}\right] = \left[s_0  \Delta T_{j0}  I_{load}\right]
\end{align}

I am particularly frustrated that trying some possible solutions in the other threads didn't help. Can anybody take a look? Thank you so much!

1
  • Welcome to TeX.SE! You cannot have & inside the \sqrt{....}.
    – user121799
    Sep 29, 2018 at 1:16

2 Answers 2

1

I did some minimal damage repair to your equation. The error was due to the fact that you wrapped a \sqrt{...} around some split that runs over several lines and has & characters in it. One way to go is to work with [...]^{1/2} instead.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align} \label{eq:3.22}
  \begin{split}
  \left({PC}_i,{SV}_i\right) = &
  f_{PCA}\left(\bar{\frac{ds}{dt}},\sigma_\frac{dx_v}{dt},{CF}_\frac{dx_v}{dt},{\frac{ds}{dt}}_{max},
  \right.\\
  &\hphantom{f_{PCA}\left(\right.}\left.{\frac{ds}{dt}}_{rms},{IF}_\frac{ds}{dt},{SF}_\frac{ds}{dt},{ED}_\frac{ds}{dt},{CLF}_\frac{ds}{dt}
  \right)
  \end{split}   \\
  \begin{split}
  d_{j,m}(k) =
  &\left[\left(\frac{{SV}_1\left({PC}_1\left(k\right)-{{PC}_{1,m}}^j\right)}{{SV}_1+{SV}_2+\ldots+{SV}_n}\right)^2\right.\\
  &+\left(\frac{{SV}_2\left({PC}_2\left(k\right)-{{PC}_{2,m}}^j\right)}{{SV}_1+{SV}_2+\ldots+{SV}_n}\right)^2+\ldots\\
  &\left.+\left(\frac{{SV}_n\left({PC}_n\left(k\right)-{{PC}_{n,m}}^j\right)}{{SV}_1+{SV}_2+\ldots+{SV}_n}\right)^2\right]^{1/2}
  \end{split}   \\
  P_{det,j}\left(k\right) = & f_{det}(d_{j,m}\left(k\right),d_{j,m_1,m_2}\left(k\right))  \\
  \begin{split}
  s\left(k\right) = &s\left(k-1\right)+(m_3n_3\Delta T_j\left(k-1\right)^{n_3-1}\left(\Delta T_j\left(k\right)-\Delta T_j\left(k-1\right)\right)\\
  &+m_1n_1\Delta K\left(k-1\right)^{n_1-1}(\Delta K\left(k\right)-\Delta K\left(k-1\right)))e^{\omega\left(k\right)}
  \end{split}   \\
  l\left(k\right) = &m_2{I_\mathrm{load}}^{n_2}+m_3\Delta T_j\left(k\right)^{n_3}   \\
  y\left(k\right) = &s\left(k\right)+v_1(k)  \\
  \Delta T_y\left(k\right) = &\Delta T_j\left(k\right)+v_2\left(k\right) \\
  \left[s(0)  \Delta T_j(0)  I_\mathrm{load}\right] = & \left[s_0  \Delta T_{j0}  I_{load}\right]
\end{align}
\end{document}

enter image description here

I guess that, even though I made some more cosmetic corrections such as the introduction of \left and \right and \mathrm, both of us will agree that there is still considerable room for improvement. In particular, I am wondering about the following questions:

  1. Are you sure you want to use labels like eq:3.22? What if this equation ends up as 4.12? Wouldn't this potentially drive you crazy. (Technically, however, this is a valid label.)
  2. Are you sure that you want to lump these equations together in that way? How many readers will really benefit from this? Wouldn't it be better to group these things in related objects, each of which comes in a smaller set of equations, and to add explanation in between?
  3. I would replace the differential d by upright d's. E.g. the physics package has \dd for that.
2
  • +1 for "there is still considerable room for improvement". :-)
    – Mico
    Sep 29, 2018 at 3:17
  • Hi marmot, thank you and I appreciate your troubleshooting and further suggestions! Actually, the reason why I lumped them together is that I have discussed them basically one by one in detail, and finally I would like to analytically stack them to show the readers the complete model. If they have anything unclear, going over earlier discussions should help. However, I would give a second thought on whether to keep this lumped equation set. Again, thank you so much!
    – Nathanlu
    Sep 30, 2018 at 17:42
1

Some suggestions:

  • You can't have an alignment point (&) inside a \sqrt{...} object. Use [...]^{1/2} notation instead.

  • Don't overuse \left and \right. Use explicit sizing instructions only where needed.

  • Use \overline if the bar needs to span the full width of the associated fractional expression.

  • Use \mathit{...} to denote multi-letter variable names. Use \mathrm for whole words and acronyms such as "load", "PCA", "det", "rms", and "max".

  • In most places where you use \ldots, \cdots would be more appropriate. However, it's even better to just write \dots and let LaTeX figure out which type of (typographic) ellipsis to employ.

  • Use less space between the variable names and some of their fraction-style subscript terms.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'align' environment
\usepackage{geometry} % set page size parameters suitably
% some macros to ease the inputting burden:
\newcommand\SVitem[2]{\mathit{SV}_{\!#1}(\mathit{PC}_{\!#1}(k)-{\mathit{PC}_{\!#1,m}}^j)}
\newcommand\sumSV{\mathit{SV}_{\!1}+\mathit{SV}_{\!2}+\dots+\mathit{SV}_{\!n}}

\begin{document}
\begin{align} \label{eq:3.22} % why just 1 \label for 8 equations?
  (\mathit{PC}_{\!i},\mathit{SV}_{\!i}) 
  &= f_{\mathrm{PCA}} \biggl(\,
      \overline{\frac{ds}{dt}},
      \sigma_\frac{dx_v}{dt},
      \mathit{CF}_{\!\frac{dx_v}{dt}},
      \frac{ds}{dt}_{\max},
      \frac{ds}{dt}_{\mathrm{rms}},
      \mathit{IF}_{\!\frac{ds}{dt}},
      \mathit{SF}_{\!\frac{ds}{dt}}, 
      \mathit{ED}_{\!\frac{ds}{dt}},
      \mathit{CLF}_{\!\frac{ds}{dt}} \biggr) \\
\begin{split}
  d_{j,m}(k) &= \biggl\{ 
      \biggl(\frac{\SVitem{1}}{\sumSV}\biggr)^{\!\!2}
     +\biggl(\frac{\SVitem{2}}{\sumSV}\biggr)^{\!\!2}\\
    &\qquad +\dots+
      \biggl(\frac{\SVitem{n}}{\sumSV}\biggr)^{\!\!2} 
   \,\biggr\}^{\!1/2}
\end{split}   \\
  P_{\textrm{det},j}(k) 
      &= f_{\textrm{det}}\bigl(d_{j,m}(k),
           d_{j,m_1,m_2}(k)\bigr)  \\
\begin{split}
  s(k) &= s(k-1)+\bigl\{ m_3n_3\Delta T_j(k-1)^{n_3-1}
          \bigl(\Delta T_j(k)-\Delta T_j(k-1)\bigr)\\
  &\qquad +m_1n_1\Delta K(k-1)^{n_1-1}
         \bigl(\Delta K(k)-\Delta K(k-1)\bigr)
         \bigr\} e^{\omega(k)}
\end{split}   \\
  l(k) &= m_2{I_{\textrm{load}}}^{n_2}+m_3 \Delta T_j(k)^{n_3}   \\
  y(k) &= s(k)+v_1(k)  \\
  \Delta T_y(k) &= \Delta T_j(k)+v_2(k) \\
  [s(0)\Delta T_j(0)I_{\textrm{load}}] 
       &= [s_0\Delta T_{j0}I_{\textrm{load}}]
\end{align}
\end{document}
1
  • 1
    @marmot - Many thanks for spotting the error! As somebody observed, "there's always room for improvement"!. :-)
    – Mico
    Sep 29, 2018 at 5:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .