[OS X TeX] help

Ross Moore ross at ics.mq.edu.au
Fri Feb 29 05:54:06 CET 2008


Hello Ludwik,

On 29/02/2008, at 2:39 PM, ludwik kowalski wrote:

>> If you want TeX to ignore a whole block of text, there's an
>> alternative to commenting the individual lines out:
>>
>> \iffalse
>> [... block of text to ignore ...]
>> \fi
>>
>> I find this useful for debugging, as well as when I want to rewrite a
>> passage, but don't want to delete my original draft from the source.
>
>
> 1) I suppose that [ ...... ] stands for a sequence of lines to be  
> commented and that square brackets are not needed.

Yes. ou don't need comment-characters.

> 2) But what has to be false ? In other words, under what conditions  
> will the block of lines be ignored by the compiler?

\iffalse  is TeX's internal way of representing that a Boolean  
condition fails.
It is *not* a test; it is the failing result of the test already.
This causes TeX to skip everything until the next (appropriately  
nested)  \fi
token. Hence all the intervening material is ignored.

Similarly  \iftrue  signifies a true result.

When the appropriate  \fi  is encountered, the scope of
the Boolean has been reached and processing resumes as normal.


> 3)  When I commented a block of lines they were ignored  
> unconditionally. What Ari is proposing seems to be different in  
> that respect. Right or wrong?

A better way, for LaTeX, is to use a special package such as
   comment.sty  (there are others too).

Rather than using  \iffalse .... \fi ,
you define environments whose names have a meaning to you.
At the beginning of the document you declare which of these
environments correspond to material that should be included
and what should be excluded.

That way the same logically-prepared LaTeX source can be used
with different documents, each of which determines what is to
be displayed and what is not.

This is ideally suited to different views of the same kind of
material, such as text-books with exercises, solutions, worked
examples, hints, comments for TAs, etc.



Ari said that he found  \iffalse ... \fi  useful
for debugging. That's a valid use.

When everything works right, this kind of markup
should be expunged from the file, as it gives no
indication of why the material is in the file at all.

Lines commented with  %-signs  is a better way to leave
comments and messages not intended for the final PDF.
Literate-programming, (e.g., using the  docstrip  package)
is even better, but generally this is a bit harder to work with.



> Ludwik Kowalski, a retired physicist
> 5 Horizon Road, apt.2702, Fort Lee, NJ, 07024, USA
> Also an amateur journalist at http://csam.montclair.edu/~kowalski/cf/


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia  2109                            fax: +61 +2 9850 8114
------------------------------------------------------------------------





More information about the macostex-archives mailing list