Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to create something like that

enter image description here

Clearly every element should be coherent with eachother and line need to be connected. This is a MWE, how should I modify it to make it coherent:

\documentclass{beamer}
\mode<presentation>

\usetheme{Warsaw}
\usepackage[utf8]{inputenc}

\begin{document}
        \begin{frame}
            \[
            \begin{array}{c|c}
            x_i & lat_i \\
            \hline
            \end{array}
            \]
            \[ 
            \left.\begin{array}{c|c}
            t_1 & lat_1 \\
            \hline
            t_2 & lat_2 \\
            \end{array}
            \right\rbrace = a
            \]\[
            \left.\begin{array}{c|c}
            t_3 & lat_3 \\
            \hline
            t_4 & lat_4 \\
            \end{array}
            \right\rbrace = b
            \]      
        \end{frame} 
\end{document}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

I'm not sure if I fully understand what you mean by "the lines need to be connected" -- should they be connected vertically, or should the first line extend horizontally?

If you want to join the vertical lines (but not extend the first horizontal line to the right), you may want to use the capabilities of the multirow package:

\documentclass{beamer}
\mode<presentation>
\usetheme{Warsaw}
\usepackage[utf8]{inputenc}
\usepackage{multirow}  % for \multirow command
\begin{document}
   \begin{frame}
      \[
      \begin{array}{c|cl}
         x_i & lat_i  \\
         \cline{1-2}
         t_1 & lat_1 & \multirow{2}*{$\bigg\} = a$}\\
         \cline{1-2}
         t_2 & lat_2 & \\
         t_3 & lat_3 & \multirow{2}*{$\bigg\} = b$}\\
         \cline{1-2}
         t_4 & lat_4 & \\
      \end{array}
      \]      
   \end{frame} 
\end{document}

enter image description here

Incidentally, if you want to have the first horizontal line to extend over the entire width of the array, you can do so by replacing the first \cline{1-2} instruction with \hline.

Alternatively, you could use the following MWE if you wish to extend the first horizontal line so that it spans all subsequent material (while lining up the vertical lines). The second MWE also reduces (but does not fully eliminate) the vertical gap between the arrays, by using the gather* environment.

\documentclass{beamer}
\mode<presentation>
\usetheme{Warsaw}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}  % for gather (and gather*) math environment
\begin{document}
        \begin{frame}
          \begin{gather*}
            \begin{array}{c|c}
              x_i & lat_i \hphantom{\Bigg\}=a}\\
              \hline
            \end{array}\\
            \left.\begin{array}{c|c}
              t_1 & lat_1 \\
              \hline
              t_2 & lat_2 \\
            \end{array}
            \right\rbrace = a\\
            \left.\begin{array}{c|c}
              t_3 & lat_3 \\
              \hline
              t_4 & lat_4 \\
            \end{array}
            \right\rbrace = b
          \end{gather*}      
        \end{frame} 
\end{document}

enter image description here

share|improve this answer
    
Last image is exactly what I need. If you want you could change first attempt ;) –  Mariano May 8 '12 at 14:10
    
@Mariano -- Glad I guessed right with the MWE that uses multirow. I'll leave both MWEs in place but will reverse the order per your suggestion. –  Mico May 8 '12 at 14:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.