\right) doesn't work on LaTeX multiline equation - latex

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.

Related

Long equation spread across the whole page in two column format

I use the strip environment for a long equation in a two-column page format, but the equation number appears at the edge of the first column and not after the equation ends.
\begin{strip}
\begin{equation}
f_{k+i,j} \left(
\bar{A}^{k+i+1}\hat{x}_{-1} +
\bar{A}^{i+1}\bar{B}_k \begin{bmatrix} \Tilde{y}_0 \\ \vdots \\ \Tilde{y}_{k-1} \end{bmatrix} +
\bar{B}_{i+1} \left(
\begin{bmatrix} {y}_k \\ CA\hat{x}_k \\ \vdots \\ CA^i\hat{x}_k \end{bmatrix}
+
\begin{bmatrix} M_s\delta_k \\ M_s\delta_{k+1} \\ \vdots \\ M_s\delta_{k+i} \end{bmatrix} \right) \right) \leq h_{k+i,j}
- \sqrt{f_{k+i,j}\Sigma_{\zeta_i}f_{k+i,j}^T}\Phi^{-1}\left(1 - \frac{\alpha}{s_{k+i}}\right)
- \max_{\eta \in \Gamma} f_{k+i,j}\bar{A}^{k+i+1}\eta
\end{equation}
\end{strip}

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 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.

Missing } inserted Latex

\begin{equation}
\tau _{2}(r_{0})=\left\{\begin{matrix}
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{0}^{-1}-a^{-1}}{-3} \\
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{c}^{-1}-a^{-1}}{-3}
\end{matrix}\right.
\end{equation}
Basically I am wrtting an equation in Latex which should be displayed in the form
But Latex reports error "Missing } inserted" on the third line. What is the problem? Thanks a lot!
The cases environment from the amsmath package exists for exactly this purpose:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\tau_{2}(r_{0}) =
\begin{cases}
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{0}^{-1}-a^{-1}}{-3} \\
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{c}^{-1}-a^{-1}}{-3}
\end{cases}
\end{equation}
\end{document}
This also makes it easy to add description, e.g.
\begin{equation}
\tau_{2}(r_{0}) =
\begin{cases}
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{0}^{-1}-a^{-1}}{-3} & \text{if } c = 0\\
\frac{R^{d}-r_{c}^{d}}{D_{1}}\frac{r_{c}^{-1}-a^{-1}}{-3} & \text{otherwise} \\
\end{cases}
\end{equation}
I made some changes to the equation and this works. Not sure if it is what you were trying to achieve
\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\begin{document}
\title{Introduction to \LaTeX{}}
\author{Author's Name}
\maketitle
\[
\tau _{2}(r_{0})= \left[
\begin{array}{ccc}
\dfrac{R^{d}-r_{c}^{d}}{D_{1}} & \dfrac{r_{0}^{-1}-a^{-1}}{-3}\\
\dfrac{R^{d}-r_{c}^{d}}{D_{1}} & \dfrac{r_{c}^{-1}-a^{-1}}{-3}
\end{array}
\right]
\]
\end{document}

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

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}

Resources