LaTeX: Numbering only last line of multi-line equation in \align - latex

I want to number and make a reference to just the last line of a multi-line equation in \align. Here is an example:
\begin{align}
z_1^2 &= \left( 2 e^{i \frac{\pi}{3}} \right) \left( 2 e^{i \frac{\pi}{3}} \right)\\
&= 4 e^{i \frac{2 \pi}{3}}
\end{align}
I only want to number the &= 4 e^{i \frac{2 \pi}{3}} part, rather than both lines of the \align. How do I do this?

From the amsmath documentatiom (amsldoc.pdf):
You can suppress the number on any
particular line by putting \notag
before the \\;
So your equation should look like this (some bits removed from your equation to make it shorter):
\begin{align}
z_1^2 &= \left( ... \right) \left( ... \right)\notag\\
&= 4 e^{i \frac{2 \pi}{3}}
\end{align}

Related

Is there a way to label equations in Latex with words insted of numbers when doing an array?

Is there a way to label equations in Latex with words insted of numbers when doing an array?
I'd like to give a reason each line of my equation list follows from.
I have a temporary solution where you add text next to each line.
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
Basic way to add text to each line.
\begin{align}
x &= 4^{2} - 1 && \text{given}\\
&= 16 - 1 && \text{exponent}\\
&= 15 && \\ % line without text
&= 15 && \text{subtraction}
\end{align}
Better way when removing numbers.
\begin{align*}
x &= 4^{2} - 1 && \text{given}\\
&= 16 - 1 && \text{exponent}\\
&= 15 && \\
&= 15 && \text{subtraction}
\end{align*}
Below, this example put less space between equation and text, and parenthesis.
\begin{alignat}{2}
x &= 4^{2} - 1 && \qquad\text{(given)}\\
&= 16 - 1 && \qquad\text{(exponent)}\\
&= 15 && \\
&= 15 && \qquad\text{(subtraction)}
\end{alignat}
\end{document}
As in this other answer, you may use the command \tag{}:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
x+y\label{eq1}\tag{First one}\\
x+z\label{eq2}\tag{Second one}\\
x-y\label{eq3}\tag{Third one}\\
x-z\nonumber
\end{align}
Then you can cite \eqref{eq1}, \eqref{eq2} and \eqref{eq3} separately.
Or you can cite \ref{eq1}, \ref{eq2} and \ref{eq3}.
\end{document}
See the output of the two styles for the in-text citation:

How do I change a separator in tabular just for one row in LaTeX?

I'd like to change a column separator just for one row in my tabular.
For now, the = is set up as a separator between columns, for the last row I would like to change it for a \vdots.
Thanks a lot.
EDIT:
I did what #achim suggested and it works, but still is there any ''nicer'' solution?
here is a proposition to use the align environment to align the equation you need and write all the math in one same environment rather than in a tabular.
It only require the package amsmath in the beginning of the file.
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath}
\begin{document}
Proposal
\begin{align*}
\text{vychozi tvar} & ~ & y' + p(x) y &= q(x) \\ \hline
\text{reseni} & ~ & y' + p(x)y &= q(x) / \cdot e^{\int p(x)\, \dx} \\
& ~ & \left(y\cdot e^{\int p(x)\, \dx}\right) &=
q(x) \cdot e^{\int p(x)\, \dx} / \text{integrace} \\
& ~ & y\cdot e^{\int p(x)\, \dx} &= \int q(x) \cdot e^{\int p(x)\, \dx}\, \dx \\
& ~ & ~ &\vdots \\
\end{align}
\end{document}
The alignement is made with & sign and you can specify if it is = after or \vdots. You can still use text in this environment, juste use \text{lorem ipsum}.
This environment can number the line, juste remove * in \begin{align*}.
I tried to copy the bit of code you provided in picture, in future, include it in your question so we can solve issue quickly. Sorry if I made typos in my copy, I hope this suite your case.
EDIT : You may want to add the vertical line between the left text and your equations...here is a second solution, however I can't manage to align the equation all along
\begin{tabular}{l|l}
vychozi tvar & \parbox{0.3\linewidth}{%
\begin{align*}
y' + p(x) y &= q(x) \\
\end{align*}}\\ \hline
reseni & \parbox{0.3\linewidth}{%
\begin{align*}
y' + p(x)y = q(x) / \cdot e^{\int p(x)\, \dx} \\
\end{align*}} \\
~ & \parbox{0.3\linewidth}{
\begin{align*}
\left(y\cdot e^{\int p(x)\, \dx}\right) &=
q(x) \cdot e^{\int p(x)\, \dx} / \text{integrace} \\
y\cdot e^{\int p(x)\, \dx} &= \int q(x) \cdot e^{\int p(x)\, \dx}\, \dx \\
~ &\vdots & ~ \\
\end{align*}} \\
\end{tabular}

how to write inline matrix in Latex

\begin{pmatrix} 2 \\ 4 \\ -2 \end{pmatrix}
This is 3*1 vector matrix and i want to write another matrix or x and y s beside that one.
Is there any method to write matrix inline ?
Are you using in-line delimiters around the math? E.g.,
$\begin{pmatrix} 2 \\ 4 \\ -2 \end{pmatrix}$
If you put another matrix inside these delimiters, they will be put in-line next to it. For instance, see this live example:
<script>
MathJax = {
tex: {inlineMath: [['$','$']]}
}
</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax#3/es5/tex-chtml.js" id="MathJax-script"></script>
This math is in line, $
\begin{pmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{pmatrix}
\begin{pmatrix} 2\\ 4\\ -2 \end{pmatrix}
$, with text following it.
Simply put your code inside two dollar signs ($) and it's done.
$ \begin{pmatrix} 2 \\ 4 \\ -2 \end{pmatrix} $
Note that if you put double dollar signs ($$) it will write the matrix in a new line and then continues the rest of the sentence in the line after that.
$$ \begin{pmatrix} 2 \\ 4 \\ -2 \end{pmatrix} $$

How to place a \figure*\minipage\eqnarray at the bottom of the SAME PAGE

I have a big equation that must be placed at the bottom of the page in a two columns paper. The call of the equation is at the end of the first column of a given page, but no matter what place holder I set([h!],[ht],etc), the equation goes to the next page. When I use [H] the equation dont even appear in the document.
I am using...
\documentclass[journal]{IEEEtran}
...
\usepackage{dblfloatfix}
...
The rotational torque that each motor generates is based on the signal compositions with the servomotor tilting angles. Thus, considering $ \dl = l \frac {\sqrt {2}} {2} $ and the right hand rule, resultant propulsion forces and torques on the $ \Fb $ are presented in Equation (\ref{eq1:gen_forces_torquesa}), suppressing the term $ (t) $:
\begin{figure*}[h!]
\begin{minipage}{.6\textwidth}
\begin{eqnarray} \label{eq1:gen_forces_torquesa}
\bm{\tau^b_p} &=&
\left(\begin{array}{cccccc}
X_{p}^{b} & Y_{p}^{b} & Z_{p}^{b} & L_{p}^{b} & M_{p}^{b} & N_{p}^{b}
\end{array}
\right)^T = \nonumber \\
&=&
\left(\begin{array}{c}
k_1\delta_1s(\gamma_1) + k_1\delta_2s(\gamma_2) + k_1\delta_3s(\gamma_3) + k_1\delta_4s(\gamma_4) \\
0 \\
-k_1\delta_1c(\gamma_1) - k_1\delta_2c(\gamma_2) - k_1\delta_3c(\gamma_3) - k_1\delta_4c(\gamma_4) \\
(-k_1\dl c(\gamma_1) - k_2s(\gamma_1))\delta_1 + (k_1\dl c(\gamma_2) - k_2s(\gamma_2))\delta_2 + (k_1\dl c(\gamma_3) + k_2s(\gamma_3))\delta_3 + (-k_1\dl c(\gamma_4) + k_2s(\gamma_4))\delta_4 \\
A_2 \\
A_3
\end{array}
\right) \nonumber \\
\end{eqnarray}
\end{minipage}
\end{figure*}
It always helps to have a complete minimal example.
It might be worth trying [b] instead. Perhaps also try inserting \newpage after the figure.

\right) doesn't work on LaTeX multiline equation

I'm writing an equation on LaTeX and when I want to close the formula with \right) it doesn't work. I'll post my code here to see if anyone can help me:
\begin{equation*}
\begin{split}
&\bigtriangledown h=\left( \frac{1}{2}\cdot \cos \left(\frac{1}{2}\cdot x\right) \cdot \cos(y) + \cos(x) \cdot \cos(y),
\frac{-1}{2} \cdot \cos\left(\cos \left(\frac{1}{2}\cdot y\right)\right)\cdot \\ &\sin\left(\frac{1}{2} \cdot y\right) - \sin\left(\frac{1}{2}\cdot x\right) \cdot \sin(y) - \sin(x) \cdot \sin(y) \right)
\end{split}
\end{equation*}
This is happening because the paired \left( and \right) cannot be broken over different lines in multi-line environments. So one cannot start \left( on one line of a multi-line equation and pair it with \right) on another line.
You can trick it, though, by giving it a fake matching paren: \left( \right. The period . matches any kind of bracket. Now it will accept this on its own, and simply produce a left parenthesis. You have to remember to do the same with the right paren, and you have to adjust sizes yourself since the automatic resizing won't work. I find that for your example you may want \Bigg( \Bigg. paired with \Bigg. \Bigg)
\begin{equation*}
\begin{split}
& \bigtriangledown h=
\Bigg( \Bigg.
\frac{1}{2}\cdot \cos \left(\frac{1}{2}\cdot x\right) \cdot \cos(y)
+ \cos(x) \cdot \cos(y),
\frac{-1}{2} \cdot \cos\left(\cos \left(\frac{1}{2}\cdot y\right)\right)\cdot \\
& \sin\left(\frac{1}{2} \cdot y\right)
- \sin\left(\frac{1}{2}\cdot x\right) \cdot \sin(y)
- \sin(x) \cdot \sin(y)
\Bigg. \Bigg)
\end{split}
\end{equation*}
This now works, but I'd move the alignment point to after = so the next line is indented (or, rather, after the opening parenthesis). However, I'd first suggest to look into yet other options availed by amsmath package.
Since you do not want numbering any way, and may want to align precisely, one option that gives more control is the align environment. With your equations, rearranged a little
\usepackage{amsmath}
\begin{align*}
\bigtriangledown h = \Bigg( \Bigg. &
\frac{1}{2}\cdot \cos \left(\frac{1}{2}\cdot x\right) \cdot \cos(y)
+ \cos(x) \cdot \cos(y), \\
& -\frac{1}{2} \cdot \cos\left(\cos \left(\frac{1}{2}\cdot y\right)\right)\cdot
\sin\left(\frac{1}{2} \cdot y\right) \\
& - \sin\left(\frac{1}{2}\cdot x\right) \cdot \sin(y)
- \sin(x) \cdot \sin(y) \Bigg. \Bigg)
\end{align*}
There is a number of other environments for multi-line equations, to suit different cases. Here is a clear page on Aligning Equations and here is the official amsmath User's Guide (pdf).
This is the image of both examples above, first the one using align, wrapped together with
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\begin{document}
% ... example using align environment, a line of text, example with split
\end{document}
I kept the second example as in the OP but consider aligning after the = sign, as mentioned.

Resources