Nested right cases

alignamsmatharrayscases

I was reading a script for maths and came across this "picture" and was wondering how he typeset it in LaTeX, so I wanted to try myself.

First I thought of cases, but that did not work as intended. Then I tried arrays but while trying to align the arrays with the top line but not getting larger curly braces than wanted I could not succeed.

I would like to get the centred look, or at least no manual spacing adding.

This is what the sources looks like:
Source of what I want to recreate.

My attempt:

\begin{equation}
    \begin{rcases}
            \begin{rcases}
                    \begin{rcases}
                        \text{ganz rational, Polynom:} \\[-1ex]
                        y = f(x) = x \\
                        \text{gebrochen rational:} \\[-1ex]
                        y = f(x) = \frac1x
                    \end{rcases}
                    \quad \text{rational} \quad \\
                \mskip220mu\text{irrational:} \\[-1ex]
                \mskip220mu y = f(x) = \sqrt{x}
            \end{rcases} \quad\text{algebraisch} \quad \\ 
        \mskip360mu\text{transzendent:} \\[-1ex]
        \mskip360mu y = f(x) = \sin x
    \end{rcases}\quad \text{elementar}
\end{equation}

my attempt

Best Answer

Here is what you can do with the package cascade.

\documentclass{article}
\usepackage{geometry}
\usepackage{cascade,calc}

\begin{document}


\Cascade
  {}
  {
    \Cascade
      {}
      { 
        \ShortCascade
          {\begin{tabular}{c}ganz rational, Polynom:\\ $y=(x)=x$\end{tabular}}
          {\begin{tabular}{c}gebrochen rational:\\ $y=f(x)=\frac{1}{x}$\end{tabular}}
        rational
      }
      {}
      {\begin{tabular}{c}irrational\\ $y=f(x)=\sqrt{x}$\end{tabular}}
    algebraisch
  }
  {}
  {\begin{tabular}{c}tranzendent\\ $y=f(x)=\sin x$\end{tabular}}
elemantar

\bigskip

\Cascade
  { 
    \Cascade
      { 
        \ShortCascade
          {\begin{tabular}{c}ganz rational, Polynom:\\ $y=(x)=x$\end{tabular}}
          {\begin{tabular}{c}gebrochen rational:\\ $y=f(x)=\frac{1}{x}$\end{tabular}}
        rational
      }
      {}
      {}
      {\begin{tabular}{c}irrational\\ $y=f(x)=\sqrt{x}$\end{tabular}}
    algebraisch
  }
  {}
  {}
  {\begin{tabular}{c}tranzendent\\ $y=f(x)=\sin x$\end{tabular}}
elemantar

\vspace{1cm}

\Cascade
  {}
  {
    \Cascade
      {}
      { 
        \ShortCascade
          {\begin{tabular}{c}ganz rational, Polynom:\\ $y=(x)=x$\end{tabular}}
          {\begin{tabular}{c}gebrochen rational:\\ $y=f(x)=\frac{1}{x}$\end{tabular}}
        \makebox[\widthof{$y=f(x)=\sqrt{x}$}]{rational}
      }
      {}
      {\begin{tabular}{c}irrational\\ $y=f(x)=\sqrt{x}$\end{tabular}}
    \makebox[\widthof{$y=f(x)=\sin(x)$}]{algebraisch}
  }
  {}
  {\begin{tabular}{c}tranzendent\\ $y=f(x)=\sin x$\end{tabular}}
elemantar

\bigskip

\Cascade
  { 
    \Cascade
      { 
        \ShortCascade
          {\begin{tabular}{c}ganz rational, Polynom:\\ $y=(x)=x$\end{tabular}}
          {\begin{tabular}{c}gebrochen rational:\\ $y=f(x)=\frac{1}{x}$\end{tabular}}
        \makebox[\widthof{$y=f(x)=\sqrt{x}$}]{rational}
      }
      {}
      {}
      {\begin{tabular}{c}irrational\\ $y=f(x)=\sqrt{x}$\end{tabular}}
    \makebox[\widthof{$y=f(x)=\sin(x)$}]{algebraisch}
  }
  {}
  {}
  {\begin{tabular}{c}tranzendent\\ $y=f(x)=\sin x$\end{tabular}}
elemantar

\end{document}

Output of the above code