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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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