2

I would like to produce a picture like this

enter image description here

However, I would like the commas to be aligned.

Usually I would use alignat for this, but I don't know how to put braces across lines and n=1 is precisely between lines.

Here is a MWE using itemize and cases, but I don't think this will be the right approach

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{itemize}

\item[$n=1$]
$\begin{cases}
(a, b) \\
(cde, f)
\end{cases}$

\item[$n=2$]
$(g, h)$

\item[$n=3$]
$\begin{cases}
(ij, k) \\
(lmno, pq) \\
(rs, tuv)
\end{cases}$

\end{itemize}

\end{document}
  • Do you want all commas from every line to be aligned or just those of one case? – Skillmon Mar 15 '17 at 9:44
  • @Skillmon The commas from all lines. (Otherwise, I think I could just use array for each set.) – Earthliŋ Mar 15 '17 at 10:16
2

You can do it with blkarray, and, if you want it to look like an enumeration, with the fleqn environment from nccmath:

\documentclass{article}
\usepackage{blkarray, bigstrut, booktabs, nccmath}
\usepackage[showframe]{geometry}

\begin{document}

\vspace*{1cm}
\begin{fleqn}
    \[ \begin{blockarray}{l>{(}r@{,{}}l<{)}}
\begin{block}{l\{>{(}r@{,{}}l<{)}}
\BAmultirow{30pt}{$ n = 1 $} & a & b \\
 & cde & f \\
\end{block}
\addlinespace[2ex]
 n =2 & g & h \\
\addlinespace[2ex]
\begin{block}{l\{>{(}r@{,{}}l<{)}}
\BAmultirow{30pt}{$ n = 3 $} & i j & k \\
 & lmno & pq \bigstrut[t]\\
  & rs & tuv \bigstrut[b]\\
\end{block}
    \end{blockarray} \]
\end{fleqn}

\end{document} 

enter image description here

1

You can push the content over to the right one-by-one using a positional marker. This is provided using zref's savepos module. It provides \zsaveposx{<label>} to store the x-coordinate at the time of placement and \zposx{<label>} to retrieve that x-coordinate (in scaled points) which can be used in calculations:

Below I defined \setshifttarget{<label>} to define the marker according to which all other \shiftright{<stuff>} will be aligned (horizontally). You just need to place this <label> at the appropriate spot (in your case, I used lmno).

enter image description here

\documentclass{article}

\usepackage{amsmath,zref-savepos}

\newcounter{str}
\newcommand{\shiftright}[1]{%
  \stepcounter{str}%
  \zsaveposx{str-\thestr}%
  \hspace{\dimexpr\zposx{\stshfttrgt}sp-\zposx{str-\thestr}sp}%
  \makebox[0pt][r]{$#1$}%
}
\newcommand{\setshifttarget}[1]{\def\stshfttrgt{#1}}

\begin{document}

\setshifttarget{lmno}
\begin{itemize}
  \item[$n=1$]
    $\begin{cases}
    \shiftright{(a}, b) \\
    \shiftright{(cde}, f)
    \end{cases}$

  \item[$n=2$]
    $\shiftright{(g}, h)$

  \item[$n=3$]
    $\begin{cases}
    \shiftright{(ij}, k) \\
    (lmno\zsaveposx{lmno}, pq) \\
    \shiftright{(rs}, tuv)
    \end{cases}$

\end{itemize}

\end{document}

Since zref uses the \label-\ref system, you'll have to compile twice with any document changes for the marker positions to settle and have the desired effect.

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.