Math & ScienceOnly one equation number in {align*}

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
zimbodel
Posts: 20
Joined: Tue Jul 31, 2018 4:05 am

Only one equation number in {align*}

Post by zimbodel »

This one keeps biting me for years, and I cannot find a solution doing online search.

How do I get only one equation number displayed in an align* environment

Code: Select all

\begin{align*}
\end{align*}
containing several equations?
Last edited by Stefan Kottwitz on Sun Jan 15, 2023 2:43 am, edited 1 time in total.
Reason: code marked

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Only one equation number in {align*}

Post by Stefan Kottwitz »

Hi zimbodel,

I would use an equation environment and within this an aligned environment.

Stefan
LaTeX.org admin
zimbodel
Posts: 20
Joined: Tue Jul 31, 2018 4:05 am

Only one equation number in {align*}

Post by zimbodel »

Silly me now I remember....
It always catches me after I dont use latex for a while and I always seem to forget that.
It is one of those tricks that only makes sense once you know about it.
Thanks.
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Only one equation number in {align*}

Post by marbocam »

I'm having the same issue, but latex doesn't like the nesting..

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

What am I doing wrong?

Code: Select all

\begin{equation}
\begin{align}
	{E}_{PD}\ \left(t \right) =& \!\left[ {T}_o{J}_o\left({{m}_{RF}} \right) + j{J}_1\left({{m}_{RF}} \right){e}^{j\frac{1}{2}{\beta }_2L\omega _{RF}^2} \right.\\ & \times \left({{e}^{j{\omega }_{RF}t} + {e}^{ - j{\omega }_{RF}t}} \right) \\ & \!-\! \left. {J}_2\left({{m}_{RF}} \right){e}^{j2{\beta }_2L\omega _{RF}^2}\!\left({{e}^{j2{\omega }_{RF}t} \!+\! {e}^{ - j2{\omega }_{RF}t}} \!\right) \!\right] e ^{j{\omega }_ot}\\ & + {T}_o{J}_o\left({{m}_{RF}} \right){e}^{j\frac{1}{2}{\beta }_2L\omega _{IF}^2}\left({m}_ + \cdot {e}^{j{\omega }_{IF}t} + {m}_ - \right.\\ & \cdot \left. {e}^{ - j{\omega }_{IF}t} \right){e}^{j{\omega }_ot} + j{J}_1\left({{m}_{RF}} \right){e}^{j\frac{1}{2}{\beta }_2L{{\left({{\omega }_{RF} + {\omega }_{IF}} \right)}}^2}\\ & \times \left({{m}_ + {e}^{j\left({{\omega }_{RF} + {\omega }_{IF}} \right)t} + {m}_ - {e}^{ - j\left({{\omega }_{RF} + {\omega }_{IF}} \right)t}} \right){e}^{j{\omega }_ot} \\ & + j{J}_1\left({{m}_{RF}} \right){e}^{j\frac{1}{2}{\beta }_2L{{\left({{\omega }_{RF} - {\omega }_{IF}} \right)}}^2}\\ &\!\times\! \left({{m}_ - \cdot {e}^{j\left({{\omega }_{RF} \!-\! {\omega }_{IF}} \right)t} \!+\! {m}_ + \cdot {e}^{ - j\left({{\omega }_{RF} \!-\! {\omega }_{IF}} \right)t}} \right){e}^{j{\omega }_ot} \\ & - {J}_2\left({{m}_{RF}} \right){e}^{j\frac{1}{2}{\beta }_2L{{\left({2{\omega }_{RF} + {\omega }_{IF}} \right)}}^2}\\ & \times \left({{m}_ + \cdot {e}^{j\left({2{\omega }_{RF} + {\omega }_{IF}} \right)t} + {m}_ - \cdot {e}^{ - j\left({2{\omega }_{RF} + {\omega }_{IF}} \right)t}} \right)\\ & \times {e}^{j{\omega }_ot} - {J}_2\left({{m}_{RF}} \right){e}^{j\frac{1}{2}{\beta }_2L{{\left({2{\omega }_{RF} - {\omega }_{IF}} \right)}}^2}\\ & \!\times\! \left({{m}_ - \cdot {e}^{j\!\left({2{\omega }_{RF} \!-\! {\omega }_{IF}} \!\right)t} \!+\! {m}_ + \cdot {e}^{ - j\!\left({2{\omega }_{RF} \!-\! {\omega }_{IF}} \!\right)t}} \!\right){e}^{j{\omega }_ot}
\end{align}
\end{equation}\label{poc_E_PD_t}
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Only one equation number in {align*}

Post by marbocam »

Anyway, I fixed it with \nonumber... Still, I would like to know how to nest the aligned..
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: Only one equation number in {align*}

Post by Stefan Kottwitz »

@marbocam Use aligned instead of align, then it works.

Stefan
LaTeX.org admin
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Only one equation number in {align*}

Post by marbocam »

I did work, but not within a table... What am I doing worng this time¿? This should work, right?

Code: Select all

\begin{table}[h]
\caption{Analytical Terms of the Photocurrent Amplitude at mmW Band}
\centering
\begin{tabular}{p{1cm}p{1cm}p{9cm}}
\hline\hline
\centering L&$\centering T_0$& \centering\arraybackslash $i_{RF}(2\omega_{RF}-\omega_{IF})$\\
\hline
\[\text{0}\] & \[\text{1}\] & \begin{equation} 0 \label{poc_eq_10} \end{equation}\\
\[\text{L}\] & \[\text{1}\] & \begin{equation}\begin{aligned}
&2 \Re P_0 m_{AM}\left(\frac{m_{RF}}{2}\right)^2 sin^2 \Theta
& \cdot \left[\sqrt{1+\alpha^2}cos(\Theta - atan \alpha) + j\alpha \frac{\kappa P_0}{\omega_{IF}}sin\Theta \right] \label{poc_eq_11}
\end{aligned}\end{equation}\\
\[\text{L}\] & \[\text{0}\] &\begin{equation}\begin{aligned}
&\Re P_0 m_{AM}\left(\frac{m_{RF}}{2}\right)^2
& \cdot \left[\sqrt{1+\alpha^2}cos(\Theta - atan \alpha) + j\alpha \frac{\kappa P_0}{\omega_{IF}}sin\Theta \right] \label{poc_eq_12}
\end{aligned}\end{equation}\\
\hline\hline
\end{tabular}\label{poc_Table_1}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: Only one equation number in {align*}

Post by Stefan Kottwitz »

This should work. However, you don't have \end{table}, so it brings an error. You need to load the array package; perhaps you do it, but I don't see your document preamble. It would always be good to post a small complete example, otherwise, each reader needs to add code (which may be different to your other code) to compile it or cannot test the code.

Stefan
LaTeX.org admin
marbocam
Posts: 38
Joined: Thu Dec 19, 2024 11:14 am

Re: Only one equation number in {align*}

Post by marbocam »

Sorry for that.. My original code does contain \end{table}...

I finally figured what was wrong with my code, I needed to add \\ after the first line of the equation :)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10319
Joined: Mon Mar 10, 2008 9:44 pm

Re: Only one equation number in {align*}

Post by Stefan Kottwitz »

table-equation.png
table-equation.png (34.1 KiB) Viewed 13069 times
Ah, perhaps you mean the \\ within the "aligned" part, since \\ sepearate the rows in a multi-line equation, but the equation environment itself is single-line without \\ ;-) Just to be clear to where the \\ belongs.

Stefan
LaTeX.org admin
Post Reply