2

Can anyone help me solve this? I have tried everything to write this but it is still not working.

enter image description here

I tried:

\begin{equation}\label{BM2}
\begin{align*}
   \dot{c} &= -Div \textbf{h} + h  && \text{em $\mathcal{P}$}\\
   \textbf{h.n}&=h && \text{em $\partial \mathcal{P}$}
\end{align*}
\end{equation}
1
  • Why do you nest an align* into an equation? (I'm surprised this even compiles for you.) If you remove the equation, it aligns correctly.
    – magula
    Commented Sep 14, 2017 at 19:58

2 Answers 2

1

Don't nest an align environment into an equation environment. align is a math environment itself, so it doesn't need to be called inside of an equation environment. In fact, doing this causes errors.

The following aligns correctly:

\begin{align*}
   \dot{c} &= -Div \textbf{h} + h  && \text{em $\mathcal{P}$}\\
   \textbf{h.n}&=h && \text{em $\partial \mathcal{P}$}
\end{align*}
3
  • This won't produce a number.
    – egreg
    Commented Sep 14, 2017 at 20:14
  • Thank you for your reply, but Egreg managed to put the equation number there. This solved my problem! Thank you
    – Ingrid
    Commented Sep 14, 2017 at 20:19
  • @egreg Right, I didn't know there was supposed to be a number. Happy it was solved!
    – magula
    Commented Sep 14, 2017 at 20:23
1

You get

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

The error message says all: you should use aligned.

However there are other points to fix: the “divergence” operator should be typeset upright and the period should most probably be centered. You also want \mathbf rather than \textbf.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\Div}{Div} % <--- important!

\begin{document}

\begin{equation}\label{BM2}
\begin{aligned}
\dot{c} &= -\Div\mathbf{h} + h  && \text{em $\mathcal{P}$}\\
\mathbf{h}\cdot\mathbf{n} &= h  && \text{em $\partial \mathcal{P}$}
\end{aligned}
\end{equation}

\end{document}

enter image description here

Alternatively, with left alignment as in the original picture

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\Div}{Div} % <--- important!

\begin{document}

\begin{equation}\label{BM2}
\begin{aligned}
&\dot{c} = -\Div\mathbf{h} + h  && \text{em $\mathcal{P}$}\\
&\mathbf{h}\cdot\mathbf{n} = h  && \text{em $\partial \mathcal{P}$}
\end{aligned}
\end{equation}

\end{document}

enter image description here

1
  • I thank you a lot for your reply. I was really searching for all these tips (not only my question LOL!) and you just solved them. Thank you!
    – Ingrid
    Commented Sep 14, 2017 at 20:18

You must log in to answer this question.

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