2

From this answer, I have:

\documentclass{standalone}

\usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{cellspace}
\setlength\cellspacetoplimit{2ex}
\setlength\cellspacebottomlimit{2ex}


\begin{document}

\begin{tabular}{L{0.5in}L{0.5in}Sl}
test & test & test \\
test & test & test \\
test & test & test
\end{tabular}

\end{document}

Which gives me my stretched rows and two fixed-width left columns:

enter image description here

Why fixing the width of the last column breaks it?

\documentclass{standalone}

\usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{cellspace}
\setlength\cellspacetoplimit{2ex}
\setlength\cellspacebottomlimit{2ex}


\begin{document}

\begin{tabular}{L{0.5in}L{0.5in}L{0.5in}}
test & test & test \\
test & test & test \\
test & test & test
\end{tabular}

\end{document}

enter image description here

blackened
  • 4,181

1 Answers1

5

To quote from the cellspace manual:

To improve the spacing of your tables, you must change the table preamble and prepend S to the column types l,c,r. The same holds for the paragraph columns p, m, and b, except that they must be surrounded by an extra pair of braces.

The following MWE contains two possibilities that follow this rule either by locally using S in the column definition or by including it in a global definition of he new column type M:

\documentclass{standalone}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{M}[1]{S{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}}

\usepackage{cellspace}
\setlength\cellspacetoplimit{2ex}
\setlength\cellspacebottomlimit{2ex}


\begin{document}

\begin{tabular}{S{L{0.5in}}S{L{0.5in}}S{L{0.5in}}}
test & test & test \\
test & test & test \\
test & test & test
\end{tabular}

\begin{tabular}{M{0.5in}M{0.5in}M{0.5in}}
test & test & test \\
test & test & test \\
test & test & test
\end{tabular}

\end{document}
leandriis
  • 62,593