Graphics, Figures & TablesIndented text on multicolumn

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Antz
Posts: 4
Joined: Mon Jan 24, 2011 1:37 pm

Indented text on multicolumn

Post by Antz »

I have made a table that has a heading in a multicolumn. For some reason, when I have two columns and the heading should span both and be flushed to the left, it is indented anyway. I tried to make a MWE (my first!) to explain the problem. I want the heading in table 1 ("Implemented functionality") to look like the headings in table 2. This seems to occur whenever there is only one "item" across all columns (see table3 in the MWE)

How do I fix this?

Code: Select all

\documentclass{book}
\usepackage{booktabs}
\usepackage{multirow}





\begin{document}

\begin{table}[ht]
\caption{Overview of functionalities implemented in the panel}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} lp{0.9\textwidth}}
\toprule
\multicolumn{2}{l}{\noindent Implemented functionality} \\
\midrule
A & Visualization of blabla \\
B & Visualization of other blabla \\
\bottomrule
\end{tabular*}
\end{table}



\begin{table}[ht]
\caption{Overview of principle-related functionality selection}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} p{0.45\textwidth}lp{0.46\textwidth}}
\toprule
Principle & \multicolumn{2}{l}{Implemented functionality} \\
\midrule
A & Visualization of blabla & blabla \\
B & Visualization of other blabla & blabla\\
\addlinespace
\bottomrule
\end{tabular*}
\end{table}

\begin{table}[ht]
\caption{Overview of principle-related functionality selection}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} p{0.45\textwidth}lp{0.46\textwidth}}
\toprule
\multicolumn{3}{l}{Implemented functionality} \\
\midrule
A & Visualization of blabla & blabla \\
B & Visualization of other blabla & blabla\\
\addlinespace
\bottomrule
\end{tabular*}
\end{table}


\end{document}
Last edited by Antz on Tue Jan 25, 2011 10:08 pm, edited 1 time in total.

Recommended reading 2024:

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

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

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

Indented text on multicolumn

Post by frabjous »

If I understand your concern, the problem is that by using the \multicolumn command in the first column, you've overriding the column specification for the first column, which includes the @{\extracolsep{\fill}} part. You'll need to reinsert that when you specify the setting for the multicolumn cell, e.g.:

Code: Select all

\documentclass{book}
\usepackage{booktabs}
\usepackage{multirow}

\begin{document}

\begin{table}[ht]
\caption{Overview of functionalities implemented in the panel}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} lp{0.9\textwidth}}
\toprule
\multicolumn{2}{@{\extracolsep{\fill}}l}{\noindent Implemented functionality} \\
\midrule
A & Visualization of blabla \\
B & Visualization of other blabla \\
\bottomrule
\end{tabular*}
\end{table}



\begin{table}[ht]
\caption{Overview of principle-related functionality selection}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} p{0.45\textwidth}lp{0.46\textwidth}}
\toprule
Principle & \multicolumn{2}{l}{Implemented functionality} \\
\midrule
A & Visualization of blabla & blabla \\
B & Visualization of other blabla & blabla\\
\addlinespace
\bottomrule
\end{tabular*}
\end{table}

\begin{table}[ht]
\caption{Overview of principle-related functionality selection}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} p{0.45\textwidth}lp{0.46\textwidth}}
\toprule
\multicolumn{3}{@{\extracolsep{\fill}}l}{Implemented functionality} \\
\midrule
A & Visualization of blabla & blabla \\
B & Visualization of other blabla & blabla\\
\addlinespace
\bottomrule
\end{tabular*}
\end{table}

\end{document}
Antz
Posts: 4
Joined: Mon Jan 24, 2011 1:37 pm

Re: Indented text on multicolumn

Post by Antz »

worked like a charm! thank you!

it's my first latex project, so I'm just copying examples here and there; i'm trying to understand what I'm doing as much as possible but sometimes I'm in the dark. this was one of those cases, and it was the first time i asked helped. again, i learned! :)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Indented text on multicolumn

Post by localghost »

Antz wrote:worked like a charm! thank you! […]
Then please mark the topic accordingly as written in Section 3 of the Board Rules (to be read before posting).


Thorsten
Antz
Posts: 4
Joined: Mon Jan 24, 2011 1:37 pm

Re: Indented text on multicolumn

Post by Antz »

sorry! i guess i hanged on the MWE thing. done!
Post Reply