General ⇒ Allignment for equations
Allignment for equations
- Attachments
-
- image002.jpg (40.52 KiB) Viewed 9824 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- pumpkinegan
- Posts: 91
- Joined: Thu May 03, 2007 10:29 pm
Allignment for equations
Code: Select all
\begin{equation}\left \{\begin{aligned}u_t + b \cdot D u + c u &= 0 \quad \text{in $\mathbf{R}^n \times (0,\infty)$} \\u &= g \quad \text{on $\mathbf{R}^n \times (t = 0)$}.\end{aligned}\right.\label{eqn:example}\end{equation}
Patrick.
Allignment for equations
Code: Select all
\begin{equation*}\left \{\begin{aligned}u_t + b \cdot D u + c u &= 0 \quad \text{in $\mathbb{R}^n \times (0,\infty)$} \\u &= g \quad \text{on $\mathbb{R}^n \times \{t = 0\}$}.\end{aligned}\right.\end{equation*}
However, you might like to consider the cases environment instead of surrounding an aligned with a curly brace. cases is also in amsmath.
Code: Select all
\begin{equation*}\begin{cases}u_t + b \cdot D u + c u &= 0 \quad \text{in $\mathbb{R}^n \times (0,\infty)$} \\u &= g \quad \text{on $\mathbb{R}^n \times \{t = 0\}$}.\end{cases}\end{equation*}
Code: Select all
\begin{equation*}f(x) \triangleq\begin{cases}0 &\text{if $x < 0$}, \\x &\text{if $x \in [0,1]$}, \\1 &\text{if $x > 1$}.\end{cases}\end{equation*}
- pumpkinegan
- Posts: 91
- Joined: Thu May 03, 2007 10:29 pm
Allignment for equations
Code: Select all
\usepackage{amsmath,amsfonts}
Re: Allignment for equations
I tried substituting "\quad" with "&&" in the Patrick's example and obtained what desired. I wonder is it possible to make this "double alignment" in other environments like \cases etc.? It is also desirable that braces be input automatically as in \cases.
Allignment for equations
volodja wrote: Thank you very much. But I want the equations to be aligned not only in the "=" sign but also with respect to "in" and "on". If you write a longer expression instead of "g" in the second equation, you'll see that there's no alignment with respect to "in" and "on".
Code: Select all
\begin{equation*}\left \{\begin{aligned}u_t + b \cdot D u + c u &= 0 &\text{in} \quad& \mathbb{R}^n \times (0,\infty) \\u &= g & \text{on}\quad& \mathbb{R}^n \times \{t = 0\}.\end{aligned}\right.\end{equation*}
Allignment for equations
Approach 1 (of yours).
Code: Select all
\begin{equation*}\left \{\begin{aligned}u_t + b \cdot D u + c u &= 0 & \text{ inside } & \Omega \\u &= g_1 + g_2 + g_3 & \text{ on } & \partial\Omega.\end{aligned}\right.\end{equation*}
Code: Select all
\begin{equation*}\left \{\begin{aligned}u_t + b \cdot D u + c u &= 0 && \text{ inside } \Omega \\u &= g_1 + g_2 + g_3 && \text{ on } \partial\Omega.\end{aligned}\right.\end{equation*}
- Attachments
-
- image002.jpg (25.03 KiB) Viewed 9667 times
- countbela666
- Posts: 64
- Joined: Thu Apr 26, 2007 2:44 pm
Allignment for equations
you could very easily define your own cases environment based on the aligned environment to do the job:
Code: Select all
\documentclass{scrartcl}\newenvironment{mycases}{\left\{\begin{aligned}}{\end{aligned}\right.}\usepackage{amsmath}\begin{document}\begin{equation*}\begin{mycases}u_t + b \cdot D u + c u &= 0 && \text{ inside } \Omega \\u &= g_1 + g_2 + g_3 && \text{ on } \partial\Omega.\end{mycases}\end{equation*}\end{document}
Marcel
a thousand worlds for you to see here, take my hand and follow me...