-1

I think this is simple.

I am using LaTeX in Rmarkdown, with the amsmath package. I am using \begin{equation} XX \end{equation} so that I can label my equations throughout the document.

However, I have a set of equations that I would like aligned for simplicity. I have tried the following:

\begin{align*}
\begin{equation}
\frac{dF}{dt} &= - j_{FI}
\end{equation} \\
\begin{equation}
\frac{dV}{dt} &= j_{VG}
\end{equation} 
\end{align*}

But it won't run. I get the following error: LaTeX Error: Bad math environment delimiter. I can either align{} or do equation{} but not both. Any insight?

lmbradley
  • 109
  • 1
  • 1
  • 9
  • Your question is very confusing. In the title you talk about `equation*`, in the body you have `equation`. In the text you talks about `align`, in the code you have `align*`. One needs a very good crystal ball to make sense of this ... – samcarter_is_at_topanswers.xyz Jul 19 '22 at 18:51
  • ((Edit: I also thought that align and equation were independent functions- hence why I was trying to combine them. I didn't realize they could do complementary functions...)) I apologize, I actually was so unfamiliar with it that I didn't realize they were separate arguments, and then when I edited, I didn't change the title. I thought people were saying the ``*`` to indicate it was a function and then input. I'll fix the title – lmbradley Jul 22 '22 at 02:12

1 Answers1

1

By adding a * to the normal align environment, you remove the numbering and possibility to use labels. Just don't do that if you want to label your expressions:

\documentclass{article}

\usepackage{amsmath}


\begin{document}

\begin{align}
%\begin{equation}
\frac{dF}{dt} &= - j_{FI}\label{eq1}
%\end{equation} 
\\
%\begin{equation}
\frac{dV}{dt} &= j_{VG}\label{eq2}
%\end{equation} 
\end{align}


\ref{eq1}


\ref{eq2}

\end{document}

enter image description here

  • Ah thank you so much. I've been banging my head to get this to work. Two questions: I was able to get this to work without the ``ref{eq1}`` lines- as in the number still worked and did not mess up later numbering on the sections I do not need aligned. What it its purpose? Second question, what do you mean by "if I don't want to label my expressions"? I feel like that must not mean the equation # label itself, right? (Sorry, fairly new to LaTeX) – lmbradley Jul 19 '22 at 18:55
  • Oops, three questions. I tried some googling but still unsure. What does the % do to the ``\begin{equation}`` code? Clearly that is the major piece I was missing... – lmbradley Jul 19 '22 at 18:57
  • 1
    @lmbradley The `\ref` was just to show that the label work. By "Just don't do that if you want to label your expressions:" I meant don't add stars if you want numbering – samcarter_is_at_topanswers.xyz Jul 19 '22 at 18:58
  • 1
    The `%` are comment characters. You can also remove the lines instead of commenting them. – samcarter_is_at_topanswers.xyz Jul 19 '22 at 19:00
  • 1
    @lmbradley Maybe to expand a bit on the terminology: the numbering besides the equation, e.g. `(1)` is normally called "tag". In the latex world, label usually means `\label{SomeWordHere}`, which then can be used in your text with `See equation \ref{SomeWordHere}`. – samcarter_is_at_topanswers.xyz Jul 19 '22 at 19:02
  • Ah so essentially, in the future I just use {align} and then use the ``\label`` feature to add equation labels, and my future ``{equation}`` bits will auto-detect my labels and continue numbering? – lmbradley Jul 19 '22 at 19:14
  • 1
    Yes, align and equation use the same counter, so the numbering will continue – samcarter_is_at_topanswers.xyz Jul 19 '22 at 19:39
  • 1
    The `\label{...}` bit is optional. You only need it if you want to refer to the number somewhere in the text using `\ref{...}` – samcarter_is_at_topanswers.xyz Jul 19 '22 at 19:40