Function with cases or array

The issue seems to be that you want the "column" to the right of the brace to be centered rather than left justified, which is what happens in all of the cases environments (at least, in all of the ones that I know about). To fix this this the OP's idea of using an array seems to be the way to go, but a few tweaks are needed.

  • First, if you use \left\{ then there has to be a matching \right<delimiter>. As there isn't a matching right delimiter, in this case, you can use \right.. Personally, I don't like the sizes that \left....\right produces so, instead, I have defined a macro \Bigger that will scale the following delimiter to the specified height in millimeters, which defaults to 7mm. Except for the optional argument, this is similar to the \bigl, \biggl, \Big ... amsmath macros.
  • Next, as the OP says, the rows of the array are too close together. You can adjust the spacing between rows using the optional argument to the \\ command. So \\[3mm] will add an extra 3mm between the rows, which seems about right.
  • The array environment comes with padding, so there is too much space between the brace and the equations. You can remove the left-padding by adding @{} to the array specifications.
  • I have added some punctuation.
  • Finally, as suggested in the comments, \mid is better than |.

With these changes the MWE produces:

enter image description here

This is pretty close to the "ideal" image given at the top of the question. Here is the full code:

\documentclass{article}
\usepackage{amsmath}

% an ams-style operator for resizing delimiters
% Usage: \Bigger[, \Bigger[8][, \Bigger[10](, ...
\newcommand\Bigger[2][7]{\left#2\rule{0mm}{#1truemm}\right.}

\begin{document}

\begin{displaymath}
        P[\chi_{n+1}=j\mid\chi_{n}=i]=
        \Bigger[14]\{\begin{array}{@{}cl}
                \dfrac{N-i}{N}, & \text{si }j=i+1,\\[3mm]
                \dfrac{i}{N},   & \text{si }j=i-1,\\[3mm]
                0,              & \text{en otro caso}.
        \end{array}
\end{displaymath}

\end{document}

This seems to be a precise stylistic choice, so you should somehow make it the default by defining your own environment.

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

\makeatletter % some generic helpers
\newcommand{\LCASES}[1]{$\m@th\displaystyle{#1}$\hfil}
\newcommand{\CCASES}[1]{\hfil$\m@th\displaystyle{#1}$\hfil}
\newcommand{\RCASES}[1]{\hfil$\m@th\displaystyle{#1}$}
\makeatother

\newcases{ecases}{\quad}{\CCASES{##}}{\LCASES{##}}{\lbrace}{.}
\newcases{ecases*}{\quad}{\CCASES{##}}{{##}\hfil}{\lbrace}{.}

\begin{document}

\begin{equation*}
P[\chi_{n+1}=j\mid\chi_{n}=i]=
\begin{ecases*}
  \frac{N-i}{N} & si $j=i+1$,\\
  \frac{i}{N}  & si $j=i-1$,\\
  0            & en otro caso.
\end{ecases*}
\end{equation*}

\end{document}

The ecases environment has the second column cells typeset in math mode, whereas in ecases* they're in text mode.

enter image description here

Say that the publisher to whom you submit your book tells you their editorial policy is to align left the cases. You can answer that it's really easy, because returning to the default just requires changing two lines:

\newcases{ecases}{\quad}{\LCASES{##}}{\LCASES{##}}{\lbrace}{.}
\newcases{ecases*}{\quad}{\LCASES{##}}{{##}\hfil}{\lbrace}{.}

and you'd get

enter image description here


Here, I use a TABstack for the cases. In particular, a \tabularCenterstack allows the column alignments to be individually specified. The baselineskip between cases can be simply set, as shown in the MWE.

\documentclass{scrartcl}
\usepackage{amsmath,tabstackengine}
\TABstackMath% SETS STACKS IN MATH MODE
\TABstackMathstyle{\displaystyle}% DEFINE STYLE OF MATH STACKS
\setstackgap{L}{2.5\baselineskip}% SETS BASELINESKIP FOR LONG-STACKED LINES
\setstacktabulargap{2\tabcolsep}% DEFINES INTERCOLUMN GAP
\begin{document}
\begin{displaymath}
        P[\chi_{n+1}=j|\chi_{n}=i]=
        \left\{
        \tabularCenterstack{cl}{
                \frac{N-i}{N}&\text{si }j=i+1\\
                \frac{i}{N}&\text{si }j=i-1\\
                0&\text{otro caso}
        }
        \right.
\end{displaymath}
\end{document}

enter image description here

Tags:

Arrays

Cases