Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

4 Answers 4

up vote 10 down vote accepted

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

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

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}
share|improve this answer
1  
I think the "Prove" and "Assume" should be left aligned. –  Peter Grill Feb 27 at 23:52
    
Indeed, I want "Assume" and "Prove" to be left-aligned as in Lamport's document. –  I Like to Code Feb 28 at 0:23
1  
@ILiketoCode You can just add align=left to the options passed to the list environment. –  cfr Feb 28 at 0:49

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} 
share|improve this answer

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...

share|improve this answer
    
+1 This is interesting, as it moves one step further towards automating the hierarchical proof structure by Lamport by defining new environments and commands. –  I Like to Code Feb 28 at 14:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.