0

I was following the answer found in this question How to put sentences in tables 2 and I just changed the contents of the table. I thought it's gonna be straightforward because I didn't touch the commands used there.

What happens is after I changed the sentences in the table without touching the commands used to generate the table, the PDF looks like this:

enter image description here

This is the commands I used to make that table above:

\documentclass[a4paper,twocolumn]{article}
\usepackage[margin=1in]{geometry}
\usepackage{calc}
\usepackage{amssymb}
\usepackage{array}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx,ragged2e,multirow,booktabs}
\renewcommand\tabularxcolumn[1]{C{#1}}

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\setlength\parindent{0pt}
\begin{document}

\begin{table}
\sffamily\small
\setlength{\tabcolsep}{4pt}
\setlength{\extrarowheight}{2pt}
\noindent
\centering
\begin{tabularx}{\linewidth}{|X|C{1cm-\tabcolsep}|C{1cm-\tabcolsep}|c|}
\hline
\multirow{6}{=}{\centering Appointment--related information} &                             \multicolumn{2}{C{2cm}|}{Did the information gets posted on the Google Calendar?}  & \multirow{6}{*}{\centering Notes}\\
\cline{2-3}
 & Yes & No & \\
\hline
I have an appointment at 8. &  & \checkmark  & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
\hline
Meeting at 10. &  & \checkmark  & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
\hline
Family trip on August 5 at 6. &  & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
\hline
Drink medicine at 8 o'clock. &  & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
\hline
Project defense at 8. &  & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
\hline
I have an appointment at 10 pm. & \checkmark &  & The information gets posted on Google Calendar.  \\
\hline
Meeting from 10 pm to 12 am. &  & \checkmark & The information didn't plot on the Google Calendar even if it was a time interval. It should be corrected.  \\
\hline
Project defense at 8 am. & \checkmark &  & The information gets posted on Google Calendar.  \\
\hline
Date on Friday at 7 pm. &  & \checkmark & The information didn't plot on the Google Calendar even if it is a weekday and time is mentioned. It should be corrected.  \\
\hline
Watching movies with friends at 10 o'clock in the evening. &  & \checkmark & The information didn't plot on the Google Calendar even if the information is enough. The information shown in this context must be recognized by the app and should be corrected.\\
\hline
\end{tabularx}
\label{tab:tab1}
\caption{Google Calendar's responses to different appointment--related informations.}
\end{table}

\end{document}

I don't understand where I go wrong. How do I correct this problem so that the table becomes attractive again?

  • 1
    all your long text is in the final column which is c which does not allow line breaking, perhaps make that X instead? – David Carlisle Sep 22 '18 at 15:22
  • I fully agrree with @David Carlisle suggestion about X position in the table. Is a two-column layout a requirement ? if not you should remove the option in the document class statement. – Hafid Boukhoulda Sep 22 '18 at 16:30
1

I have replaced \linewidth by \textwidth in the tabularx environment and make some other settings in the columns length.

\documentclass[a4paper,twocolumn]{article}
    \usepackage[margin=1in]{geometry}
    \usepackage{calc}
    \usepackage{amssymb}
    \usepackage{array}

    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{tabularx,ragged2e,multirow,booktabs}
    \renewcommand\tabularxcolumn[1]{C{#1}}

    \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
    \setlength\parindent{0pt}
    \begin{document}

    \begin{table}
    \sffamily\small
    \setlength{\tabcolsep}{4pt}
    \setlength{\extrarowheight}{2pt}
    \noindent
    \centering
    \begin{tabularx}{\textwidth}{|C{3cm}|C{1.5cm-\tabcolsep}|C{1.5cm-\tabcolsep}|X|}
    \hline
    \multirow{2}{=}[-.5cm]{\centering Appointment--related information} &                             \multicolumn{2}{C{3cm}|}{Did the information gets posted on the Google Calendar?}  & \multirow{2}{=}[-0.5cm]{\centering Notes}\\
    \cline{2-3}
     & Yes & No & \\
    \hline
    I have an appointment at 8. &  & \checkmark  & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
    \hline
    Meeting at 10. &  & \checkmark  & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
    \hline
    Family trip on August 5 at 6. &  & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
    \hline
    Drink medicine at 8 o'clock. &  & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
    \hline
    Project defense at 8. &  & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar.  \\
    \hline
    I have an appointment at 10 pm. & \checkmark &  & The information gets posted on Google Calendar.  \\
    \hline
    Meeting from 10 pm to 12 am. &  & \checkmark & The information didn't plot on the Google Calendar even if it was a time interval. It should be corrected.  \\
    \hline
    Project defense at 8 am. & \checkmark &  & The information gets posted on Google Calendar.  \\
    \hline
    Date on Friday at 7 pm. &  & \checkmark & The information didn't plot on the Google Calendar even if it is a weekday and time is mentioned. It should be corrected.  \\
    \hline
    Watching movies with friends at 10 o'clock in the evening. &  & \checkmark & The information didn't plot on the Google Calendar even if the information is enough. The information shown in this context must be recognized by the app and should be corrected.\\
    \hline
    \end{tabularx}
    \label{tab:tab1}
    \caption{Google Calendar's responses to different appointment--related informations.}
    \end{table}

    \end{document}

enter image description here

  • 1
    Overfull \hbox (231.48395pt too wide) in paragraph at lines 20--50 as you said in comments below the question you can only do this if you remove the twocolumn option (which is why it's always safer to use \linewidth than \textwidth) – David Carlisle Sep 22 '18 at 16:51
1

The last column should be an X column, and the font size should be \footnotesize to fit the page height. Along with some improvements, I propose another solution: using the cuted package to make the table spread over the whole text width, which allows for normal font size. You can't have floats inside cuted, so you have to use the \captionof command. Here is a code for both ways:

    \documentclass[a4paper,twocolumn]{article}%
    \usepackage[margin=1in, showframe]{geometry}
    \usepackage{calc}
    \usepackage{amssymb}
    \usepackage{array}

    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{tabularx, ragged2e, multirow, booktabs}
    \renewcommand\tabularxcolumn[1]{C{#1}}

    \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
    \setlength\parindent{0pt}

    \usepackage{cuted, caption, lipsum}
    \newcommand{\nl}{\newline}

    \begin{document}

  \begin{table}[!htb]
 \sffamily\footnotesize
 \setlength{\tabcolsep}{4pt}
 \setlength{\extrarowheight}{2pt}
 \noindent
 \centering
 %\begin{tabularx}{\linewidth}{|X|C{1cm-\tabcolsep}|C{1cm-\tabcolsep}|c|}
 \begin{tabularx}{\linewidth}{|C{22mm}|C{1cm-\tabcolsep}|C{1cm-2\tabcolsep}|X|}
 \hline
 \multirow{6}{=}{\centering Appointment-related information} & \multicolumn{2}{C{2cm}|}{Did the information get posted on the Google Calendar?} & \multirow{6}{*}{\centering Notes}\\
 \cline{2-3}
 & Yes & No & \\
 \hline
 I have an appointment\nl at 8. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
 \hline
 Meeting at 10. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
 \hline
 Family trip \nl on August 5 \nl at 6. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
 \hline
 Drink medicine \nl at 8 o'clock. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
 \hline
 Project defense\nl at 8. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
 \hline
 I have an appointment \nl at 10 pm. & \checkmark & & The information gets posted on Google Calendar. \\
 \hline
 Meeting \nl from 10 pm \nl to 12 am. & & \checkmark & The information didn't plot on the Google Calendar even if it was a time interval. It should be corrected. \\
 \hline
 Project defense \nl at 8 am. & \checkmark & & The information gets posted on Google Calendar. \\
 \hline
 Date on Friday \nl at 7 pm. & & \checkmark & The information didn't plot on the Google Calendar even if it is a weekday and time is mentioned. It should be corrected. \\
 \hline
 Watching movies \nl with friends \nl at 10 o'clock \nl in the evening. & & \checkmark & The information didn't plot on the Google Calendar even if the information is enough. The information shown in this context must be recognized by the app and should be corrected.\\
 \hline
 \end{tabularx}
 \label{tab:tab1}
 \caption{Google Calendar's responses to different appointment--related informations.}
 \end{table}

\lipsum[1-5]
\begin{strip}
    \sffamily
    \setlength{\tabcolsep}{4pt}
    \setlength{\extrarowheight}{2pt}
    \noindent
    \centering
    %\begin{tabularx}{\linewidth}{|X|C{1cm-\tabcolsep}|C{1cm-\tabcolsep}|c|}
    \begin{tabularx}{\linewidth}{|C{22mm}|C{1cm-\tabcolsep}|C{1cm-2\tabcolsep}|X|}
    \hline
    \multirow{6}{=}{\centering Appointment-related information} & \multicolumn{2}{C{2cm}|}{Did the information get posted on the Google Calendar?} & \multirow{6}{*}{\centering Notes}\\
    \cline{2-3}
     & Yes & No & \\
    \hline
    I have an appointment\nl at 8. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
    \hline
    Meeting at 10. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
    \hline
    Family trip \nl on August 5 \nl at 6. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
    \hline
    Drink medicine \nl at 8 o'clock. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
    \hline
    Project defense\nl at 8. & & \checkmark & The time is not specified whether it is am or pm, so it does not appear on Google Calendar. \\
    \hline
    I have an appointment \nl at 10 pm. & \checkmark & & The information gets posted on Google Calendar. \\
    \hline
    Meeting \nl from 10 pm \nl to 12 am. & & \checkmark & The information didn't plot on the Google Calendar even if it was a time interval. It should be corrected. \\
    \hline
    Project defense \nl at 8 am. & \checkmark & & The information gets posted on Google Calendar. \\
    \hline
    Date on Friday \nl at 7 pm. & & \checkmark & The information didn't plot on the Google Calendar even if it is a weekday and time is mentioned. It should be corrected. \\
    \hline
    Watching movies \nl with friends \nl at 10 o'clock \nl in the evening. & & \checkmark & The information didn't plot on the Google Calendar even if the information is enough. The information shown in this context must be recognized by the app and should be corrected.\\
    \hline
    \end{tabularx}
    \label{tab:tab1}
    \captionof{table}{Google Calendar's responses to different appointment--related informations.}
    \end{strip}
    \lipsum

    \end{document} 

enter image description here

  • hey...uhmm...how can I erase the the Latin inscriptions around the table? – zZ_LateX_HaterZ_zZ Sep 23 '18 at 11:16
  • @zZ_LateX_HaterZ_zZ: Do you mean removing the dummy text? Delete the two \lipsum commands. – Bernard Sep 23 '18 at 11:33

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.