I have this idea to create a piece of code that would allow me for a handy introduction of arguments in my notes for students, by which I mean this kind of fractional notation:
I need a command that would adjust the horizontal line by measuring premises and conclusion, and would add 0.5em (or whatever) on each side beyond the sentences. Using ifthen
package I came up with this very imperfect (to put it mildly) three-argument \inference
command:
\newlength{\premiseone}
\newlength{\premisetwo}
\newlength{\conclusion}
\newcommand{\argument}[3]{%
\settowidth{\premiseone}{#1}
\settowidth{\premisetwo}{#2}
\settowidth{\conclusion}{#3}
\addtolength{\premiseone}{1em}
\addtolength{\premisetwo}{1em}
\addtolength{\conclusion}{1em}
\ifthenelse{\lengthtest{\premiseone > \premisetwo}}%
{\ifthenelse{\lengthtest{\premiseone > \conclusion}}%
{\dfrac{\parbox{\premiseone}{\center #1\\#2}}{\mbox{#3}}}%
{\dfrac{\parbox{\conclusion}{\center #1\\#2}}{\mbox{#3}}}%
}
It is specifically designed for arguments with exactly two premises and has rather unwelcome features because of it. For example, if I write, e.g., \argument{the only premise}{}{the consequence}
, LaTeX complains that there is no line to end, and If I add some empty box I have this unwanted additional space, either above the argument or inside it:
Here are my questions to you:
- How could I get round the problem of additional spaces? That is, how could I skip some arguments by writing
\argument{the only premise}{}{the consequence}
without obtaining this additional vertical space (either above or inside)? - Is there any relatively easy way to build a command which would not be designed for a specific number of premises, but would work in a similar way as mine yet for any finite number of premises? Of course, I could always build
\argumentone
,\arguemtttwo
,\argumentthree
, but this is going round the houses.
tabular
? – campa May 14 '20 at 17:45