0

I have an issue using split inside an empheq environment.

When combining both environments, the alignment of the empheq is broken.

Any clues ?

If this is a duplicate or an obvious/known incompatibility, my apologies in advance.

\documentclass[]{article}

\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{empheq}


\begin{document}

Equations that can fit
\begin{empheq}[left=\empheqlbrace]{align}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

Equations that can't
\begin{empheq}[left=\empheqlbrace]{align}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

So I split the first equation
\begin{empheq}[left=\empheqlbrace]{align}
& \begin{split}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\end{split}\\
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
a\end{empheq}

\end{document}

enter image description here

  • in the first two you have the (strange) setting with only a right hand side so all the terms are after a & but in the third equation there is no & before bbbbb so it comes to the left of the aaaa as the split is after a & – David Carlisle Aug 17 '18 at 20:51
  • You'll get the same with algin instead of empheq, it is caused by the missing & as @DavidCarlisle mentioned. And you'll have to remove the & prior to split. – Skillmon Aug 17 '18 at 20:53
  • That's precisely the difference between the split and the aligned syntax. – Bernard Aug 17 '18 at 21:35
  • @Bernard, now I just found tex.stackexchange.com/questions/187938/… and tex.stackexchange.com/questions/192069/…. I guess i will remove my post... – BambOo Aug 17 '18 at 21:47
  • @BambOo: I don't think it's necessary, as it's sometimes hard to question the (answered) question which match exactly yours. I'd rather add a link to these questions as a complement. – Bernard Aug 17 '18 at 21:50
1

It is also compatible with aligned, which can replace split. Note that empheq loads mathtools, which loads amsmath, so you only have to load the first of these packages.

\documentclass[]{article}

\usepackage{empheq}

\begin{document}

Equations that can fit
\begin{empheq}[left=\empheqlbrace]{align}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

Equations that can't
\begin{empheq}[left=\empheqlbrace]{align}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

It works with `aligned`:

\begin{empheq}[left=\empheqlbrace]{align}
& \begin{aligned}[b]
  & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
  & aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\end{aligned}\\
 & bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

\end{document} 

enter image description here

  • Yes, indeed it is working with aligned. +1 for the answer, however it doesn't really solve the issue between split and empheq. Thank you anyway – BambOo Aug 17 '18 at 21:24
  • I very rarely use split, so I didn't even try to understand what was happening there, as most of the time, aligned (or alignedat) can replace it – Bernard Aug 17 '18 at 21:32
1

Adding the missing & and removing the one prior to split does solve your issue:

\documentclass[]{article}

\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{empheq}


\begin{document}

Equations that can fit
\begin{empheq}[left=\empheqlbrace]{align}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

Equations that can't
\begin{empheq}[left=\empheqlbrace]{align}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\end{empheq}

So I split the first equation
\begin{empheq}[left=\empheqlbrace]{align}
 \begin{split}
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\
& aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
\end{split}\\
&bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
a\end{empheq}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.