4

I'm writing a report. I first did it on ShareLaTeX and it compiled successfully. Now, I'm redoing it on texmaker and it doesn't compile stating the following error: "invalid use of \intertext".

The part on the code in which I get the error is this one:

\begin{subequations}
\begin{align}\label{eq:twoa}
    \begin{split}
    J\dot{\omega}=rF_z \mu \left(\dfrac{v-\omega r}{v}\right)-T_b \\
    m\dot{v}=-F_z \mu \left(\dfrac{v-\omega r}{v}\right)
    \end{split}      
\end{align}
\intertext{\noindent In (\ref{eq:twoa}) the state variables are $\omega$ and $v$. Since $\omega$, $v$, and $\lambda$ are linked by an algebraic relationship, it is possible to replace the state variable $\omega$ with the state variable $\lambda$. This can be simply obtained by plugging the following two relationships 
\begin{align*}
    \dot{\lambda}=-\dfrac{r}{v}\dot{\omega} + \dfrac{r\omega}{v^2}\dot{v}, \hspace{4mm} \omega=\dfrac{v}{r}(1-\lambda)
\end{align*}
into the first equation of (\ref{eq:twoa}), so obtaining:}

\begin{align}\label{eq:twob}
    \begin{split}
    \dot{\lambda}=-\dfrac{1}{v}\left(\dfrac{(1-\lambda)}{m}+\dfrac{r^2}{J}\right) F_z \mu(\lambda) + \dfrac{r}{vJ}T_b \\
    m\dot{v}=-F_z\mu(\lambda)
    \end{split}      
\end{align}
\end{subequations}

And actually the output is this one in ShareLaTeX (what I need): enter image description here

But I can't make it work in texmaker, I keep getting the "invalid use of \intertext" error message. What should I do to fix this on texmaker? Or how could I get the same output properly?

Airman01
  • 455
  • 2
    That would be equally wrong regardless of ShareLaTeX or Texmaker, you probably just ignored/missed the errors that ShareLaTeX told you about. \intertext is meant to be placed inside an align environment. – Torbjørn T. Aug 03 '17 at 14:57
  • 1
    Also, next time, please post a full minimal example instead of jut a sniplet. Then it is easy for others to copy and test your exact example on their own PCs. Thus much easier for us to help. As Torbjørn mentions, \intertext does not make any sense out side of align(*), alignat(*) and gather(*). – daleif Aug 03 '17 at 14:59

1 Answers1

4

You don't really need \intertext at all here, just remove it. Also, don't use align for single-line equations (align vs equation).

output of code

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\begin{equation}\label{eq:twoa}
    \begin{split}
    J\dot{\omega}=rF_z \mu \left(\dfrac{v-\omega r}{v}\right)-T_b \\
    m\dot{v}=-F_z \mu \left(\dfrac{v-\omega r}{v}\right)
    \end{split}      
\end{equation}
In (\ref{eq:twoa}) the state variables are $\omega$ and $v$. Since $\omega$, $v$, and $\lambda$ are linked by an algebraic relationship, it is possible to replace the state variable $\omega$ with the state variable $\lambda$. This can be simply obtained by plugging the following two relationships 
\begin{equation*}
    \dot{\lambda}=-\dfrac{r}{v}\dot{\omega} + \dfrac{r\omega}{v^2}\dot{v}, \hspace{4mm} \omega=\dfrac{v}{r}(1-\lambda)
\end{equation*}
into the first equation of (\ref{eq:twoa}), so obtaining:
\begin{equation}\label{eq:twob}
    \begin{split}
    \dot{\lambda}=-\dfrac{1}{v}\left(\dfrac{(1-\lambda)}{m}+\dfrac{r^2}{J}\right) F_z \mu(\lambda) + \dfrac{r}{vJ}T_b \\
    m\dot{v}=-F_z\mu(\lambda)
    \end{split}      
\end{equation}
\end{subequations}
\end{document}

Regarding ShareLaTeX, I guess you see something like this:

enter image description here

Notice that little red box with the number 1 in it? That means that you got one error. While the output of a document with errors is sometimes correct, that is just luck, so you should always make sure to not have any errors. If you click that icon with the red box, you'll see what the error says:

enter image description here

Torbjørn T.
  • 206,688