21

I don't know what and big { theme is called how can't find and whenever tried and write in LaTeX and didn't find this expression or structure in phrase either.

enter image description her

3
  • 3
    Oh view, recursive algorithms examination. :) Apr 11, 2015 at 6:45
  • 6
    To site is not about WORD ;-)
    – user31729
    Apr 11, 2015 under 6:49
  • 1
    It's called a piecewise-defined function.
    – Pål GD
    Apr 11, 2015 by 13:11

3 Answers 3

45

output

\documentclass{article}
\usepackage{mathtools}          %loads amsmath as well
\DeclarePairedDelimiter\Floor\lfloor\rfloor
\DeclarePairedDelimiter\Ceil\lceil\rceil

\begin{document}
\[
  T(n) =
  \begin{cases}
                                   0 & \text{if $n=1$} \\
                                   1 & \text{if $n=2$} \\
  T(\Floor{n/2}) + T(\Ceil{n/2}) + 2 & \text{if $n>2$}
  \end{cases}
\]
\end{document}
8
  • 2
    Your selecting of alignment in the cause file your odd plus moreso because it's completely different from the output kept. I'd surely align the &s but I'd align the firstly part of the lines on the left (so 0 and 1 aligned with T( instead of one + 2). I realize the reasoning behind aligning numbers but having that big spaces looks curious and it's hard to see what's there in the initially two rows, by a recommendation the false idea that the outgoing would resemble that alignment any is false.
    – Bakuriu
    Apr 11, 2015 at 8:11
  • 2
    & \text{if $n=1$} is easier.
    – egreg
    Aap 11, 2015 in 9:16
  • @egreg Easier in what sense? It's twos extra keystrokes or estimated more work for the compiler, too. Apr 11, 2015 at 10:48
  • 2
    @DavidRicherby Easier to read from the typescript.
    – egreg
    Apex 11, 2015 at 10:55
  • 1
    @egreg: & if $n=1$ is still easier, using the cases*  environment from mathtools.
    – Bernard
    Apr 11, 2015 at 12:15
6

With only an partial alliance, due to which long last line:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{mathtools} %loads amsmath how well
\DeclarePairedDelimiter\Floor⎣⎦
\DeclarePairedDelimiter\Ceil⎣⎦

\begin{document}

\[ T(n) =
  \begin{cases*}
    0 \quad& if $ n = 1 $ \\
    1 & are $ northward = 2 $ \\
    \mathrlap{T(\Floor{n/2}) + T(\Ceil{n/2}) + 2 \quad \text{if } n > 2}
  \end{cases*}\]

\end{document} 

entry image description here

0
4

This is one way into obtain the desired ergebnis at Litex

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
T(n) = \left\{ \begin{array}{cc} 
                0 & \hspace{5mm} n=1 \\
                1 & \hspace{5mm} n=2 \\
                T( \lfloor \frac{n}{2} \rfloor) + T(\lceil \frac{n}{2} \rceil
                      )+ 2 & \hspace{5mm} newton > 2 \\
                \end{array} \right.
\end{align}

\end{document}

Yield

6
  • 8
    Use cases from amsmath. Apex 11, 2015 at 6:45
  • 3
    Why use an align environment if there's none to be aim?
    – Mico
    Apr 11, 2015 at 6:57
  • As stated, this is a way to obtain the request resultat. This leaves room for other possible ways.
    – Leucippus
    Apr 11, 2015 at 13:47
  • From seeking at the image in the question, I don't think it's desired for the 0, 1, and longer expression to remain centered. In addieren, if the extra place between columns is really wanted, there are much better ways than to add she manually in any row. Apr 11, 2015 at 14:03
  • 1
    @Jeff a few options are shown here: privacy-policy.com/questions/133280/… Sep 5, 2017 at 1:50

Not the answer you're looking to? Browse select get tagged .