Math & Scienceline-by-line annotation for proofs?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
decitrig
Posts: 5
Joined: Thu Nov 26, 2009 7:16 pm

line-by-line annotation for proofs?

Post by decitrig »

I'm looking for some way to annotate proofs line by line, as in the following:

statement = statement by theorem blah
= manipulated statement by this property
< something else by definition

etc (note, the equals and the "by"s should be aligned). Are tables the best way to do this, or is there an environment for this? If tables are the solution, I would love it if people could post some snippets of how to do this in a clean-looking way.

--
decitrig

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

line-by-line annotation for proofs?

Post by localghost »

If the text represents math expressions, use the align environment from amsmath. However, be a bit more specific on what you want to do.

There's a reply that still awaits your reaction [1]. It is a matter of politeness to give feedback on provided solutions.

[1] View topic: Specify shorter author name for in-text citations?


Best regards
Thorsten
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

line-by-line annotation for proofs?

Post by gmedina »

Hi,

another option could be the alignat environment provided by amsmath:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat}{2}
A\cup(B\cap C) &= (A\cup B)\cap (A\cup C) &\quad &\text{by distributive law.}\\
&= (B\cup A)\cap (C\cup A) &&\text{by commutative law.}\\
&= (B\cap C)\cup A &&\text{by distributive law.}\\
\end{alignat}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
decitrig
Posts: 5
Joined: Thu Nov 26, 2009 7:16 pm

line-by-line annotation for proofs?

Post by decitrig »

localghost wrote:If the text represents math expressions, use the align environment from amsmath. However, be a bit more specific on what you want to do.

There's a reply that still awaits your reaction [1]. It is a matter of politeness to give feedback on provided solutions.

[1] View topic: Specify shorter author name for in-text citations?

Best regards
Thorsten

OT indeed there is. Apologies, it slipped my mind. Fixing now.
decitrig
Posts: 5
Joined: Thu Nov 26, 2009 7:16 pm

line-by-line annotation for proofs?

Post by decitrig »

gmedina wrote:Hi,

another option could be the alignat environment provided by amsmath:
That worked very well - stupid of me not to see that in the docs.
localghost wrote:If the text represents math expressions, use the align environment from amsmath. However, be a bit more specific on what you want to do
I did the following:

Code: Select all

% how very contrived this example is
\begin{align}
x^n &= x\cdot x^{n-1} & \mbox{by algebra}
\end{align}
But all the mboxes were right-aligned. The alignat worked perfectly, though.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

line-by-line annotation for proofs?

Post by frabjous »

Using a double && for the last one should left-align it for you (just as gmedina is doing for alignat):

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
x^n &= x\cdot x^{n-1} && \mbox{by algebra} \\
x^n + 1 &= x\cdot x^{n-1} + 1 && \mbox{by more algebra} \\
x^n + 1 - n &= x\cdot x^{n-1} + 1 - n && \mbox{by even more algebra}
\end{align}
\end{document}
Post Reply