1

Want to have my table enough spaces between them and words that spill over are handled. Thanks

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs,tabularx,caption}
\usepackage[table]{xcolor}

\begin{document}
  \begin{sidewaystable}
    \captionsetup{font={footnotesize}}
    \caption{Selected Ebola Epidemic Compartmental Models, Analyses and Problem Formulations with References}
    \small
    \centering
    \renewcommand\arraystretch{1.5}
    \renewcommand\tabcolsep{0.75pt}
    \begin{tabularx}{\textheight}{lll>{\raggedright}Xlc}
      \rowcolor{cyan}
      \specialrule{.2em}{.1em}{.1em}
      \textbf{Compartmental} & \textbf{Analysis} & \textbf{Problem} & \centering
      \textbf{Objective} & \textbf{Control Intervention} & \textbf{Reference}  \\
      \rowcolor{cyan}
      \textbf{Model} & & \textbf{Formulation} & & & \\
      \specialrule{.1em}{.05em}{.05em}
      SEIT & Sensitivity & Differential & \mbox{}\par\vspace{\dimexpr-\baselineskip-\topsep-\partopsep\relax}%
      \begin{itemize} \setlength{\itemsep}{-5pt}
        \item Evaluate various intervention strategies
        \item Determine model parameters by least square method
      \end{itemize} & Vaccination & Sideman et al [1] \\ [-2ex] %
    \end{tabularx}
  \end{sidewaystable}
\end{document}
  • 2
    Is there a reason why you didn't provide \usepackage statements for the rotating, caption, threeparttable, natbib, xcolor, and colortbl packages? What is to be gained by making potential answer writer wade through your code and figure out by trial and error which packages need to be loaded? – Mico Aug 19 '15 at 5:17
  • 3
    Please, fix the obvious errors, like missing packages (see Mico's comment), class name in curly braces, properly nested environments, no table inside sidewaystable, ... – Heiko Oberdiek Aug 19 '15 at 6:47
  • 2
    This still can't possibly compile for you without error: the sidewaystable environment is never closed. You need to test your code before posting the example to make sure it compiles as is. Not to mention all the other problems. Why make it difficult to help you? – cfr Aug 19 '15 at 12:48
  • I've altered your code to make it compilable. I've adapted the first line to correct the syntax of \documentclass, added required packages and changed mediumcyan to cyan throughout. However, I'm not entirely sure what you want to do with the table.... – cfr Aug 19 '15 at 12:56
  • I want some spaces between compartmental model and analysis. I also want all of my first row of text to be on the same line and straight. Finally words that spill over to the next line do not look well – user28251 Aug 19 '15 at 13:00
2

Maybe you can also reformat your table a bit, to make it fit (nearly) on a line. And in my opinion make it a bit nicer.

\documentclass{article}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\lipsum[1]

\begin{table}[h]
    \centering
    \caption{Selected Ebola Epidemic Compartmental Models, Analyses and Problem Formulations with References}
    \small
    \noindent\makebox[\textwidth]{%
        \begin{tabularx}{1.4\linewidth}{XlXXXl}
            \toprule
            Compartmental\newline Model & Analysis & Problem\newline Formulation & Objective & Control\newline Intervention & Reference \\
            \midrule
            SEIT    & Sensitivity   & Differential  & Evaluate various intervention strategies                      & Vaccination & [1] \\
                        &           &               & Determine model parameters by least square method &\\
        \end{tabularx}
    }
\end{table}

\lipsum[1]

\end{document}

Screenshot of code above

2

Don't reduce the separation between columns if you want reasonable spaces between them. You can use enumitem and a minipage to align the itemised environment with the baseline.

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs,tabularx,caption,enumitem,ragged2e}
\usepackage[table]{xcolor}

\begin{document}
  \begin{sidewaystable}
    \captionsetup{font={footnotesize}}
    \caption{Selected Ebola Epidemic Compartmental Models, Analyses and Problem Formulations with References}
    \small
    \centering
    \renewcommand\arraystretch{1.5}
    \begin{tabularx}{\textheight}{lll>{\RaggedRight}Xlc}
      \rowcolor{cyan}
      \specialrule{.2em}{.1em}{.1em}
      \textbf{Compartmental} & \textbf{Analysis} & \textbf{Problem} & \centering
      \textbf{Objective} & \textbf{Control Intervention} & \textbf{Reference}  \\
      \rowcolor{cyan}
      \textbf{Model} & & \textbf{Formulation} & & & \\
      \specialrule{.1em}{.05em}{.05em}
      SEIT & Sensitivity & Differential &
      \begin{minipage}[t]{\linewidth}\RaggedRight
        \begin{itemize}[nosep]
          \item Evaluate various intervention strategies
          \item Determine model parameters by least square method
        \end{itemize}
      \end{minipage} & Vaccination & [1] \\
    \end{tabularx}
  \end{sidewaystable}
\end{document}

adapted table

Another possibility which may result in a more balanced presentation:

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs,tabularx,caption,enumitem,ragged2e}
\usepackage[table]{xcolor}

\begin{document}
  \begin{sidewaystable}
    \captionsetup{font={footnotesize}}
    \caption{Selected Ebola Epidemic Compartmental Models, Analyses and Problem Formulations with References}
    \small
    \centering
    \renewcommand\arraystretch{1.5}
    \begin{tabularx}{\textheight}{lll>{\RaggedRight}Xlc}
      \rowcolor{cyan}
      \specialrule{.2em}{.1em}{.1em}
      \textbf{Compartmental} & \textbf{Analysis} & \textbf{Problem} & \centering
      \textbf{Objective} & \textbf{Control} & \textbf{Reference}  \\
      \rowcolor{cyan}
      \textbf{Model} & & \textbf{Formulation} & & \textbf{Intervention} & \\
      \specialrule{.1em}{.05em}{.05em}
      SEIT & Sensitivity & Differential &
      \begin{minipage}[t]{\linewidth}\RaggedRight
        \begin{itemize}[nosep]
          \item Evaluate various intervention strategies
          \item Determine model parameters by least square method
        \end{itemize}
      \end{minipage} & Vaccination & [1] \\
    \end{tabularx}
  \end{sidewaystable}
\end{document}

better balance?

  • Thanks but I want to ask one question. Can you please reduce the spaces between Evaluate various intervention strategies? – user28251 Aug 19 '15 at 13:09
  • 1
    please make the contents of your minipages ragged right. – barbara beeton Aug 19 '15 at 13:10
  • @user28251 You can use \raggedright before \begin{itemize} to make the contents flushed left rather than justified text, as barbara suggests. (I can't do this now - will try to remember later if I have time. But just put it before you start the itemize environment.) – cfr Aug 19 '15 at 18:40
  • @barbarabeeton OK ;). – cfr Aug 19 '15 at 21:00
  • @user28251 Please see edit. The first table now uses a ragged right setting (from ragged2e); the second does the same but also adjusts the penultimate column which may give better results. I think it is better here, but you'd obviously need to consider the effect on all rows in order to decide on the best layout. – cfr Aug 19 '15 at 21:02

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.