# Why does a left curly brace impact the flalign alignment?

I've a pretty long text commenting several sets of short equations. This leads me to some presentation constraints that I'd like to better handle:

• flush the equation sets to the left (short text in the center of the page is ugly),
• align the equation sets on the '=' sign between sets. This forces me to build on align, alignat or flalign because I can't interrupt an array with (short)intertext (AFAIK),
• I need to begin the equation sets with a left curly brace. I use 'dcases' but never achieved to have it functioning in 'alignat' (AFAIK)

In my MWE, the third example gives the result I expected. However, when I add a left curly brace, LaTeX adds a strange space before the '=' sign. Any idea about where this is coming from?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{luainputenc}    % WARNING: Source UTF8-encoded

\usepackage{amsmath}%,amssymb}
%\usepackage{eqparbox,xintexpr}
\usepackage{mathtools} % dcases

\begin{document}

{\bf'align' means centered on '='}
\begin{align*}
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) \\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2)
\end{align*}
{\bf'flalign' means flushed to left and aligned on '='}
\begin{flalign*}
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) &\\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2) &% Need tailing alignment char to get all the way left
\end{flalign*}
{\bf'flalign' with a compliant indentation}
\begin{flalign*}
\hspace{\parindent}\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) &\\
\hspace{\parindent}\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2) &% Need tailing alignment char to get all the way left
\end{flalign*}
{\bf'In 'flalign', curly brackets have an indentation impact on '='?}
\begin{flalign*}%
\hspace{\parindent}&\begin{dcases}
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2&=\cos(\theta_1 +\theta_2)\\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2&=\sin(\theta_1+\theta_2)
\end{dcases}&
\end{flalign*}

\end{document}


• Off-topic: \bf is depreciated. Use \mathbf instead. – Sebastiano Oct 10 '20 at 12:01
• the fl in flalign is "full length" not "flush left" align, equation etc will all set flush left not centred if you use the fleqn option to \documentclass or amsmath. – David Carlisle Oct 10 '20 at 12:03
• @DavidCarlisle I thought into the formula....excuse me....very much. :-( – Sebastiano Oct 10 '20 at 12:05
• You are using luainputenc (which you should probably not use) but if you are using luatex you should not use \usepackage[T1]{fontenc} either as that forces legacy 8bit fonts. In my answer I kept the T1 encoding (and used pdflatex) – David Carlisle Oct 10 '20 at 12:16
• You should consider to use the environment cases. – projetmbc Oct 10 '20 at 12:57

You can use fleqn option to get flush left alignment. dcases adds a quad space by design, but the package provides \newcases to define a similar command without that:

\documentclass[fleqn]{article}% flush left equations
\usepackage[T1]{fontenc}
% it is best to avoid this unless you really need it \usepackage[utf8]{luainputenc}    % WARNING: Source UTF8-encoded

\usepackage{amsmath}%,amssymb}
%\usepackage{eqparbox,xintexpr}
\usepackage{mathtools} % dcases

\makeatletter
% a copy of dcases but without \quad in the second argument
% and with {} at the start of the second column so &= gets relation space like align
$\m@th\displaystyle{##}$\hfil}{$\m@th\displaystyle{{}##}$\hfil}{\lbrace}{.}
\makeatother

\begin{document}

Left aligned alignment
\begin{align*}
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) \\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2)
\end{align*}

dcases
$\begin{dcasesnoquad} \cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2&=\cos(\theta_1 +\theta_2)\\ \sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2&=\sin(\theta_1+\theta_2) \end{dcasesnoquad}$

\end{document}


Two other solutions: one with empheq and flalign*, and another with the fleqn  environment from nccmath & dcases:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[showframe]{geometry}
\usepackage{nccmath}
\usepackage{empheq} %

\begin{document}
\vspace*{1cm}

\begin{empheq}[left=\hspace{\parindent}\empheqlbrace]{flalign*}%
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2&=\cos(\theta_1 +\theta_2) & & \\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2&=\sin(\theta_1+\theta_2)
\end{empheq}

\begin{fleqn}[\parindent]
$\begin{dcases} \cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2=\cos(\theta_1 +\theta_2) \\ \sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2=\sin(\theta_1+\theta_2) \end{dcases}$
\end{fleqn}

\end{document}


• yes although alignment on = in the last one is just because coscossinsin is the same width as sincoscossin – David Carlisle Oct 10 '20 at 13:57
• @DavidCarlisle: You're right, but if it happened not to be spontaneously aligned, it is always possible to use an aligned or even alignedat environment – albeit in this case, the solution with empheq would be recommended. – Bernard Oct 10 '20 at 14:03
• yes I know (and I know you know:-) just left a comment in case a later reader cuts and pastes but changes the expression. – David Carlisle Oct 10 '20 at 14:05
• That's the way I understood it. – Bernard Oct 10 '20 at 14:06

You not need use the dcases for left curly braces. Similar result you can obtain with use of ˙\left{˙ before aligned or by use empheq:

\documentclass[fleqn]{article}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                             % for dummy text
%---------------------------------------------------------------%

\usepackage[T1]{fontenc}
\usepackage{amsmath, empheq}

\begin{document}
\textbf{With 'align*'}
\begin{align*}
\cos\theta_1 \cos\theta_2 - \sin\theta_1 \sin\theta_2 &= \cos(\theta_1 + \theta_2) \\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1 + \theta_2)
\end{align*}

\textbf{With 'aligned'}
\left\{\begin{aligned} \cos\theta_1 \cos\theta_2 - \sin\theta_1 \sin\theta_2 & = \cos(\theta_1 + \theta_2)\\ \sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 & = \sin(\theta_1 + \theta_2) \end{aligned}\right.

\textbf{With 'empheq'}
\begin{empheq}[left=\empheqlbrace]{align*}
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2      & = \cos(\theta_1 + \theta_2)\\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2   & = \sin(\theta_1 + \theta_2)
\end{empheq}
\end{document}


(red lines show test border)

Edit: In the first attempt I miss understood, where the equations should be. Now this is corrected (and by this my answer become more similar to other answers ...)

• I think you dropped a fleqn somewhere, your image shows left alignment but the code makes centred – David Carlisle Oct 10 '20 at 14:01
• @DavidCarlisle, you are right. I only add new image and forgot to update code in answer. Thank you for pointing me on this my superficiality. – Zarko Oct 10 '20 at 14:12