I'm trying to make a table in TabularX to help kids understand fraction and decimal conversions.
Questions:
(1) How do I fix the vertical alignment of the bottom right merged cell?
(2) Is there an easy way to space the five columns evenly?
(3) I used the \paddingtop thing to create space between the cell content and the horizontal rules as recommended in an earlier thread of mine. Is there an easier way to space the content from the horizontal rules? Ideally one that doesn't make the vertical rules extend a bit too far "into" the merged cell.
\documentclass{article}
\usepackage[left=1.5cm,right=1.5cm,top=2cm,bottom=2cm]{geometry}
\usepackage{lscape}
\usepackage{tikz}
\usepackage{tabularx}
% Will be my standard column with all contents centered horizontally and vertically.
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
% redefines the final X column as vertically centered.
\renewcommand*{\tabularxcolumn}[1]{m{#1}}
% Not sure what this does
\usepackage{cellspace}
\setlength\cellspacetoplimit{20pt}
\setlength\cellspacebottomlimit{4pt}
% Not sure what this does
\addparagraphcolumntypes{X}
% The insanely complex stuff for creating the paddingtop part.
I would love a simpler way of doing this.
\makeatletter
\newsavebox\saved@arstrutbox
\newcommand*{\setarstrut}[1]{%
\noalign{%
\begingroup
\global\setbox\saved@arstrutbox\copy\@arstrutbox
\global\setbox\@arstrutbox\hbox{%
\vrule \@height #1
\@depth 0cm
\@width\z@
}%
\endgroup
}%
}
\newcommand*{\restorearstrut}{%
\noalign{%
\global\setbox\@arstrutbox\copy\saved@arstrutbox
}%
}
\makeatother
% New command to add an extra custom padding at the top of a row.
% Basically, it adds an empty row with the height value defined in the command.
% \paddingtop{height}{content, i.e. ampersands}
\newcommand{\paddingtop}[2]{\setarstrut{#1} #2 \\ \restorearstrut}
% MACRO for basic number line with whole numbers underneath and fractional tick marks. Must be *inside* a tikz environment
\newcommand{\NL}[2] %{xmax}{denom}
{
\draw (0,0)--(#1,0);
\pgfmathparse{#1*#2}
\foreach \x in {0,...,\pgfmathresult}
\draw (\x/#2,-0.2)--(\x/#2,0.2);
\foreach \x in {0,...,#1}
\node[anchor=mid] at (\x,-0.65) {\x};
}
\newcommand{\decimaltable}
{
\begin{tabularx}{23cm}{*4{|C{4.2cm}}|X|} \hline
\paddingtop{0.2cm}{&&&&}
Decimal(s) \vspace{2.5cm} & Mixed Number(s) \vspace{2.5cm} & Hundredths Only \vspace{2.5cm} & Tenths \& Hundredths \vspace{2.5cm} & Other Denominators \vspace{2.5cm}\\ \hline
\paddingtop{0.2cm}{&&&&}
Price \vspace{2.5cm} & As few L, D and P as possible. \vspace{2.5cm} & \multicolumn{3}{c|}{Other Coin Denominations}\\ \hline
\end{tabularx}
}
\begin{document}
\begin{landscape}
\decimaltable
\end{landscape}
\end{document}

\extrarowheight{10pt}of blank space to the top of every cell? – WeCanLearnAnything Jan 23 '16 at 00:14tabularxpakcage. That's one of the reasons I'm usingtabularxnow. Arearrayandtabularxcompatible? – WeCanLearnAnything Jan 23 '16 at 00:49tabularxis implemented usingarray– David Carlisle Jan 23 '16 at 09:42