Graphics, Figures & TablesBox around multiple cells

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Stefanie
Posts: 25
Joined: Fri Apr 04, 2008 2:39 pm

Box around multiple cells

Post by Stefanie »

Does anyone know if it is possible to use boxes in a tabular environment?
E.g. if I have

Code: Select all

 \begin{tabular}{ccc} 
    A    &  B & C  \\ 
    D    &  E & F \\
\end{tabular}
I would like to draw a box around A and B, and around E and F to show that they are grouped together. \fbox{A & B} doesn't work, because fbox can only be used within one cell.

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Box around multiple cells

Post by Juanjo »

Try this:

Code: Select all

\begin{tabular}{ccc}
    \cline{1-2}
    \multicolumn{1}{|c}{A} &  \multicolumn{1}{c|}{B} & C  \\
    \hline
    D    &  \multicolumn{1}{|c}{E} & \multicolumn{1}{c|}{F} \\
    \cline{2-3}
\end{tabular}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Post Reply