6

I am trying to typeset a hierarchical proof structure as defined by Leslie Lamport in How to Write a Proof.

enter image description here

In particular, I am trying to typeset the portion

Assume: 1. $r \in \mathbf{Q}$ 2. $r^2 = 2$ Prove: False 

by putting an enumerate in a tabular.

My current best attempt is

\documentclass{article} \begin{document} \begin{tabular}{lp{10cm}} \scshape Assume: & \begin{enumerate} \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \\ \scshape Prove: & False \end{tabular} \end{document} 

enter image description here

As you can see, there is some rather ugly extra vertical space before and after the enumerate environment. How do I get rid of this extra vertical space?

4 Answers 4

6

In case if you want to keep table:

\documentclass{article} \usepackage{enumitem} \begin{document} \begin{tabular}{lp{10cm}} \scshape Assume: & \begin{minipage}[t]{\linewidth} \begin{enumerate}[leftmargin=*,itemsep=-4pt] \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \end{minipage} \\[3ex] \scshape Prove: & False\\ \end{tabular} \end{document} 

enter image description here

4
  • Is there a way to reduce the extra vertical space between "1." and "2."? Commented Feb 28, 2014 at 0:27
  • @ILiketoCode Certainly, use itemsep. I updated the answer. Commented Feb 28, 2014 at 0:38
  • How did you know the "right" value is -4pt? Commented Feb 28, 2014 at 0:44
  • @ILiketoCode I just experimented ;). Adjust to your liking please. Commented Feb 28, 2014 at 0:44
4

I would consider doing this a little differently, and use an itemize environment instead:

\begin{itemize} \item[Assume] \begin{enumerate} \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \item[Prove] False \end{itemize} 

screenshot

You can get the scshape by loading the enumitem package:

\begin{itemize}[font=\sc] \item[Assume] \begin{enumerate} \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \item[Prove] False \end{itemize} 

screenshot

Using an itemize environment is beneficial because it will allow page breaks; a tabular environment wraps things firmly in a box.

Here's a complete MWE.

% arara: pdflatex % !arara: indent: {overwrite: yes} \documentclass{article} \usepackage{enumitem} \begin{document} \begin{itemize} \item[Assume] \begin{enumerate} \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \item[Prove] False \end{itemize} \begin{itemize}[font=\sc] \item[Assume] \begin{enumerate} \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \item[Prove] False \end{itemize} \end{document} 
3
  • 1
    I think the "Prove" and "Assume" should be left aligned. Commented Feb 27, 2014 at 23:52
  • Indeed, I want "Assume" and "Prove" to be left-aligned as in Lamport's document. Commented Feb 28, 2014 at 0:23
  • 1
    @ILiketoCode You can just add align=left to the options passed to the list environment. Commented Feb 28, 2014 at 0:49
3

Yet another version with enumitem:

enter image description here

Code:

\documentclass{article} \usepackage{enumitem} \begin{document} \noindent some text before \begin{description}[font=\normalfont\scshape,nosep,labelwidth=45pt,leftmargin=\dimexpr\labelwidth+\labelsep] \item[Assume:] \begin{enumerate}[leftmargin=*,nosep] \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \end{enumerate} \item[Prove:] False \end{description} \end{document} 
1

This is a variation on cmhughes's solution. It uses description and enumerate with enumitem to define two new lists and some new commands to keep things consistent.

Anyway, the idea was to provide the following new commands:

\mythm \myproofsketch \myassume \myprove 

for starting the various parts of the proof. And the following environments:

mytheorem 

to contain the whole thing and to list the assumptions with enumeration, respectively.

\documentclass{article} \usepackage{enumitem} \newlength{\mylstindent} \settowidth\mylstindent{\bfseries Theorem} \newlist{mytheoremlst}{description}{1} \setlist[mytheoremlst]{leftmargin=0pt,itemindent=\mylstindent,style=sameline,font={\normalfont\textsc},noitemsep} \newlist{myassumptions}{enumerate}{1} \setlist[myassumptions]{nosep,label=\arabic*.,align=left,itemindent=\mylstindent,before={\hspace*{-\mylstindent}\vspace*{-1.2em}}} \newcommand*{\myproofsketch}{% \vskip 5pt \item[Proof Sketch:]} \newcommand*{\myassume}{\item[Assume:]\begin{myassumptions}} \newcommand*{\myprove}{\end{myassumptions}\item[Prove:]} \newcommand*{\mythm}{\item[\normalfont\bfseries Theorem]} \newenvironment{mytheorem}{% \begin{mytheoremlst}% }% {\end{mytheoremlst}% } \begin{document} \begin{mytheorem} \mythm There does not exist $r$ in $\mathbf{Q}$ such that $r^2=2$. \myproofsketch We assume $r^2=2$ for $r \in \mathbf{Q}$ and argue to a \emph{reductio}. Writing $r=\frac{a}{b}$ where the HCD of $a$ and $b$ is $1$, we deduce from $\frac{m}{n}^2=2$\dots \myassume% \item $r \in \mathbf{Q}$ \item $r^2 = 2$ \myprove False \end{mytheorem} \end{document} 

Produces:

Theorem layout with new commands

Can anybody suggest a better way of setting up myassumption to get the first assumption aligned vertically with 'Assume:' without losing the horizontal alignment with the second assumption? This is somewhat of a hack and likely fragile...

1
  • +1 This is interesting, as it moves one step further towards automating the hierarchical proof structure by Lamport by defining new environments and commands. Commented Feb 28, 2014 at 14:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.