1

I haven't finished writing the final equation but that's not really a problem. I'm not sure if I'm being incredibly dense, but I can't figure out why the equations are not being assigned numbers? I want the equations individually labelled so that I can reference them later on in my paper, without having to entirely recopy the equation.

Ideally I want them centred and aligned (at the equals sign) too, I've managed the alignment so far but I'm also unable to center them at the same time.

Apologies if this is a very basic question, I'm pretty new to using Overleaf/Latex, so any help would be appreciated!

Thanks!

    $$\begin{aligned}
\frac{\partial n}{\partial t} & = G - R - \frac{1}{-e}\frac{\partial J_n}{\partial x} \\ 
\frac{\partial p}{\partial t} & = G - R - \frac{1}{e}\frac{\partial J_p}{\partial x} \\
J_n & = en\mu_nF - (-e)D\frac{\partial n}{\partial x} \\
J_p & = en\mu_pF - eD\frac{\partial p}{\partial x} \\ 
\frac{\partial^2 \phi}{\partial^2 x} & = \\
\end{aligned}$$
4
  • 2
    Welcome to TeX.SE. Please post code as text, not as snapshot. This makes it easier for us to copy/paste and edit. Anyway you should replace $$\begin{aligned}...\end{aligned}$$ with \begin{align}...\end{align}.
    – campa
    Oct 29, 2021 at 14:18
  • @campa Hi, thanks and sorry for this. When I do not have the $$ either side, I get a message saying that I should because of the \mu_n and J_n/p terms. Also, when I paste my code in to the OP, it all clusters up into a few lines instead of how it is in the OL document. Oct 29, 2021 at 14:22
  • You can select the code and hit the button "code sample" (looks like {}) or press Ctrl+K.
    – campa
    Oct 29, 2021 at 14:25
  • @campa Ah I see, thanks, have modified it now! Oct 29, 2021 at 14:28

1 Answer 1

1

Don't use the $$ in LaTeX, as those are PlainTeX tags, I understood that you need all equations to be numbered and the cross links should work accordingly, if my understanding correct, please try with:

\documentclass{book}
\usepackage{amsmath}

\begin{document}

\begin{align}
a+b&=c\label{eq1}\\
d+e&=f\label{eq2}
\end{align}

\ref{eq1} and \ref{eq2}

\end{document}

Please excuse, if my understanding is wrong...

4
  • Hi, yeah this is more of what I wanted - how do I go about also centering this? Oct 29, 2021 at 14:36
  • Also, if I want to align some stuff but don't want them all numbered, is it right to use the align* instead of align? Oct 29, 2021 at 14:42
  • If you want some but not all equations labeled, use \align for the group and \notag for the equations you do not want numbered.
    – Jay
    Oct 29, 2021 at 14:52
  • If you use align* then all the equations becomes unnumbered, and if you want to remove number for selected equations, then use either \nonumber or \notag before \\`, note that I have modified the suggestion with &` to align the math operator... and the center align should come by default, if you didn't get then please post your MWE from \documentclass to \end{document}
    – MadyYuvi
    Oct 29, 2021 at 14:59

You must log in to answer this question.

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