While creating a quiz, I needed to format logical arguments, which our textbook presents as a list of premises, one per line, then a horizontal rule as wide as the widest premise, and the conclusion underneath. There should not be too much space around the rule (it does not take up a line of its own.)
I dealt with this by using the pbox
package (I have version 1.2.) I put the premises and conclusion in a pbox, with an \hrule
before the conclusion. Since the \pbox
was the width of the widest line, the \hrule
was also the right width. Here is a minimal example.
\documentclass{minimal}
\usepackage{pbox}
\begin{document}
\pbox{8cm}{
Either you love logic or you hate it. \\
You don't hate logic.
\smallskip\hrule\smallskip
You love logic.}
\end{document}
This works fine, actually, except that it produces an error: You can't use `\hrule' here except with leaders.
After pressing enter to ignore the error, it is output exactly as I would hope, except that having to press enter 9 times each time I compile my document is not very nice. The quiz looks like this:
This raises a 4-fold question:
- What is the reason for the error, which only seems to arise in a
\pbox
? I would love an explanation of the TeXnical underpinnings. - How should one draw a horizontal line across a
\pbox
without error? I found that\hrulefill
works, but needs its own line. Is there a more elegant way than\\[-.7em] \null\hrulefill\\[-.2em]
, which has the disadvantage of fiddly spacing (liable to break down, and only approximating the spacing of\smallskip\hrule\smallskip
, which I liked)? - Is there a way to use
\leaders
, as suggested by the error, to maintain the same output produced by\hrule
but without the error? - What's the proper way to achieve my desired result?
I suppose the obvious method is with a
tabular
environment, but this does not seem semantically correct to me. A succession of statements, with a line underneath, is not a table! Also, the line does not fit the width quite as nicely as it does in a\pbox
, though I'm sure that can be fixed with fiddling.