Page Layout ⇒ Using align and \left \right commands at same time.
-
- Posts: 2
- Joined: Thu Sep 08, 2011 4:29 pm
Using align and \left \right commands at same time.
Hello,
The following code will not execute in latex:
\begin{align*}
\left[a + b &= c + d\right] \\
\left[e + f &= g + h\right]
\end{align*}
The problem has to do with the "\left" and "\right" commands for the brackets. If I remove the "&" in front of both equal signs the code compiles, but the equations are not aligned properly. Is there a way to align the equations and use the "\left" and "\right" commands simultaneously?
Thanks for the help!
The following code will not execute in latex:
\begin{align*}
\left[a + b &= c + d\right] \\
\left[e + f &= g + h\right]
\end{align*}
The problem has to do with the "\left" and "\right" commands for the brackets. If I remove the "&" in front of both equal signs the code compiles, but the equations are not aligned properly. Is there a way to align the equations and use the "\left" and "\right" commands simultaneously?
Thanks for the help!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and many kinds of documents
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Using align and \left \right commands at same time.
Every side of the equations represents a group. So scalable delimiters of this kind don't work across those boundaries. You have to insert some intermediate invisible delimiters.
The same applies in a similar way to delimiters across several lines.
Best regards and welcome to the board
Thorsten
Code: Select all
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools} % loads »amsmath«
\begin{document}
\begin{align*}
\left[a + b\right. &=\left. c + d\right] \\
\left[e + f\right. &=\left. g + h\right]
\end{align*}
\end{document}
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 2
- Joined: Thu Sep 08, 2011 4:29 pm
Re: Using align and \left \right commands at same time.
Hello,
The code posted works well, except for one minor problem. If the right side of the equation (d in this case) is taller than the left side (a in this case), then the right bracket is larger than the left. Is there a way to match the heights of both brackets?
Thank you.
The code posted works well, except for one minor problem. If the right side of the equation (d in this case) is taller than the left side (a in this case), then the right bracket is larger than the left. Is there a way to match the heights of both brackets?
Thank you.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Using align and \left \right commands at same time.
I see two possible approaches.
For more stuff about math typesetting have a look at the excellent »Math mode« document.
- Insert a vertical phantom on the left side to get the automatic scaling right.
- Adjust the delimiters manually and you only need one real pair of them.
Code: Select all
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools} % loads »amsmath«
\begin{document}
\begin{align*}
\left[a + b\vphantom{\frac{0}{0}}\right. &=\left. c + \frac{x-d}{x+d}\right] \\
\bigg[e + f &= g + \frac{x-h}{x+h}\bigg]
\end{align*}
\end{document}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10