1

I have

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{colortbl}
\usepackage{array, makecell, caption}
\definecolor{gray1}{RGB}{238,236,225}
\definecolor{gray2}{RGB}{224,224,224}
\definecolor{oran1}{RGB}{255,192,0}
\definecolor{yelw1}{RGB}{255,227,111}
\definecolor{blue1}{RGB}{197,217,241}
\definecolor{gree1}{RGB}{196,215,155}
\definecolor{crea1}{RGB}{252,245,238}
\definecolor{pink1}{RGB}{218,150,148}

\usepackage{tabulary}

\newcommand{\Poor}{\cellcolor{oran1} Poor}
\newcommand{\Fair}{\cellcolor{yelw1} Fair}
\newcommand{\Excellent}{\cellcolor{gree1} Excellent}
\newcommand{\Good}[1]{\cellcolor{blue1} Good #1}

\usepackage{rotating}

\begin{document}

\begin{sidewaystable}
\begin{center}
  \begin{tabulary}{0.9\textwidth}{LRRRRRRR}
    \rowcolor{gray1}
                  & Matlab  & SciPy  & deSolve & DifferentialEquations.jl & Sundials & Hairer &
    ODEPACK / Netlib / NAG \\
    \rowcolor{gray1}
    Language      & Matlab  & Python & R       & Julia                    & C++ and Fortran & Fortran &
    Fortran \\
    \hline
    Selection of Methods for ODEs & \Fair & \Poor & \Poor & \Excellent &
    \Good{(including ARKCODE)} & \Good & \Good \\
    Efficiency\footnote{whatever} & \Poor & \Poor & \Poor & \Excellent &
    \Good{(including ARKCODE)} & \Good & \Good \\
  \end{tabulary}  
\end{center}
\end{sidewaystable}

\end{document} 

Why does Python become Pytho, deSolveR get squished and why do I get two footnotes even though I specified one?

Output

2 Answers2

1

Some comments and observations:

  • Some of the columns don't need any automatic line-wrapping; I suggest you use the basic r style for them.

  • Inform LaTeX where a permissible linebreak is by writing Differential\-Equations.jl.

  • Use a threeparttable environment to generate well-aligned table footnotes.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{array, caption}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textit}

\definecolor{gray1}{RGB}{238,236,225}
\definecolor{gray2}{RGB}{224,224,224}
\definecolor{oran1}{RGB}{255,192,0}
\definecolor{yelw1}{RGB}{255,227,111}
\definecolor{blue1}{RGB}{197,217,241}
\definecolor{gree1}{RGB}{196,215,155}
\definecolor{crea1}{RGB}{252,245,238}
\definecolor{pink1}{RGB}{218,150,148}

\usepackage{tabularx,ragged2e}
\newcolumntype{R}{>{\RaggedLeft\arraybackslash\hspace{0pt}}X}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}

\newcommand{\Poor}{\cellcolor{oran1} Poor}
\newcommand{\Fair}{\cellcolor{yelw1} Fair}
\newcommand{\Excellent}{\cellcolor{gree1} Excellent}
\newcommand{\Good}[1]{\cellcolor{blue1} Good #1}

\usepackage{rotating}

\begin{document}

\begin{sidewaystable}
\setlength\extrarowheight{3pt}
\centering
\begin{threeparttable}
  \begin{tabularx}{0.9\textwidth}{LrrrRRrR}
  \hline
    \rowcolor{gray1}
    & Matlab  & SciPy  & deSolve 
    & Differential\-Equations.jl 
    & Sundials & Hairer 
    & ODEPACK\slash Netlib\slash NAG \\
    \rowcolor{gray1}
    Language & Matlab  & Python & R & Julia  
    & C++ and Fortran & Fortran & Fortran \\
    %\hline
    Selection of Methods for ODEs & \Fair & \Poor & \Poor & \Excellent &
    \Good{(incl. ARKCODE)} & \Good & \Good \\
    Efficiency\tnote{a} & \Poor & \Poor & \Poor & \Excellent &
    \Good{(incl. ARKCODE)} & \Good & \Good \\
  \hline
  \end{tabularx}  

  \medskip
  \begin{tablenotes}
  \item[a] Whatever.
  \end{tablenotes}
  \end{threeparttable}
\end{sidewaystable}

\end{document} 

Addendum: Instead of setting the contents of the 7 data columns flush-right ( as is done in your code and in the answer above), it may be better to typeset the columns centered.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{array, caption}
\usepackage[flushleft]{threeparttable}
\renewcommand\TPTtagStyle{\textit}

\definecolor{gray1}{RGB}{238,236,225}
\definecolor{gray2}{RGB}{224,224,224}
\definecolor{oran1}{RGB}{255,192,0}
\definecolor{yelw1}{RGB}{255,227,111}
\definecolor{blue1}{RGB}{197,217,241}
\definecolor{gree1}{RGB}{196,215,155}
\definecolor{crea1}{RGB}{252,245,238}
\definecolor{pink1}{RGB}{218,150,148}

\usepackage{tabularx,ragged2e}
\newcolumntype{C}{>{\Centering\arraybackslash%
    \hspace{0pt}\hsize=0.9\hsize}X}
\newcolumntype{L}{>{\RaggedRight\arraybackslash%
    \hspace{0pt}\hsize=1.3\hsize}X}


\newcommand{\Poor}{\cellcolor{oran1} Poor}
\newcommand{\Fair}{\cellcolor{yelw1} Fair}
\newcommand{\Excellent}{\cellcolor{gree1} Excellent}
\newcommand{\Good}[1]{\cellcolor{blue1} Good #1}

\usepackage{rotating}

\begin{document}

\begin{sidewaystable}
\setlength\extrarowheight{3pt}
\setlength\tabcolsep{4pt}
\centering
\begin{threeparttable}
\begin{tabularx}{0.9\textwidth}{ L cccCCcC }
    \hline
    \rowcolor{gray1}
    & Matlab  & SciPy  & deSolve & Differential\-Equations.jl 
    & Sundials & Hairer & ODEPACK\slash Netlib\slash NAG \\
    \rowcolor{gray1}
    Language & Matlab  & Python & R & Julia  
             & C++ and Fortran & Fortran & Fortran \\
    %\hline
    Selection of Methods for ODEs 
         & \Fair & \Poor & \Poor & \Excellent 
         & \Good{(incl. ARKCODE)} & \Good & \Good \\
    Efficiency\tnote{a} 
         & \Poor & \Poor & \Poor & \Excellent 
         & \Good{(incl. ARKCODE)} & \Good & \Good \\
   \hline
\end{tabularx}  

\smallskip
\begin{tablenotes}
  \item[a] Whatever.
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}

\end{document} 
Mico
  • 506,678
1

Seems that tabulary is using it's contents two times and thus printing two footnotes instead of one. Solution add this in your preamble:

\newcounter{mucounter}
\def\myuseonce#1{\ifnum\value{mucounter}=0\stepcounter{mucounter}\else#1\setcounter{mucounter}{0}\fi}

and use the footnote like:

\myuseonce{\footnote{Something}}

The second problem I found is that you used \textwidth but needed \textheight at least at your MWE.

Also I don't use often tabulary , but you have to set a minimum width to make titles break using "good" widths. This can be done with seting \tymin length.

Code:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{colortbl}
\usepackage{array, makecell, caption}
\definecolor{gray1}{RGB}{238,236,225}
\definecolor{gray2}{RGB}{224,224,224}
\definecolor{oran1}{RGB}{255,192,0}
\definecolor{yelw1}{RGB}{255,227,111}
\definecolor{blue1}{RGB}{197,217,241}
\definecolor{gree1}{RGB}{196,215,155}
\definecolor{crea1}{RGB}{252,245,238}
\definecolor{pink1}{RGB}{218,150,148}

\usepackage{tabulary}

\newcommand{\Poor}{\cellcolor{oran1} Poor}
\newcommand{\Fair}{\cellcolor{yelw1} Fair}
\newcommand{\Excellent}{\cellcolor{gree1} Excellent}
\newcommand{\Good}[1]{\cellcolor{blue1} Good #1}

\usepackage{rotating}

%ADDED for the footnote problem
\newcounter{mucounter}
\def\myuseonce#1{\ifnum\value{mucounter}<1\stepcounter{mucounter}\else#1\setcounter{mucounter}{0}\fi}

\begin{document}


\begin{sidewaystable}
  \centering
  %Selected the minimum text to adjust the minimum tcell width
  \settowidth\tymin{Equations}
  \begin{tabulary}{0.9\textwidth}{m{3.6cm}RRRRRRR}
    \rowcolor{gray1}
                  & Matlab  & SciPy  & deSolveR & Differential\-Equations.jl & Sundials & Hairer &
    ODEPACK / Netlib / NAG \\
    \rowcolor{gray1}
    Language      & Matlab  & Python & R       & Julia                    & \mbox{C++ and} \mbox{Fortran} & Fortran &
    Fortran \\
    \hline
    Selection of Methods for ODEs & \Fair & \Poor & \Poor & \Excellent &
    \Good{(including ARKCODE)} & \Good & \Good \\
    Efficiency\myuseonce{\footnote{whatever}} & \Poor & \Poor & \Poor & \Excellent &
    \Good{(including ARKCODE)} & \Good & \Good \\
  \end{tabulary}  
\end{sidewaystable}
\end{document}

Output:

enter image description here

PS: ignore \textheight (make it \textwidth) if you already rotated the pdf page in your real code

koleygr
  • 20,105