Alignment in cases

Referencing my chat message from 2013-04-05, here is the definition of the cases environment that accepts one optional argument, the column specification of the left column. Thus writing \begin{cases}[r] the left column is set right-aligned.

This way you actually could even use siunitx’ table typsetting with the S column.

Code

\documentclass{article}
\usepackage{amsmath,siunitx}
\DeclareMathOperator{\sgn}{sgn}
\makeatletter
\renewenvironment{cases}[1][l]{\matrix@check\cases\env@cases{#1}}{\endarray\right.}
\def\env@cases#1{%
  \let\@ifnextchar\new@ifnextchar
  \left\lbrace\def\arraystretch{1.2}%
  \array{@{}#1@{\quad}l@{}}}
\makeatother
\begin{document}
\[
\sgn(x)=
\begin{cases}[c]
   -1 & \text{za podmínky } x>0\\
    0 & \text{za podmínky } x=0\\
    1 & \text{za podmínky } x>0
\end{cases}
 \]

 \[
 \sgn(x)=
 \begin{cases}[r]
    -1 & \text{za podmínky } x>0\\
     0 & \text{za podmínky } x=0\\
     1 & \text{za podmínky } x>0
 \end{cases}
 \]

 \[
 \sgn(x)=
 \begin{cases}[{S[table-format=-1.0]}]
    -1 & \text{za podmínky } x>0\\
     0 & \text{za podmínky } x=0\\
     1 & \text{za podmínky } x>0
 \end{cases}
 \]
\end{document}

Output

enter image description here


Simplest is probably to use \phantom{-}1


The cases environment of the amsmath package uses array with the column specification @{}l@{\quad}l@{}. Thus \multicolumn will work, e.g.:

\multicolumn{1}{@{}r@{\quad}}{...}

The alignment can also be influenced by \hfil and \hfill, because array or tabular are using \hfil to align and justify their column types l, c, and r.

\hfill 0 % puts 0 to the right

The following example shows the different methods:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\[
  \begin{cases}
    \mbox{left/default}   &       \mbox{left/default} \\
    \multicolumn{1}{@{}l@{\quad}}{\mbox{left}} &
    \multicolumn{1}{@{}l@{}}     {\mbox{left}} \\
    %
    \hfil  \mbox{center} & \hfil  \mbox{center} \\
    \multicolumn{1}{@{}c@{\quad}}{\mbox{center}} &
    \multicolumn{1}{@{}c@{}}     {\mbox{center}} \\
    %
    \hfill \mbox{right}  & \hfill \mbox{right} \\
    \multicolumn{1}{@{}r@{\quad}}{\mbox{right}} &
    \multicolumn{1}{@{}r@{}}     {\mbox{right}} \\
    %
    \multicolumn{1}{@{}p{10em}@{\quad}}{Column type p \dotfill\newline with two lines \hrulefill} &
    \multicolumn{1}{@{}p{10em}@{}}     {Column type p \dotfill\newline with two lines \hrulefill} \\
  \end{cases}
\]
\end{document}

Result

Applied to the case of the OP:

\documentclass{article}

\usepackage{amsmath}

\DeclareMathOperator{\sgn}{sgn}

\begin{document}
\[
  \sgn(x)=
  \begin{cases}
         -1 & \mbox{za podmínky } x>0\\
   \hfill 0 & \mbox{za podmínky } x=0\\
   \hfill 1 & \mbox{za podmínky } x>0
  \end{cases}
\]
\end{document}

Result