Tags and alignment in math equations for latex exports

Things I have tried

I don’t have enough experience with latex, which means I never learned the proper way to tag and align equations.

I have been using align to write multiple equations in a single block and \tag{#} to tag the equation. In obsidian it renders perfectly fine, and in combination with “latex suite” I am typing fast enough to type all of my notes even in my maths class. You have my deepest gratitude for this. Your program is substantially improving my quality of life.

Here is an example of how I use align and tags

$$
\begin{align}
&& V'(k_{t}) & = u'( f(k(t)) - k_{t+1} ) f'(k_{t}) \tag{15} \\
\text{for } t=t+1 && V'(k_{t+1}) & = u'( c_{t+1} ) f'(k_{t+1}) \tag{16}
\end{align}
$$

What I’m trying to do

I am trying to convert a file note to latex to make it a bit more presentable (its an assignment I have to submit).

After converting the markdown file to tex (pandoc -s file.md -o file.tex) I open it in vscode and although it renders the PDF, I get errors that \tag’s are not allowed in align and they are not rendered.

Is there another, “latex-compatible” way to align multiple equations and tag them? (besides breaking up the equations to multiple mathjax sections (I can always align them that way.

@ispanos Could you show the relevant part of the LaTeX source (including math delimiters) after converting the Markdown file to LaTeX?

Sorry for changing the equation, but I couldn’t remember where I got it from.

\[
\begin{align}
& \dot{\lambda}(t) = - \frac{ \partial H(.) }{ \partial y(t) } \\
\iff & \boxed{\dot{\lambda}(t) = - \lambda(t)} \tag{2}
\end{align}
\]
$$
\begin{align}
& \dot{\lambda}(t) = - \frac{ \partial H(.) }{ \partial y(t) } \\
\iff & \boxed{\dot{\lambda}(t)  = - \lambda(t)} \tag{2}
\end{align}
$$

I think that when using pandoc from the terminal, the resulting math sections are not changed. Using the pandoc plugin didn’t work for me. It changed too many things.

This is actually invalid LaTeX: You can’t put the align environment inside math mode (\[...\] or $$...$$ ), even though MathJax seems to accept it. Try aligned environment instead and see if it works for you.

Package amsmath Error: Erroneous nesting of equation structures;
(amsmath)                trying to recover with `aligned'.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.286 \end{align}

As far as I understand, it is already tries to replace align with aligned.

I manually edited that and here is part of the output in vscode

Package amsmath Error: \tag not allowed here.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.230 ...+\beta^{t+1}\lambda_{t+1}R_{t+2} = 0 \tag
                                                  {2}

It still doesn’t like \tags the way I use them. What other method should I try?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.