5

I'm looking for a package if it exists or options to deal with schemes that use curly braces. In general, how can I do something like this:

enter image description here

0

3 Answers 3

11

The schemata package is designed to handle simple and complex schemas of just this kind. If you are not using mathematical content, one advantage of this approach is that it is primarily designed for typesetting textual schemas. (Though no doubt you could use it with mathematical content if you wished.)

For example:

\documentclass{article}
\usepackage{schemata}
\begin{document}
\schema{%
  \schemabox{Main}%
}{%
  \schema{%
    \schemabox{Option A}%
  }{%
    \schemabox{%
      Option AA\\
      Option AB%
    }%
  }%
  \schema{%
    \schemabox{Option B}%
  }{%
    \schemabox{%
      Option BA\\
      Option BB%
    }%
  }%
}
\end{document}

schemas

EDIT

If your schema is quite simple, you could alternatively draw it as a tree:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{forest}
\usetikzlibrary{decorations.pathreplacing}
\forestset{
  forest scheme/.style={
    for tree={
      grow'=0,
      anchor=west,
      align=left,
      if n=1{%
        edge path={
          \noexpand\path [\forestoption{edge}] (!ul.south west) -- (!u1.north west)\forestoption{edge label};
        }
      }{no edge},
      edge={decorate, decoration={brace}},
    },
  }
}
\begin{document}
\begin{forest}
  forest scheme
  [Main
    [Option A
      [Option AA]
      [Option AB]
    ]
    [Option B
      [Option BA]
      [Option BB]
    ]
  ]
\end{forest}
\end{document}

forest schema

But this solution is not as robust or flexible as use of the specialist package.

0
6

An alternate process might be to use the amsmath cases environment.

\documentclass[12pt]{article}

\usepackage{amsmath}

\begin{document}

$\text{main} 
\begin{cases}
\text{Case a} \begin{cases} \text{case 1} \\ \text{case 2} \end{cases} \\
\text{Case B} \begin{cases} \text{case 1} \\ \text{case 2} \end{cases}
\end{cases}$

\end{document}

which yields the example:

cases

2
  • 2
    Looks unaligned. Using alignment points and \smashes improves the result: $\text{main} \begin{cases} \text{Case A} & \smash[t]{\begin{cases} \text{case 1} \\ \text{case 2} \end{cases}} \\[3ex] \text{Case B} & \smash[b]{\begin{cases} \text{case 1} \\ \text{case 2} \end{cases}} \end{cases}$ Jul 30, 2015 at 19:38
  • Hi, there is really no reason to correct minor things in old posts. It kicks them back to the front page and current questions go under. Thanks
    – Johannes_B
    Mar 29, 2020 at 4:42
5

The following might be a start for you:

enter image description here

\documentclass{article}
\usepackage{array}

\begin{document}

\begin{center}
  \begin{tabular}{ m{5em} @{} m{11em} }
    Main $\left\{\rule{0pt}{\dimexpr2\normalbaselineskip+.5\bigskipamount}\right.$ &
        \begin{tabular}{@{}l@{}}
          $\mbox{Option A }\left\{\begin{tabular}{@{~}l@{}}
            Option AA \\[\bigskipamount]
            Option AB
          \end{tabular}\right.$\hspace{-\nulldelimiterspace} \\[\bigskipamount]
          $\mbox{Option B }\left\{\begin{tabular}{@{~}l@{}}
            Option BA \\[\bigskipamount]
            Option BB
          \end{tabular}\right.$\hspace{-\nulldelimiterspace}
        \end{tabular}
  \end{tabular}
\end{center}

\end{document}

I've added some spaces as part of the column separation, but they might not be needed, depending on your application. Similarly, the \nulldelimiterspace corrections might not be needed.

One main assumption in the above code is the use of non-paragraph text as the "Option" text.

Not the answer you're looking for? Browse other questions tagged .