3

The following tables gives me unequal length for the row "Tower". WIll you guys please suggest me such that the column is divided exactly in the centre?

\begin{landscape}
\begin{table}{Variable Timeslots}
\centering
\caption{Observe that the length of one timeslot here is 30 min. Attractions "Tower" takes one timeslot whereas other attractions take two timeslots to complete.}
\label{tab:VariableTimeslot}
    \begin{tabular}{ | c | c | p{0.5cm} | c | c | c | c | c | c | c | c | c | c | c |}
    \hline 
    TIME & \multicolumn{2}{|c|}{09:00-10:00} & \multicolumn{2}{|c|}{10:00-11:00} & \multicolumn{2}{|c|}{11:00-12:00} & \multicolumn{2}{|c|}{13:00-14:00} & \multicolumn{2}{|c|}{14:00-15:00} & \multicolumn{2}{|c|}{15:00-16:00} \\ 
    \hline  \centering TIMESLOT & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
    \hline  PAVILION TOUR (10) & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} \\ 
    \hline TOWER (12) & & & & & & & & & & & & \\ 
    \hline  GIANT WHEEL (40) & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} &\multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} \\
    \hline  WATER RIDE (40) & \multicolumn{2}{|c|}{}& \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} &  \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} \\
    \hline  TRAIN RIDE (30) & \multicolumn{2}{|c|}{}& \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{}  & \multicolumn{2}{|c|}{}&\multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{}\\ 
    \hline 
    \end{tabular}
\end{table}
\end{landscape}
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Mar 20 '15 at 13:01
  • Your problem is that the time range is bigger than both cells below. That is shifting everything to the left. – LaRiFaRi Mar 20 '15 at 13:03
2

All your \multicolumn{2}{|c|}... are wrong, they should be \multicolumn{2}{c|}.... Moreover, use fixed-width columns to avoid your problem and add >{\centering\arraybackslash} to the p columns to have centered contents.

\documentclass{article}

\usepackage{array,pdflscape}


\begin{document}
\begin{landscape}
\begin{table}
\centering
Variable Timeslots
\caption{Observe that the length of one timeslot here is 30 min. Attractions "Tower" takes one timeslot whereas other attractions take two timeslots to complete.}
\label{tab:VariableTimeslot}
    \begin{tabular}{ | c | *{12}{>{\centering\arraybackslash}p{0.8cm} |}}
    \hline
    TIME & \multicolumn{2}{c|}{09:00-10:00} & \multicolumn{2}{c|}{10:00-11:00} & \multicolumn{2}{c|}{11:00-12:00} & \multicolumn{2}{c|}{13:00-14:00} & \multicolumn{2}{c|}{14:00-15:00} & \multicolumn{2}{c|}{15:00-16:00} \\
    \hline  TIMESLOT & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
    \hline  PAVILION TOUR (10) & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\
    \hline TOWER (12) & & & & & & & & & & & & \\
    \hline  GIANT WHEEL (40) & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} &\multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\
    \hline  WATER RIDE (40) & \multicolumn{2}{c|}{}& \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} &  \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\
    \hline  TRAIN RIDE (30) & \multicolumn{2}{c|}{}& \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{}  & \multicolumn{2}{c|}{}&\multicolumn{2}{c|}{} & \multicolumn{2}{c|}{}\\
    \hline
    \end{tabular}
\end{table}
\end{landscape}
\end{document} 

enter image description here

As a side note, the table environment doesn't take any mandatory argument.

1

A solution with tabularx and the caption package:

\documentclass[12pt,leqno]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{tabularx, caption}
\usepackage{lscape}

\begin{document}
\begin{landscape}
    \begin{table}%
    \captionsetup{justification = centerfirst}
    \caption{Variable Timeslots \smallskip\\\footnotesize
    Observe that the length of one timeslot here is 30 min. Attractions "Tower" takes one timeslot whereas other attractions take two timeslots to complete.}
    \label{tab:VariableTimeslot}
    \begin{tabularx}{\linewidth}{ | c | *{12}{>{\centering\arraybackslash}X|}}
        \hline
        TIME & \multicolumn{2}{|c|}{09:00--10:00} & \multicolumn{2}{|c|}{10:00--11:00} & \multicolumn{2}{|c|}{11:00--12:00} & \multicolumn{2}{|c|}{13:00--14:00} & \multicolumn{2}{|c|}{14:00--15:00} & \multicolumn{2}{|c|}{15:00--16:00} \\
        \hline \centering TIMESLOT & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
        \hline PAVILION TOUR (10) & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} \\
      \hline TOWER (12) & & & & & & & & & & & & \\
        \hline GIANT WHEEL (40) & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} &\multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} \\
        \hline WATER RIDE (40) & \multicolumn{2}{|c|}{}& \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} \\
        \hline TRAIN RIDE (30) & \multicolumn{2}{|c|}{}& \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{}&\multicolumn{2}{|c|}{} & \multicolumn{2}{|c|}{}\\
        \hline
    \end{tabularx}
    \end{table}
\end{landscape}
\end{document} 

enter image description here

0

A solution with centred m-columns:

% arara: pdflatex

\documentclass{article}
\usepackage{lscape}
\usepackage{caption}
\usepackage{calc}
\usepackage{csquotes}
\usepackage{siunitx}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\newlength{\mylength}

\begin{document}
\setlength{\mylength}{\widthof{09:00-10:00}+1.5\columnsep}
\begin{landscape}
    \begin{table}
        \centering
        \caption{Observe that the length of one timeslot here is \SI{30}{\min}. Attractions \enquote{Tower} takes one timeslot whereas other attractions take two timeslots to complete.}
        \label{tab:VariableTimeslot}
        \begin{tabular}{ | l | *{13}{@{}C{.5\mylength}@{}|}}
            \hline 
            TIME & \multicolumn{2}{c|}{09:00-10:00} & \multicolumn{2}{c|}{10:00-11:00} & \multicolumn{2}{c|}{11:00-12:00} & \multicolumn{2}{c|}{13:00-14:00} & \multicolumn{2}{c|}{14:00-15:00} & \multicolumn{2}{c|}{15:00-16:00} \\ 
            \hline  
            TIMESLOT & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
            \hline  PAVILION TOUR (10) & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\ 
            \hline TOWER (12) & & & & & & & & & & & & \\ 
            \hline  GIANT WHEEL (40) & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} &\multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\
            \hline  WATER RIDE (40) & \multicolumn{2}{c|}{}& \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} &  \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} \\
            \hline  TRAIN RIDE (30) & \multicolumn{2}{c|}{}& \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{}  & \multicolumn{2}{c|}{}&\multicolumn{2}{c|}{} & \multicolumn{2}{c|}{}\\ 
            \hline 
        \end{tabular}
    \end{table}
\end{landscape}
\end{document}

enter image description here

  • \setlength, not \settowidth... – karlkoeller Mar 20 '15 at 13:31
0

There is an example how to create this table using normal TeX without LaTeX complications:

\vbox{\offinterlineskip
   \def\crl{\crcr\noalign{\hrule}}
   \def\rl{\hfil\vrule\hfil\null} \def\nn{&&&&&&} \def\ce#1{\hbox to0pt{\hss#1\hss}}
   \halign{\vrule height12pt depth5pt\hfil\ #\unskip\ \hfil\vrule
           &&\hfil\ #\unskip\ \hfil\vrule\cr\crl
      TIME & 09:00--10:00 & 10:00--11:00 & 11:00--12:00 & 
             13:00--14:00 & 14:00--15:00 & 15:00--16:00 \crl
      TIMESLOT          & 1\rl2 & 3\rl4 & 5\rl6 & 7\rl8 & \ce9\rl\ce{10} & 11\rl12 \crl
      PAVILON TOUR (10) \nn \crl
      TOWER (12)        & \rl & \rl & \rl & \rl & \rl & \rl \crl
      GIANT WHEEL (40)  \nn \crl
      WATER RIDE (40)   \nn \crl
      TRAIN RIDE (30)   \nn \crl
}}

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.