5

I have a statement like

\begin{equations*}
\begin{cases}
{\zeta}_{A} = -10.1234567 \cdots, \\
{\zeta}_{B} = 1{,}001.2345678 \cdots.
\end{cases}
\end{equations*}

How do I align the decimal points with the equations being left justified and the case spacing remaining unaffected.

12

A solution that uses an array environment; note that using a cases environment seems like overkill for the case (pun intended) at hand.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\left\{
\begin{array}{@{} r @{{}={}} r}
\zeta_A & -10.1234567\cdots,\\
\zeta_B & 1{,}001.2345678\cdots.\\
\end{array} \right.
\end{equation*}
\end{document}

Addendum: The preceding solution assumes that both numbers have the same number of digits following the decimal marker. If this assumption isn't valid, the following modified solution, which still uses an array environment but now employs three rather than just two columns, should work for you.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\left\{
\begin{array}{@{} r @{{}={}} r @{.} l}
\zeta_A     &     -10 & 1234\cdots,\\
\zeta_{BCD} & 1{,}001 & 12345678901 \cdots.\\
\end{array} \right.
\end{equation*}
\end{document}
| improve this answer | |
  • but this works as desired only if you've got the same number of digits following the decimal point. – barbara beeton Dec 26 '14 at 15:33
  • @barbarabeeton - Thanks. I've posted an addendum to provide a solution that works in the general case. – Mico Dec 26 '14 at 16:50
4

Some \phantoms can be used to push content into the appropriate location. Overlapping allows also for accommodating for the use of \phantoms.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
  A &= \begin{cases}
    \zeta_A = -10.1234567 \cdots, \\
    \zeta_B = 1{,}001.2345678 \cdots.
  \end{cases} \\
  B &= \begin{cases}
    \rlap{$\zeta_{A}$}\phantom{\zeta_B} = \phantom{1{,}001}\llap{$-10$}.1234567 \cdots, \\
    \zeta_B = 1{,}001.2345678 \cdots.
  \end{cases}
\end{align*}

\end{document}
| improve this answer | |
4

With siunitx and its powerful features for printing numbers.

\documentclass{article}
\usepackage{amsmath,siunitx}

\newenvironment{xcases}[2][]
 {\left\lbrace\def\arraystretch{1.2}% like cases does
  \begin{array}{
    @{} r @{}
    >{{}}c<{{}} @{}
    S[table-format=#2,table-space-text-post={#1}] @{}
  }}
 {\end{array}\right.}

\begin{document}

\begin{equation*}
\begin{xcases}[$\,\cdots$,]{4.7}
\zeta_A &=& -10.1234567$\,\cdots$, \\
\zeta_B &=& 1001.2345678$\,\cdots$.
\end{xcases}
\end{equation*}

\begin{equation*}
\begin{xcases}{-4.7}
\zeta_A &=& -1001.1234567 \\
\zeta_B &=&  1001.2345678
\end{xcases}
\end{equation*}

\end{document}

The mandatory argument is the number format; in the first case four digits for the integral part and seven for the fractional part. Also some text can be added, the optional argument is a literal text that specifies the allotted space. In the second case, four digits and the sign for the integral part.

enter image description here

| improve this answer | |
  • To replicate the "look" specified by the OP a bit more closely, you could set the options group-digits=integer, group-four-digits=true, and group-separator={,} when loading siunitx. – Mico Dec 27 '14 at 0:00
  • @Mico Separating thousands with a comma is forbidden by my religion. ;-) – egreg Dec 27 '14 at 0:05
3

Use of tabular with @{.} skill as an alternative. Further Mico's kind reminder: use of array.

enter image description here

Code

\documentclass[]{article} 

\usepackage{amsmath,array}


\begin{document}
Given

\[
\begin{cases}
{\zeta}_{A} = -10.1234567 \cdots, \\
{\zeta}_{B} = 1{,}001.2345678 \cdots.
\end{cases}
\]

Suggested
\[
\begin{cases}
\begin{tabular}{ >{$}r<{$} @{ = } >{$} r <{$} @{.} >{$}l<{$}}
{\zeta}_{A} &  -10    & 1234567 \cdots, \\
{\zeta}_{B} & 1{,}001 & 2345678 \cdots.
\end{tabular}
\end{cases}
\]

@Mico's credits

\[
\begin{cases}
\begin{array}{ r @{ = }  r  @{.} l}
{\zeta}_{A} &  -10     & 1234567 \cdots, \\
{\zeta}_{B} & 1{,}001&2345678 \cdots.
\end{array}
\end{cases}
\]

\end{document}
| improve this answer | |
  • Ha, thanks Mico, you are quite right. I knew something can be improved, just can not think of it. will add one more option. soon. – Jesse Dec 26 '14 at 4:31
  • In the array example, you should specify @{{}={}} rather than @{ = } to get an amount of spacing that's appropriate for an item of type mathrel. (@{ = } treats = as being of type mathord.) – Mico Dec 26 '14 at 4:48
  • Yes, indeed. You have shown that. Will keep that in mind. – Jesse Dec 26 '14 at 4:51
2

Here I use the tabstackengine package. The OP's example can be done with a \tabbedCenterstack, though I then show a slightly more difficult version that requires a \tabularCenterstack.

\documentclass{article}
\usepackage{amsmath,tabstackengine}
\setstackEOL{\#}% end-of-line character in stack
\setstackTAB{\&}% end-of-field character in stack
\setstackgap{L}{16pt}% Inter-baseline gap in stack
\setstacktabulargap{0pt}% Inter-field gap in tabularstack
\stackMath
\begin{document}
\begin{equation*}
\begin{cases}
\tabbedCenterstack[r]{\zeta_{A} =\& -10.\&1234567 \cdots,\#
                      \zeta_{B} =\& 1,001.\&2345678 \cdots.}%
\end{cases}
\end{equation*}
\begin{equation*}
\begin{cases}
\tabularCenterstack{rrl}{\zeta_{AC} =\& -10.\&1234 \cdots,\#
                      \zeta_{B} =\& 1,001.\&2345678 \cdots.}%
\end{cases}
\end{equation*}
\end{document}

enter image description here

| improve this answer | |
  • I am trying to use the tabstackengine example and I am using TexShop on a Mac. I can't properly install the package. Any suggestions. – menkelh Dec 26 '14 at 19:09
  • @menkelh The package is at ctan.org/pkg/tabstackengine. If you download the .sty file in your working directory it should compile. In the long run, you need to find out where TeXShop stores its downloaded packages and put it there. (I myself use MikTeX, and so I am of no help for that). The PDF documentation is also available at the ctan site. – Steven B. Segletes Dec 26 '14 at 19:19

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.