Graphics, Figures & Tablesmulticolumn

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
xpfenech
Posts: 3
Joined: Thu Jan 06, 2011 12:26 am

multicolumn

Post by xpfenech »

hi all,
here is my doubt.

I have a table and one of the subtitles is veryyy looong
\multicolumn{3}{c}{title} && \multicolumn{3}{c}{veryyyyy looooooong tiiiiitleeeee}

i would like to see it in the table in three rows.

i.e:
veryyyyy
looooooong
tiiiiitleeeee

Is it possible?

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

multicolumn

Post by frabjous »

Just like any other table cell, if you want wrapping, you need to use the p, b or m column specifier, and manually set the width:

Code: Select all

\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|c|c|c|c|}
    \hline
    \multicolumn{3}{|p{1.7cm}|}{\centering title} & \multicolumn{3}{|p{1.7cm}|}{\centering veryyyyy looooooong tiiiiitleeeee}\\
    \hline
    A & B & C & D & E & F \\
    \hline
\end{tabular}
\end{document}
table.png
table.png (2.99 KiB) Viewed 1697 times
(If you don't want lines, remove all the |'s and \hline's. I just added those so you could see the cells more clearly in the output.)
xpfenech
Posts: 3
Joined: Thu Jan 06, 2011 12:26 am

Re: multicolumn

Post by xpfenech »

:shock: Beautyful! thank you! :D
Post Reply