I want to define a new command to add vertical "padding" before and after the content of a table cell. I'm stealing the idea of using rules/struts from the accepted answer to this question.
My concept is something like
\newcommand{\vpad}[2]{
\rule{0pt}{\baselineskip + #1} % top padding
\rule[-0.4*\baselineskip - #2]{0pt}{0pt}} % bottom padding
I know that there are many cases where this won't work, but that's not the issue, at present. My question is about the arithmetic expressions involving \baselineskip
and the command arguments. Clearly I don't have the syntax correct. So, what is the right syntax for this sort of thing?
Edit
I'm starting to think that things like 0.4*baselineskip - #2
are not allowed. If so, maybe I have to settle for '-4pt - #2'. Is negation allowed?
cellspace
. Do you want to reinvent the wheel? :o)\rule{1pt}{\dimexpr\baselineskip+#1\relax}
. But you also can load thebigstrut
package, or the\setcellgapes{xx}\makegapedcells
command frommakecell
.\rule[-\dimexpr 0.4\baselineskip+#2\relax]{0pt}{0pt}