9

I have found the code below that almost does what I want. But since I do not understand it, I do not know how to alter it to my purposes. The code below generates a brace on the right side of a collection of three elements in a table and then in followed by a descriptive sentence. What I desire is to have a name on the left followed by a brace { on the left of only two elements in a table. Can you please show me how to alter this code to accomplish this? I need only one occurrence of such an array, not the three given in the code below.

\documentclass[10pt]{report}    
\topmargin -0.5in   
\textheight 9.75in   
\textwidth6.5in    
\oddsidemargin 0in              % sets the left margin
\usepackage{amsmath} 
\usepackage{graphicx}  
%\usepackage{epic}  
%\usepackage{eepic}   
\usepackage{Fancyheadings}   
\usepackage{fancybox}
\pagestyle{fancy}               % this suppresses page numbers
\setlength{\headrulewidth}{0pt}

\begin{document}

\newcommand\MyLBrace[2]{%
  \left.\rule{0pt}{#1}\right\}\text{#2}}

\noindent\begin{tabular}{c@{}l}
  \begin{tabular}{ll@{}}
    Aardvark & Armenia \\
    Elephant & Ethiopia \\
    Platypus & Portugal \\
    Zebra  & Zimbabwe \\
    text  & text \\
    text  & text \\
    text  & text \\
  \end{tabular} 
  &
  $\begin{array}{l}
    \MyLBrace{3ex}{things beginning with vowels} \\ 
    \MyLBrace{3ex}{things beginning with consonants} \\
    \MyLBrace{4.4ex}{things beginning and ending with t} 
  \end{array}$
\end{tabular}

\end{document}

2
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Commented Jun 9, 2016 at 23:02
  • I have added the stuff at the top. Does that help? I can add more, but it seems irrelevant to the question I am asking. Commented Jun 10, 2016 at 0:31

3 Answers 3

5

The following removes the dependency of a macro and amsmath and uses just a construction of tabulars and arrays to insert the { (or }).

Horizontal alignment across rows of the nested arrays is established by setting a \phantom row of elements that are widest within each respective column and jumping back vertically using \\[-\normalbaselineskip].

enter image description here

\documentclass{article}

\begin{document}

\noindent
\begin{tabular}{c@{}l}
  $\left.\kern-\nulldelimiterspace
    \begin{tabular}{@{}ll@{}}
      Aardvark & Armenia \\
      Elephant & Ethiopia \\
      \phantom{Aardvark} & \phantom{Zimbabwe} \\[-\normalbaselineskip]% For horizontal alignment
    \end{tabular}\right\}$ &
    things beginning with vowels \\
  $\left.\kern-\nulldelimiterspace
    \begin{tabular}{@{}ll@{}}
      Platypus & Portugal \\
      Zebra  & Zimbabwe \\
      \phantom{Aardvark} & \phantom{Zimbabwe} \\[-\normalbaselineskip]% For horizontal alignment
    \end{tabular}\right\}$ &
    things beginning with consonants \\
  $\left.\kern-\nulldelimiterspace
    \begin{tabular}{@{}ll@{}}
      text  & text \\
      text  & text \\
      text  & text \\
      \phantom{Aardvark} & \phantom{Zimbabwe} \\[-\normalbaselineskip]% For horizontal alignment
    \end{tabular}\right\}$ &
    things beginning and ending with t
\end{tabular}

\noindent
\begin{tabular}{r@{}c}
  things beginning with vowels & $\left\{
    \begin{tabular}{@{}ll@{}}
      Aardvark & Armenia \\
      Elephant & Ethiopia \\
      \phantom{Aardvark} & \phantom{Zimbabwe} \\[-\normalbaselineskip]% For horizontal alignment
    \end{tabular}\right.\kern-\nulldelimiterspace$ \\    
  things beginning with consonants & $\left\{
    \begin{tabular}{@{}ll@{}}
      Platypus & Portugal \\
      Zebra  & Zimbabwe \\
      \phantom{Aardvark} & \phantom{Zimbabwe} \\[-\normalbaselineskip]% For horizontal alignment
    \end{tabular}\right.\kern-\nulldelimiterspace$ \\
  things beginning and ending with t & $\left\{
    \begin{tabular}{@{}ll@{}}
      text  & text \\
      text  & text \\
      text  & text \\
      \phantom{Aardvark} & \phantom{Zimbabwe} \\[-\normalbaselineskip]% For horizontal alignment
    \end{tabular}\right.\kern-\nulldelimiterspace$
\end{tabular}

\end{document}
1
  • OK, Got it. Have not yet studied it enough to understand it, but I see how to use it. Many thanks for your kind and generous help. Commented Jun 10, 2016 at 6:40
2

Another option would be to exploit the mathematical environment which has less need for phantom spacing, and has sizeable braces:

\begin{eqnarray*}
\left.
\begin{array}{ll}
  \mbox{Aardvark} & \mbox{Armenia}\\ 
  \mbox{Elephant} & \mbox{Ethiopia} 
\end{array} 
\right\}  && \mbox{Things beginning with vowels} \\ 
\mbox{Things beginning with consonants:} && \left\{
\begin{array}{ll}
  \mbox{Platypus} & \mbox{Portugal}\\ 
  \mbox{Zebra} & \mbox{Zimbabwe} 
\end{array}
\right.
\end{eqnarray*}

This takes advantage of a few neat features of delimiters in mathmode. The delimiters (preceded by \left or \right are sized to fit the text inside them. If you only want one delimiter (left or right) then you make the other side a phantom using a .. So for instance, the \left. code tells LaTeX to put in a phantom delimiter on the left, so the right hand brace does all the work.

So, instead of all the phantom spacing, you need phantom delimiters, and to put all text into \mbox environments.

Also note that the eqnarray environment is used here to align spacing via the && marks. You could move those to the beginning or end of the line, or else just use the equation environment with linebreaks.

0

With {NiceTabular} of nicematrix and its built-in command \SubMatrix.

\documentclass[10pt]{article}    
\usepackage{nicematrix} 

\begin{document}

\renewcommand{\arraystretch}{1.4}

\begin{NiceTabular}{lll}
  Aardvark & Armenia  & \Block{2-1}{things beginning with vowels} \\
  Elephant & Ethiopia & \\
  Platypus & Portugal & \Block{2-1}{things beginning with consonants} \\
  Zebra    & Zimbabwe & \\
  text     & text     & \Block{3-1}{things beginning and ending with t} \\
  text     & text     & \\
  text     & text     & \\
\CodeAfter
  \SubMatrix{.}{1-1}{2-2}{\}}
  \SubMatrix{.}{3-1}{4-2}{\}}
  \SubMatrix{.}{5-1}{7-2}{\}}
\end{NiceTabular} 

\end{document}

Output of the above code

You must log in to answer this question.

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