0

My table is a mess!

I have three columns (from left to right):

  1. Left: very simple, single words.
  2. Middle: a list of five options (there won't be more than five).
  3. Left: a list of events taking place. These are long sentences and I inserted manual breaks to keep everything within the table boundaries. To make it easier to read, I also insert 9mm indents. It works ... okay. But I feel there must be a better, more elegant solution out there

Note: the list of words in the middle column is not linked to the list of events in the right column.

Any suggestions on how to insert these long sentences in the right column without having to add manual breaks?

Thanks.

Here's the code:

% PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass[a4paper,oneside,centered,twocolumn]{book}
\special{papersize=210mm,297mm}
\usepackage[top=3cm, bottom=3.2cm, left=2.5cm, right=2.5cm]{geometry}

\usepackage[english]{babel}
\usepackage{tocloft} % Customization of TOC LOF LOT
\usepackage[table,xcdraw]{xcolor} % For shading in tables
\usepackage{pdfcolmk}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage{pdfpages}
\usepackage{ltablex}
\usepackage{nicefrac} % To write fractions
\usepackage{attrib} % For source of quotations
\usepackage{lettrine} % For NewThought formatting
\usepackage{array} % To define width of columns in long table
\usepackage{booktabs} % Nicer spacing in columns
\usepackage{siunitx} % To write Celsius, etc.
\usepackage{enumitem} % To create item lists
\usepackage{caption} % To change way captions are labelled
\usepackage{scrextend}
\usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
\usepackage{etoolbox} % To make table footnote font smaller
\usepackage{threeparttablex}
\appto\TPTnoteSettings{\footnotesize}
\usepackage{textcomp} % For Numero symbol
\usepackage[T1]{fontenc}
\usepackage{titlesec,color}
\usepackage{showframe}
\usepackage{blindtext}
\usepackage[linguistics,edges]{forest}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{titling}
\usepackage{fontspec}
\usepackage{newpxtext} % Font for document instead of obsolete Palatino


% To make TOC in two columns and List of Tables into one column.
\usepackage{multitoc}
\makeatletter
\renewcommand*{\@starttoc}[1]{%
    \ifthenelse{\equal{#1}{toc}}{%
        \ifnum\multicolumntoc>1
        \begin{multicols}{\multicolumntoc}%
            \@multitoc@starttoc{#1}%
        \end{multicols}%
        \else
        \@multitoc@starttoc{#1}%
        \fi}{}%
    \ifthenelse{\equal{#1}{lot}}{%
        \ifnum\multicolumnlot>1
        \begin{multicols}{\multicolumnlot}%
            \@multitoc@starttoc{#1}%
        \end{multicols}%
        \else
        \@multitoc@starttoc{#1}%
        \fi}{}%
    \ifthenelse{\equal{#1}{lof}}{%
        \ifnum\multicolumnlof>1
        \begin{multicols}{\multicolumnlof}%
            \@multitoc@starttoc{#1}%
        \end{multicols}%
        \else
        \@multitoc@starttoc{#1}%
        \fi}{}%
}
\makeatother
\renewcommand{\multicolumnlot}{1}

% Change footnotes from numbers to symbols
\makeatletter
\def\@xfootnote[#1]{%
    \protected@xdef\@thefnmark{#1}%
    \@footnotemark\@footnotetext}
\makeatother

\begin{document}

\begin{table*}
    \small{
        \center
        \caption{Significant feasts and ceremonies of the five intercalary days.}\label{FeastsIntercalary}
        \begin{threeparttable}
            \begin{tabular}{cll}
                \toprule
                Intercalary Day & Names in the five languages & Celebrating group; location; celebration name; notes \\
                \midrule
                First & French: Bonjour\tnote{*} & Line One; Flower; Entering in the river; rituals and feasts. \\
                & German: Hallo & Line Two; Hand; Entering in the river; rituals and feasts \\
                & English: Hello & \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                & Spanish: Hola & Line Three; Hand; Entering in the river; rituals and feasts \\
                & Portugese: Ola & Line Four ; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                && Line Five; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                && Line Six; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. And the sentence \\
                && \hspace{9mm}continues, so I'm going to add another manual break, here!\\
                && Line Seven; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                && \\
                First & French: Bonjour\tnote{*} & Line One; Flower; Entering in the river; rituals and feasts. \\
                & German: Hallo & Line Two; Hand; Entering in the river; rituals and feasts \\
                & English: Hello & \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                & Spanish: Hola & Line Three; Hand; Entering in the river; rituals and feasts \\
                & Portugese: Ola & Line Four ; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                && Line Five; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                && Line Six; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. And the sentence \\
                && \hspace{9mm}continues, so I'm going to add another manual break, here!\\
                && Line Seven; Hand; Entering in the river; rituals and feasts \\
                && \hspace{9mm}lovely breakfast here!; Feasts and foods. \\
                \bottomrule
            \end{tabular}
            \begin{tablenotes}
                \item[*] \blindtext.
            \end{tablenotes}
        \end{threeparttable}
    }
\end{table*}

\end{document}

enter image description here

  • Sorry for all the code, but I wanna make sure that whatever better solution comes up (if there's one) doesn't break what i already have! – CyanideBaby Apr 4 at 8:48
  • 2
    I suggest using the X column type, hence a tabularx environment, and in this last column use a customised description environment. – Bernard Apr 4 at 8:50
1

Two suggestions using tabularx and hanging:

\documentclass[a4paper,oneside,centered,twocolumn]{book}
\special{papersize=210mm,297mm}
\usepackage[top=3cm, bottom=3.2cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{enumitem}

\usepackage{hanging}
\usepackage{tabularx}

\begin{document}

\begin{table*}
\begin{tabularx}{\textwidth}{clX}
First & \begin{tabular}[t]{l@{:~}l}
        French & Bonjour\\
        German & Hallo\\
        French & Bonjour\\
        German & Hallo\\
        French & Bonjour\\
        \end{tabular} &
   \begin{hangparas}{9mm}{1}

 \vspace{-0.5\baselineskip}  
 Line Six; Hand; Entering in the river; rituals and feasts lovely breakfast here!; Feasts and foods. And the sentence continues, so I'm going to add another manual break, here! 

 Line Six; Hand; Entering in the river; rituals and feasts lovely breakfast here!; Feasts and foods. And the sentence continues, so I'm going to add another manual break, here! 

  Line Six; Hand; Entering in the river; rituals and feasts lovely breakfast here!; Feasts and foods. And the sentence continues, so I'm going to add another manual break, here! 
\end{hangparas}\\
First & \begin{tabular}[t]{l}
        French: Bonjour\\
        German: Hallo\\
        French: Bonjour\\
        German: Hallo\\
        French: Bonjour\\
        \end{tabular} &
   \begin{hangparas}{9mm}{1}

 \vspace{-\baselineskip}  
 Line Six; Hand; Entering in the river; rituals and feasts lovely breakfast here!; Feasts and foods. And the sentence continues, so I'm going to add another manual break, here! 

 Line Six; Hand; Entering in the river; rituals and feasts lovely breakfast here!; Feasts and foods. And the sentence continues, so I'm going to add another manual break, here! 

  Line Six; Hand; Entering in the river; rituals and feasts lovely breakfast here!; Feasts and foods. And the sentence continues, so I'm going to add another manual break, here! 
\end{hangparas}\\
\end{tabularx}
\end{table*}



\end{document}
  • This is great. Thank you. It works on its own, but once I include it in my book (after adding the "hanging" and "tabularx" packages, i get an "latex package longtable error not in 1-column mode" error message. Any suggestions? – CyanideBaby Apr 5 at 10:59
  • 1
    @nofare: The error message you observe is due to the ltablex package that combines the features of tabularx and longtable (changes are applied to all tabularx environments). As longtables are not allowed in twocolumn mode that you explicitly use (see documentclass option) this results in the described error message. To overcome this, you could use \onecolumn right before \begin{table*} and \twocolumn right after \end{table*}. However, this will cause page breaks before and after the table. – leandriis Apr 5 at 14:32
  • 1
    If you want to prevent this and still want to use a package that combines tabularx and longtable features, you might want to switch to xltabular that keeps the original tabularx environment as it is. – leandriis Apr 5 at 14:33
  • I'm using the package ltablex. Would that work instead of switching to xltabular, which truth be told would be complicated? – CyanideBaby Apr 5 at 18:08
  • 1
    As already stated in my previous comment, you could use \onecolumn and \twocolumn but this will cause pagebreaks. – leandriis Apr 5 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.