Graphics, Figures & TablesSupertabular, multirow, and 2 columns not playing well

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
latex_user
Posts: 2
Joined: Thu Jun 10, 2010 9:26 am

Supertabular, multirow, and 2 columns not playing well

Post by latex_user »

Greetings, all. I am trying to create a table with a line break in the initial heading cells. This is complicated by a requirement to use a 2 column page format, and the necessity of therefore using supertabular.

In the example below, what I would like is output like:
Bar
Baz Mumble

for the second heading with data below. Instead I am getting "Bar Baz Mumble" all on one line. I have tried a few things without success, including

Code: Select all

\documentclass[9pt,twocolumn]{article}
\usepackage{supertabular}
\usepackage{multirow}

\begin{document}

\tablefirsthead{%
    \hline  \\
    \multicolumn{1}{c}{\textbf{Foo } \linebreak } &
    \multicolumn{1}{c}{\multirow{2}{*}{\textbf{``Bar \linebreak Baz Mumble''}}} & 
    \\ \hline }
%This is the header for the remaining page(s) of the table...
\tablehead{%
    \hline 
    \multicolumn{3}{c}{{\tablename} \thetable{} -- Continued} \\
    \hline  \\
    \multicolumn{1}{c}{\textbf{Foo } \linebreak } &
    \multicolumn{1}{c}{\multirow{2}{*}{\textbf{``Bar \linebreak Baz Mumble''}}} &
      \\ \hline}
%This is the footer for all pages except the last page of the table...
\tabletail{%
\hline 
  \multicolumn{3}{l}{{Continued \ldots}} \\
}
\tablelasttail{\hline}
\begin{supertabular}{p{2.2cm} c }\hline
A & B \\
C & D \\
\hline
\end{supertabular}
\end{document}
And the interesting part here is \multicolumn{1}{c}{\multirow{2}{*}{\textbf{``Bar \linebreak Baz Mumble''}}} & "

...the \linebreak appears to be failing, at the very least.

Any suggestions? Thank you very much!

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

latex_user
Posts: 2
Joined: Thu Jun 10, 2010 9:26 am

Supertabular, multirow, and 2 columns not playing well

Post by latex_user »

Solved with an easy hack: use two lines for the header, and keep some cells blank in the second line. I tried this early on to no avail -- must've done something wrong. Sample code below in case it's useful to anyone else some 3:00 am. :roll:

I imagine there are better ways to do this... breaking lines by hand is a good sign I'm off in the weeds. More graceful ideas welcome!

Code: Select all

\documentclass[9pt,twocolumn]{article}
\usepackage{supertabular}
\usepackage{multirow}

\begin{document}

\tablefirsthead{%
    \hline  \\
      \multicolumn{1}{c}{Foo} & \multicolumn{1}{c}{Bar Baz}  \\
      \multicolumn{1}{c}{} &  \multicolumn{1}{c}{Mumble} \\
    \hline  \\      
  }
            
%This is the header for the remaining page(s) of the table...
\tablehead{%
    \hline 
      \multicolumn{1}{c}{Foo} & \multicolumn{1}{c}{Bar Baz}  \\
      \multicolumn{1}{c}{} &  \multicolumn{1}{c}{Mumble} \\
    \hline  \\      
 }

%This is the footer for all pages except the last page of the table...
\tabletail{%
\hline 
  \multicolumn{2}{l}{{Continued \ldots}} \\
}
\tablelasttail{\hline}
\begin{supertabular}{p{2.2cm} c  }
A & B \\
C & D \\
\hline
\end{supertabular}
\end{document}
Post Reply