How do I change mode in cases LaTeX - latex

When I write a \prod in a cases, the \prod is like if it was in inline mode.
\mathbb{P} : \left\{ \forall n \in \mathbb{N} \Big| \nexists d \in \mathbb{N} \setminus \{1; n\} : d|n \right\}\\
\mathbb{P}_n \subset \mathbb{P} \times \mathbb{N}^* :
\begin{cases}
\left( \prod_{(k, m) \in \mathbb{P}_n} k^m \right ) = n\\
\forall (k; m) \in \mathbb{P}_n, \nexists (k'; m') \in \mathbb{P}_n \setminus \{(k, m)\}:k=k'
\end{cases}\\

Turns out it is in the amsmath manual after all (page 9):
cases is set in \textstyle. If \displaystyle is wanted, it must be requested explicitly; mathtools provides a dcases environment for this purpose.
See the mathtools manual:
Using the dcases environment you get the same output as with cases except that the rows are set in display style.
So this should work (untested though):
\usepackage{mathtools}
...
\begin{dcases}
\left( \prod_{(k, m) \in \mathbb{P}_n} k^m \right ) = n\\
\forall (k; m) \in \mathbb{P}_n, \nexists (k'; m') \in \mathbb{P}_n \setminus \{(k, m)\}:k=k'
\end{dcases}

Related

Writing a PDE spread over multiple lines with elements description in LaTeX [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 days ago.
Improve this question
for my master thesis I have to include a long PDE which has to be distributed over multiple lines for space and understanding purposes. Each term has its own description.
The final goal is to reproduce the equation in the pictureturbulent energy equation.
My LaTeX code (overleaf) is the following:
\begin{multline}
%right-end side
%first term
\left.\rho c\left(\frac{\partial\overline{T}}{\partial t}+\overline{u}\frac{\partial\overline{T}}{\partial x}+\overline{v}\frac{\partial\overline{T}}{\partial y}+\overline{w}\frac{\partial\overline{T}}{\partial z}\right) \right\} \quad \text{advection}\\
%left-end side
%first term
=\left.\lambda\left(\frac{\partial^2\overline{T}}{\partial x^2}+\frac{\partial^2\overline{T}}{\partial x^2}+\frac{\partial^2\overline{T}}{\partial x^2}\right) \right\} \quad \text{diffusion}\\
%second term
\left.-\rho c\left(\frac{\partial\overline{u^\prime T^\prime}}{\partial x}+\frac{\partial\overline{v^\prime T^\prime}}{\partial y}+\frac{\partial\overline{w^\prime T^\prime}}{\partial z}\right) \right\} \quad \text{turbulent heat transport} \\
%third term
+\left.\mu\left(2\left(\frac{\partial\overline{u}}{\partial x}\right)^2+2\left(\frac{\partial\overline{v}}{\partial y}\right)^2+2\left(\frac{\partial\overline{w}}{\partial z}\right)^2 \\
+\left(\frac{\partial\overline{v}}{\partial z}+\frac{\partial\overline{w}}{\partial y}\right)^2\right) \\ \right\} \quad \text{direct dissipation}
%fourth term
+\left.\mu\left[2\bar{\left(\frac{\partial u\prime}{\partial x}\right)^2}+2\bar{\left(\frac{\partial v\prime}{\partial y}\right)^2}+2\bar{\left(\frac{\partial w}{\partial z}\right)^2} \\
+\bar{\left(\frac{\partial u\prime}{\partial y}+\frac{\partial v\prime}{\partial x}\right)^2}+\bar{\left(\frac{\partial u\prime}{\partial z}+\frac{\partial w\prime}{\partial x}\right)^2}\\
+\bar{\left(\frac{\partial v\prime}{\partial z}+\frac{\partial w\prime}{\partial y}\right)^2}\right] \right\} \quad \text{turbulent dissipation}
\end{multline}
Differently from the example in the figure, I also have to develop the last term.
The code that I've written still miss the alignment of the names of the different terms and if a single term of the PDE is distributed over multiple lines, then the curly brackets are not represented.
Can anyone please help me? Thanks.
Please, always provide the full code. It is particularly difficult to track issues in LaTeX code without having all the details.
I changed environment to align* and added a few inner aligned environments. The former splits lines into both equation and annotation parts.
All the right braces are a little tricky but you can always scale \left.\right. manually using an arbitrary vertical bar. If you change equations you might need to reapply the size. \left(...\right) macros are not recommended as they introduce many issues including inconsistent spacing and scaling. The \mleftright package corrects some of them but it is still better to use \Bigl[ or \Biggr\} etc.
The code
\documentclass{article}
\usepackage{mathtools}
\newlength\lefteqskip
\begin{document}
\lefteqskip3.5em
\begin{align*}
%right-end side
%first term
\mathrlap{\rho c
\left(
\frac{\partial\overline{T}}{\partial t}
+\overline{u}\frac{\partial\overline{T}}{\partial x}
+\overline{v}\frac{\partial\overline{T}}{\partial y}
+\overline{w}\frac{\partial\overline{T}}{\partial z}
\right)}
\phantom{={}}
%\hspace{0.5\lefteqskip} % indents LHS
&&&\biggr\} \quad \text{advection} \\
%left-end side
%first term
={}&{}\lambda
\left(
\frac{\partial^2\overline{T}}{\partial x^2}
+\frac{\partial^2\overline{T}}{\partial x^2}
+\frac{\partial^2\overline{T}}{\partial x^2}
\right)
&&\biggr\} \quad \text{diffusion}\\
%second term
&{}-\rho c
\left(
\frac{\partial\overline{u^\prime T^\prime}}{\partial x}
+\frac{\partial\overline{v^\prime T^\prime}}{\partial y}
+\frac{\partial\overline{w^\prime T^\prime}}{\partial z}
\right)
&&\biggr\} \quad \text{turbulent heat transport} \\
%third term
&{}
\begin{aligned}
&{}+\mu\left(
2\left(
\frac{\partial\overline{u}}{\partial x}
\right)^2
+ 2\left(
\frac{\partial\overline{v}}{\partial y}
\right)^2\right. \\
&\left.\hspace{\lefteqskip}
{}+ 2\left(
\frac{\partial\overline{w}}{\partial z}
\right)^2
+ \left(
\frac{\partial\overline{v}}{\partial z}
+\frac{\partial\overline{w}}{\partial y}
\right)^2
\right)
\end{aligned}
&&\hspace{-3pt}
\left.\rule[-7.5ex]{0pt}{15ex}\right\}
\quad
\text{direct dissipation} \\
% % %fourth term
&\begin{aligned}
&{}+\mu\left[
2\bar{\left(
\frac{\partial u\prime}{\partial x}
\right)^2}
+2\bar{\left(
\frac{\partial v\prime}{\partial y}
\right)^2}
\right. \\
&\hspace{\lefteqskip}
+ 2\bar{\left(
\frac{\partial w}{\partial z}
\right)^2}
+ \bar{\left(
\frac{\partial u\prime}{\partial y}
+\frac{\partial v\prime}{\partial x}
\right)^2} \\
&\left.\hspace{\lefteqskip}
+\bar{\left(
\frac{\partial u\prime}{\partial z}
+\frac{\partial w\prime}{\partial x}
\right)^2}
+\bar{\left(
\frac{\partial v\prime}{\partial z}
+\frac{\partial w\prime}{\partial y}
\right)^2}
\right]
\end{aligned}
&&\hspace{-3pt}
\left.\rule[-11ex]{0pt}{22ex}\right\}
\quad
\text{turbulent dissipation}
\end{align*}
\end{document}

Is there a way to fix the alignment of the ordered list in RMarkdown?

The placement of my ordered list appears in the middle instead of at the top. Is there any way to make it so the a) is aligned at the first line of the equation?
This is my code:
a)
$\begin{aligned}
\hat{y} &= (\overline{x_1} - \overline{x_2})'S^{-1}_{pooled}x \\
&= \left(\begin{bmatrix}3\\6\end{bmatrix}-\begin{bmatrix}5\\8\end{bmatrix}\right)'\begin{bmatrix}1&1\\1&2\end{bmatrix}^{-1}\begin{bmatrix}x_1\\x_2\end{bmatrix} \\
&= \begin{bmatrix}-2&0\end{bmatrix} \begin{bmatrix}x_1\\x_2\end{bmatrix} \\
&= -2x_1
\end{aligned}$
You can add another set of $ signs; one at the beginning and the other at the end.
a)
$$\begin{aligned}
\hat{y} &= (\overline{x_1} - \overline{x_2})'S^{-1}_{pooled}x \\
&= \left(\begin{bmatrix}3\\6\end{bmatrix}-\begin{bmatrix}5\\8\end{bmatrix}\right)'\begin{bmatrix}1&1\\1&2\end{bmatrix}^{-1}\begin{bmatrix}x_1\\x_2\end{bmatrix} \\
&= \begin{bmatrix}-2&0\end{bmatrix} \begin{bmatrix}x_1\\x_2\end{bmatrix} \\
&= -2x_1
\end{aligned}$$
Quoting the accepted answer here, the difference between the 2 is:
$$ will produce a block element (a paragraph) while $ will produce an inline element. Thus, $$ is often used for equations.

How do I write $ad-bc=1$ below $a,b,c,d \in \mathbb{Z}$?

\Gamma=\Big\lbrace
\begin{pmatrix}
a&b\\c&d
\end{pmatrix}: a,b,c,d \in \Z , ad-bc=1
\Big\rbrace
I know that "substack" does it but then the formulas are too small.
You could use \underset{<a>}{<b>} to obtain <a> below <b>.
\Gamma=\Big\lbrace
\begin{pmatrix}
a&b\\c&d
\end{pmatrix}:
\underset{ad-bc=1}{a,b,c,d \in \mathbb{Z}}
\Big\rbrace

Latex displaying this error missing $ inserted [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 8 years ago.
Improve this question
begin{table}[h]
\centering
\begin{tabular}{c p{5cm} c}\hline
Attribut & Description & Equation \\ \hline
$E$ & The set of objects that can't be distinguished from each other based on the available attributes & Let $P \subseteq A$ ,
E(P) = \{\ (x, y) \in U^2 : \foralla P, a(x) = a(y) \}\ \\
$ \beta $& Admissible error rate\\
$K$ & Grade level
\end{tabular}
\end{table}
as I'm new to latex, when i use previous code i get this error "missing $ inserted" in the line E(P) = {\ (x, y) \in U^2 : \foralla P, a(x) = a(y) }\ \
can anyone help me with this error.
Well, you are missing an $ :) The equation E(P) ... must be typeset in math mode:
\documentclass{standalone}
\usepackage{amsmath}
\begin{document}
\begin{tabular}{c p{5cm} c}\hline
Attribut & Description & Equation \\ \hline
$E$ & The set of objects that can't be distinguished from each other based on the available attributes & Let $P \subseteq A$ ,
$E(P) = \{\ (x, y) \in U^2 : \forall P, a(x) = a(y) \}$ \\
$ \beta $& Admissible error rate\\
$K$ & Grade level
\end{tabular}
\end{document}
Also, please make sure you include a complete and compilable document with the minimum of packages and definitions necessary to reproduce the problem.

Finding FIRST sets in a grammar

Today I am reading how to find First and Follow of a grammar. I saw this grammar:
S → ACB | CbB | Ba
A → da | BC
B → g | ε
C → h | ε
The claim is that
FIRST(S) = FIRST(ABC) U FIRST(CbB) U FIRST(Ba)
= {d, g, h, ε} U {h, b} U {g, a}
= {d, g, h, ε, b, a}
I don't understand how a and b are in this set. Can anyone explain this?
Notice that B and C both are nullable (they can produce ε). This means that from the production
S → CbB
we get that b &in; FIRST(S), since if we use the production C → ε we can get a production that starts with b.
Similarly, note that
S → Ba
is a production, so we get a &in; FIRST(S) because we can use the production B → ε to get an a at the front of a string derivable from S.
Hope this helps!

Resources