Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debug this?

0 views
Skip to first unread message

Michael Covington

unread,
Jun 15, 1997, 3:00:00 AM6/15/97
to

Greetings,

At the request of a colleague I'm trying to create an environment
for presenting natural deductive logic proofs, like this:

Line 1
| Line 2.1
| | Line 2.2.1
| | Line 2.2.2
| Line 2.3
Line 3

The vertical bars show the scope of various "subproofs".

The following code *almost* does the job, but I'm getting less than
normal line spacing at \end{subproof}. Does anyone happen to know why?

Many thanks.
--
Michael A. Covington, Ph.D. http://www.ai.uga.edu/faculty/covington/
Associate Director, Artificial Intelligence Center and
Chairman, Computer Security Incident Handling Team
The University of Georgia, Athens, GA 30602-7415 U.S.A.

\documentstyle{article}

% An attempt to create an environment for natural deduction
% proofs, where vertical lines show the scope of each section
% of the proof.

% Why is there less than normal line spacing at \end{subproof} ?

\newenvironment{subproof}%
{\addtolength{\textwidth}{-3ex}
\vrule~~\begin{minipage}[t]{\textwidth}\raggedright\obeylines}%
{\end{minipage}}

\newenvironment{proof}%
{\begin{minipage}[t]{\textwidth}\raggedright\obeylines}%
{\end{minipage}}

\begin{document}

\begin{proof}
This is step 1.
\begin{subproof}
This is step 2.1.
This is step 2.2.
\begin{subproof}
This is step 2.3.1.
This is step 2.3.2.
\end{subproof}
This is step 2.4.
\end{subproof}
This is step 3.
\end{proof}

\end{document}

Dewey Yin

unread,
Jun 17, 1997, 3:00:00 AM6/17/97
to

Michael Covington <mcov...@aisun1.ai.uga.edu> wrote:

>At the request of a colleague I'm trying to create an environment
>for presenting natural deductive logic proofs, like this:
>
> Line 1
> | Line 2.1
> | | Line 2.2.1
> | | Line 2.2.2
> | Line 2.3
> Line 3
>
>The vertical bars show the scope of various "subproofs".
>
>The following code *almost* does the job, but I'm getting less than
>normal line spacing at \end{subproof}. Does anyone happen to know why?
>

> [code deleted]

Since the depths of the top-aligned minipages are too deep (larger than
\maxdepth), TeX doesn't use \baselineskip to position the baseline of the line
of text immediately following the minipage (the distance between the baselines
of the last line in the minipage and the first line after the minipage is not
necessarily \baselineskip). Instead, TeX just glues the top of hbox of the
first line of text after the minipage directly to the bottom of the minipage
(except for a little space of up to 1pt added in between, as defined by some
TeX primitive whose name I can't remember--don't have my TeXbook with me...).

One solution is to ensure that the last line in the minipage has sufficient
depth and that the first line after has sufficient height so that when the
two boxes are glued together, the lines are separated by exactly \baselineskip.
This can be done by making use of \strut's.

In the following, I defined \myobeylines to add a \strut to every line of
text. Two avoid unwanted blank lines around the minipage, the \strut in the
first line in the minipage comes after the first \par, and subsequent \strut's
come at the end of lines before \par. The first line of text after the proof
environment also needs a \strut, so one is added in the definition right after
\end{minipage}.

If your LaTeX complains about \ignorespacesafterend, then your LaTeX is a
little old. You can change the \ignorespacesafterend to \ignorespaces, but
you will need to put a % immediately after each \end{proof}, otherwise a
spurious space gets into the text. (I noticed you use \documentstyle--are
you using LaTeX 2.09? I changed that line to \documentclass for LaTeX2e.)
I also changed your use of \textwidth to \hsize, and the spacing after the
\vrule to account for the rule width of 0.4pt and the indention of 1em.

Dewey Yin

\documentclass{article}

\begingroup
\catcode`\^^M\active
\gdef\myobeylines{\catcode`\^^M\active\def^^M{\par\strut\def^^M{\strut\par}}}
\endgroup

\newenvironment{proof}%
{\\\noindent\begin{minipage}[t]{\hsize}\raggedright\myobeylines}%
{\end{minipage}\\\strut\ignorespacesafterend}

\newenvironment{subproof}%
{\addtolength{\hsize}{-1em}%
\vrule\kern-0.4pt\kern1em\begin{minipage}[t]{\hsize}\raggedright\myobeylines}%
{\end{minipage}}

\begin{document}
Hello.


\begin{proof}
This is step 1.
\begin{subproof}
This is step 2.1.
This is step 2.2.
\begin{subproof}
This is step 2.3.1.
This is step 2.3.2.
\end{subproof}
This is step 2.4.
\end{subproof}
This is step 3.
\end{proof}

Good-bye.
\end{document}

0 new messages