grouping and logical implication in math mode - latex

How could I typeset a formula like this:
It should respect typographic rules, but it must look very similar.

You could use the aligned environment (requires the amsmath package), e.g.
\left. \begin{aligned}
A &= T \\
B &= F
\end{aligned} \right\} \implies A \vee B = T \vee F = T

(Assuming you meant to use logical disjunction and logical implication)
\[
\left.\begin{array}{l}
A = T \\ B = F
\end{array}\right\}
\implies A \lor B = T \lor F = T
\]

This code should do what you want:
\[
\left.
\begin{array}{c}
A = T\\
B = F
\end{array}
\right\}
\Rightarrow A \vee B = T \vee F = T
\]

Related

align ! missing } inserted

I am trying to typeset the following equation in the align-evoirement
\begin{align}
t_2' &= t_2 + \frac{L/C} \\
t_1' &= t_1 + \frac{L + v\Delta t\cos\theta}{c} \\
t_2' - t_1' &= (t_2-t_1) + \frac{L-L-v\Delta t\cos\theta}{C} \\
\Delta t' &= \Delta t - \frac{v\Delta t \cos \theta}{c} \\
\Delta t' &= \Delta t \left(1-\frac{v\cos\theta}{c}\right) \\
\frac{1}{\nu} &= \frac{1}{\nu_0 \sqrt{1-\frac{v^2}{c^2}}}~\left(1-\frac{v\cos \theta {c}\right) \\
\nu &= \nu_0\frac{ \sqrt{1-\dfrac{v^2}{c^2}}}{1-\dfrac{v\cos \theta }{c}}
\end{align}
But when I tried this I got the following message:
[45]
! Missing } inserted.
<inserted text>
}
l.938 \end{align}
?
I copied the equations in Matcha (without the &), where it was perfectly working... I tried some things, but those did not seem to work...
Does anybody know what I did wrong?
At two occasions you write \frac{..} without the mandatary second argument. You must write \frac{...}{...} instead.
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align}
t_2' &= t_2 + \frac{L}{C} \\
t_1' &= t_1 + \frac{L + v\Delta t\cos\theta}{c} \\
t_2' - t_1' &= (t_2-t_1) + \frac{L-L-v\Delta t\cos\theta}{C} \\
\Delta t' &= \Delta t - \frac{v\Delta t \cos \theta}{c} \\
\Delta t' &= \Delta t \left(1-\frac{v\cos\theta}{c}\right) \\
\frac{1}{\nu} &= \frac{1}{\nu_0 \sqrt{1-\frac{v^2}{c^2}}}~\left(1-\frac{v\cos \theta}{c}\right) \\
\nu &= \nu_0\frac{ \sqrt{1-\dfrac{v^2}{c^2}}}{1-\dfrac{v\cos \theta }{c}}
\end{align}
\end{document}

How can I align equations belong to different { part? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I am a beginner in latex. I have the following piece of latex code. The code is working fine but I wish all the equality operators and the "if kflag=n" of each equation be aligned and written in one equation box with one equation counting number. How can it be done?
\begin{equation} %kflag=0
\left \{
\begin{array}{rl}
T =& (1-D)\sigma_{max,0}\times e^{1-\frac{\Delta_n}{\delta_n}}\times \frac{\Delta_n}{\delta_n}\\
K =& \frac{(1-D)\sigma_{max,0}}{\delta_n}\times e^{1-\frac{\Delta_n}{\delta_n}}\times (1-\frac{\Delta_n}{\delta_n})\\
\end{array}
\right.
\quad \text{if} \quad kflag=0
\end{equation}
\begin{equation} %kflag=1
\left \{
\begin{array}{rl}
T =& \alpha\sigma_{max,0}\times e^{1-\frac{\Delta_n}{\delta_n}}\times \frac{\Delta_n}{\delta_n}\\
K =& \frac{\alpha\sigma_{max,0}}{\delta_n}\times e^{1-\frac{\Delta_n}{\delta_n}}\times (1-\frac{\Delta_n}{\delta_n})\\
\end{array}
\right.
\quad \text{if} \quad kflag=1
\end{equation}
\begin{equation} %kflag=2
\left \{
\begin{array}{rl}
T =& (1-D)\sigma_{max,0}\times e^{1-\frac{\Delta_n}{\delta_n}}\times \frac{\Delta_n}{\delta_n}+T_{max}-\\
&(1-D)\sigma_{max,0}\times e\times\frac{\Delta_{max}}{\delta_n}+\\
&10\times \sigma_{max,0}\times e^{1-\frac{\Delta_n}{\delta_n}}\times \frac{\Delta_n}{\delta_n}\\
K =& 11\times\frac{(1-D)\sigma_{max,0}}{\delta_n}\times e^{1-\frac{\Delta_n}{\delta_n}}\times (1-\frac{\Delta_n}{\delta_n})\\
\end{array}
\right.
\quad \text{if} \quad kflag=2
\end{equation}
\begin{equation} %kflag=3
\left \{
\begin{array}{rl}
T =& T_{max}+K\times(\Delta_n-\Delta_{max})\\
K =& \frac{(1-D)\sigma_{max,0}*e}{\delta_n}\\
\end{array}
\right.
\quad \text{if} \quad kflag=3
\end{equation}
Right now the equations look like this
Here's an option using a multitude of nested structures - equation for the numbering, aligned for the horizontal alignment of structures and dcases (or cases) for the left-braced content.
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\newcommand{\Ddn}{\frac{\Delta_n}{\delta_n}}
\newcommand{\smz}{\sigma_{\mathrm{max}, 0}}
\begin{equation}
\begin{aligned}
&\begin{dcases}
\phantom{K}\mathllap{T} = (1 - D) \smz \times e^{1 - \Ddn} \times \Ddn \\
K = \frac{(1 - D) \smz}{\delta_n} \times e^{1 - \Ddn} \times \bigl( 1 - \Ddn \bigr)
\end{dcases} & \text{if $k$-flag} = 0 \\ % k-flag = 0
&\begin{dcases}
\phantom{K}\mathllap{T} = \alpha \smz \times e^{1 - \Ddn} \times \Ddn \\
K = \frac{\alpha \smz}{\delta_n} \times e^{1 - \Ddn} \times \bigl( 1 - \Ddn \bigr)
\end{dcases} & \text{if $k$-flag} = 1 \\ % k-flag = 1
&\begin{dcases}
\phantom{K}\mathllap{T} = \begin{aligned}[t]
&(1 - D) \smz \times e^{1 - \Ddn} \times \Ddn + T_{\mathrm{max}} \\
&{} - (1 - D) \smz \times e \times \frac{\Delta_{\mathrm{max}}}{\delta_n} \\
&{} + 10 \times \smz \times e^{1 - \Ddn} \times \Ddn
\end{aligned} \\
K = 11 \times \frac{(1 - D) \smz}{\delta_n} \times e^{1 - \Ddn} \times \bigl( 1 - \Ddn \bigr)
\end{dcases} & \text{if $k$-flag} = 2 \\ % k-flag = 2
&\begin{dcases}
\phantom{K}\mathllap{T} = T_{\mathrm{max}} + K \times (\Delta_n - \Delta_{\mathrm{max}}) \\
K = \frac{(1 - D) \smz \times e}{\delta_n}
\end{dcases} & \text{if $k$-flag} = 3
\end{aligned}
\end{equation}
\end{document}

align latex equations

I am a beginner in latex.I have the following piece of latex code. The code is working fine but I want that all the equality operators of each equation should be aligned. How can it be done?
\begin{enumerate}
\item[Commutative] $a+b = b+a$
\item[Associative] $a+(b+c)=(a+b)+c$
\item[Distributive] $a(b+c)=ab+ac$
\end{enumerate}
I'm unsure if this is possible inside the enumerate environment. An easy alternative is to use a tabular environment instead. In the example below the left and right sides of the equation are contained in two separate columns, with an = appearing between them.
\documentclass[12pt]{article}
\begin{document}
\begin{tabular}{l r#{$=$}l}
Commutative & $a+b$ & $b+a$ \\
Associative & $a+(b+c)$ & $(a+b)+c$ \\
Distributive & $a(b+c)$ & $ab+ac$ \\
\end{tabular}
\end{document}
Using \eqmakebox[<tag>][<align>] (from eqparbox) you can have all elements under the same <tag> be placed in a box of maximum width, together with individual <align>ment as needed. Below I has \eqmakebox[LHS][r] to ensure all elements tagged LHS is right-aligned. The result is alignment around the =.
\documentclass{article}
\usepackage{eqparbox}
\begin{document}
\begin{enumerate}
\item[Commutative] $ a + b = b + a $
\item[Associative] $a + (b + c) = (a + b) + c$
\item[Distributive] $ a(b + c) = ab + ac $
\end{enumerate}
\begin{enumerate}
\item[Commutative] $ \eqmakebox[LHS][r]{$a + b$} = b + a $
\item[Associative] $\eqmakebox[LHS][r]{$a + (b + c)$} = (a + b) + c$
\item[Distributive] $ \eqmakebox[LHS][r]{$a(b + c)$} = ab + ac $
\end{enumerate}
\end{document}
Alternatively you can measure the widest element yourself:
\newlength{\widestelement}
\settowidth{\widestelement}{$a + (b + c)$}
and then use
\begin{enumerate}
\item[Commutative] $ \makebox[\widestelement][r]{$a + b$} = b + a $
\item[Associative] $\makebox[\widestelement][r]{$a + (b + c)$} = (a + b) + c$
\item[Distributive] $ \makebox[\widestelement][r]{$a(b + c)$} = ab + ac $
\end{enumerate}

How to remove equation numbering in R Markdown

I am new to R markdown. I have a simple question about how to remove the automated equation numbering in the output PDF. Use the following codes for example:
\begin{align}
\sum_{i = 1}^{n} | (f + g )(x_i) - (f + g)(x_{i-1}) | &= \sum_{i = 1}^{n} | \{ f(x_i) + g(x_i) \} - \{ f(x_{i - 1} + g(x_{i-1}) \} |
\\ &\leq \sum_{i = 1}^{n} | f(x_i) - f(x_{i - 1} | + \sum_{i = 1}^{n} | g(x_i) - g(x_{i - 1})|
\\ &\leq V(f, P) + V(g, P)
\end{align}
It will automatically label the three lines of equations with (1), (2), (3). How do I suppress the numbering?
Thanks for your time!
I was actually looking up how to add numbering... so perfect info swap! Try:
$$
\begin{aligned}
\sum_{i = 1}^{n} | (f + g )(x_i) - (f + g)(x_{i-1}) | &= \sum_{i = 1}^{n} | \{ f(x_i) + g(x_i) \} - \{ f(x_{i - 1} + g(x_{i-1}) \} |
\\ &\leq \sum_{i = 1}^{n} | f(x_i) - f(x_{i - 1} | + \sum_{i = 1}^{n} | g(x_i) - g(x_{i - 1})|
\\ &\leq V(f, P) + V(g, P)
\end{aligned}
$$
This is more of a LaTeX thing than an RMarkdown thing: from my understanding, the $$ $$ isn't numbered, and the aligned environment is intended for use within other environments in order to display a single equation.
So, within the $$ $$ environment, you can use the aligned environment to display an equation, but it won't be numbered.
I missed the response from Werner earlier, but using align* works too. I guess the difference is the nuance in the initial intention.
(Also btw, this means if you use aligned within align, you get a block equation with only one number.)

Simple problem with alignment in Latex table

I have a simple alignment question for Latex tables. At
the moment it looks as follows:
\begin{center}
\begin{tabular}{| c | l | l | }
\hline
\tt {a} & $a = b + c + d + e + f + g + $ \\
& $ e + f + g + h + i + j$ \\ \hline
\end{tabular}
\end{center}
The problem is, that the output looks as follows:
a = b + c + ...
e + f + ....
However, I would like to have it looks as
a = b + c + ...
e + f + ...
Anyone an idea how I could do that in a table?
Thanks,
Klaus
Please use the align environment for multiline equations.
You can add a \phantom{a = } to indicate the should-be-existing spaces.
& $\phantom{a = }e + f + g + h + i + j$ \\ \hline
As KennyTM pointed out, you shouldn't typeset multiline equations using tables like this. But if you must do it, you could do it like this:
\begin{center}
\begin{tabular}{| c | l #{} l | }
\hline
\tt {a} & $a =\;$ & $b + c + d + e + f + g + $ \\
& & $e + f + g + h + i + j$ \\ \hline
\end{tabular}
\end{center}
The usual way is to make an additional column for the a = part; right-aligning it, and removing spacing with the next column for aesthetics:
\begin{tabular}{ c r #{} l } % you have one superfluous l
\tt {a} & $a =$ & $b + c + d + e + f + g +$ \\
& & $e + f + g + h + i + j$ \\
\end{tabular}
Maybe you will need an explicit space after the = sign, so that it's properly spaced with the b.
Another solution would be to have a multiline equation in a single cell of the table, but that amounts to the same (you will need an array environment or something similar to wrap the left part).

Resources