Is there a simple way to skip a block of stuff in a LaTeX file just
by putting in a jump or skip statement of some sort? This is what I
have in mind:
---------------------------------------------------------------------------
[This section being worked on.]
\skip
[This section ready to go.]
\noskip
[This section being worked on.]
---------------------------------------------------------------------------
The idea is to be able to skip over parts of the file so that I don't
have to process them and preview them while I'm working on another section
of the document. Any ideas?
--
Stan Reeves
Auburn University, Department of Electrical Engineering, Auburn, AL 36849
INTERNET: sjre...@eng.auburn.edu
I dont't know if someone wrote a means for `commenting out' whole parts of a file,
but it don't exist in standard LaTeX.
The method I prefer is putting all the ready stuff into a file of its own and \input ing
that file so I can put a % before the \input statement. This would't be much more work
than putting in and out \skip statements all the time.
If the parts you want to (temporarily) vanish are somewhat bigger (like chapters), you
could use \include, which is more like modularization and has the advantage of
maintaining page count, toc etc.
>
>
>
>--
>Stan Reeves
>Auburn University, Department of Electrical Engineering, Auburn, AL 36849
>INTERNET: sjre...@eng.auburn.edu
I hope you didn't know all this before,
Stephan Lehmke
---
--
Stephan Lehmke Voice (private) +49 231 75 80 52
Vogelpothsweg 108
D-44227 Dortmund
Germany, Europe Email: leh...@jupiter.informatik.uni-dortmund.de
--
There are several ways to address your requirement.
1. Simplest (but rather inflexible) is to use \iffalse where you talk
of \skip, above, and \fi for \noskip
2. Victor Eijkhout's comment.sty enables you to define sections that
are to be regarded as comment and sections that are to be typeset.
You say \includecomment{xxx} or \excludecomment{yyy}, and then have
sections \begin{xxx} ... \end{xxx} or whatever
3. If you're working on a chapter of a report or whatever at a time,
the standard latex mechanism of using \include to get the source of
each chapter, and having a \includeonly declaration in the
preamble, is hard to beat. See the LaTeX book
There are no doubt yet other ways to proceed, too.
--
Robin (Campaign for Real Radio 3) Fairbairns r...@cl.cam.ac.uk
U of Cambridge Computer Lab, Pembroke St, Cambridge CB2 3QG, UK
|> Been wondering about this for awhile...
|> Is there a simple way to skip a block of stuff in a LaTeX file just
|> by putting in a jump or skip statement of some sort? This is what I
|> have in mind:
|> ---------------------------------------------------------------------------
|> [This section being worked on.]
|> \skip
|> [This section ready to go.]
|> \noskip
|> [This section being worked on.]
|> ---------------------------------------------------------------------------
|> The idea is to be able to skip over parts of the file so that I don't
|> have to process them and preview them while I'm working on another section
|> of the document. Any ideas?
Try this:
---------------------------------------------------------------------------
[This section being worked on.]
\iffalse
[This section ready to go.]
\fi
[This section being worked on.]
---------------------------------------------------------------------------
--
----------------------------------------------------------------------
Andreas Schwab "And now for something
sch...@ls5.informatik.uni-dortmund.de completely different"
Look for COMMENT.STY - it does what you want and more. It can be found in
the usual TEX archives, and you can also look for it using ARCHIE
> I dont't know if someone wrote a means for `commenting out' whole
> parts of a file, but it don't exist in standard LaTeX.
Doing this sort of thing is EXTREMELY easy in TeX. If LaTeX complains
you will have to tweak and LaTeXify it. I stole the following idea
from TeXsis, by E. Meyers and F. Paige.
1. All stuff between an \Ignore and the next \endIgnore, be it one word
or the entire document, will be ignored. To have it included again, just
comment out \Ignore, since \endIgnore by itself does nothing.
\long\def\Ignore#1\endIgnore{\relax}
\def\endIgnore{\relax}
That's it! You can stop here if you wish!!
2. One can also make this sort of thing style dependent. Certain things
can be included or excluded depending on the style you are using or
the result of some test.
For example, the following defines two commands, \informal and \formal.
All stuff between \Informal and the next \endInformal will be kept if
\informal is in effect. It will be ignored if \formal is in effect.
\def\formal{\long\def\Informal##1\endInformal{\relax}
\def\endInformal{\relax}}
\def\informal{\def\Informal{\relax}\def\endInformal{\relax}}
3. I have embedded certain remarks in my papers that are processed
in the \preprint style but ignored in \Manuscript! By now, you can
figure out how to write such macros. The following is an exact quote
from one article:
----------------------------------------------------------------------------
\abstract
The Nielsen-Ninomiya no-go theorem asserts that chiral Weyl~(``neutrino'')
fields cannot exist on lattices. However, the actual mathematical arguments
advanced in the theorem fail to make that case. The theorem leaves the
problem of lattice neutrinos completely open; it identifies no obstacle
which would prevent us from discretizing chiral theories.
%
\informalabstract
Have you too, like every second person in the field, been citing the
Nielsen-Ninomiya theorem but have not read or analyzed it? Then, this
paper will wake you up. Reading it is a prerequisite to doing any good
work in chiral lattice physics.
%
\endinformalabstract
\endabstract
----------------------------------------------------------------------------
Have fun!
=========
malcolm clark
Well an easy method would be:
\long\def\ignore#1{}
and put "\ignore{" at the start of the block and "}" at the end. If you think
that brace would get lost too easily, define
\long\def\ignore#1\endignore{}
and put "\ignore" at the start and "\endignore" at the end. If you have
unmatched braces in the ignored text, then TeX will say either "Argument
of \ignore has an extra }" or "File ended while scanning use of \ignore."
Note: TeX has to read in the whole of the ignored text before it throws it
away, so this does not make the most efficient use of memory. However, I
can successfully ignore over 250K of text on this Sun workstation...
Ian Collier
Ian.C...@prg.ox.ac.uk | i...@ecs.ox.ac.uk
\def\SKIP#1{}
Use it as
\SKIP{
texts you want to skip
more to be skipped...
}
It works fine as long as you matches the brakets.
Liang-Wu Cai
>Use it as
> \SKIP{
> texts you want to skip
> more to be skipped...
> }
>It works fine as long as you matches the brakets.
It doesn't even work in the example you give, because TeX complains about
the new paragraphs within the braces. You need a \long\def to allow them.
Ian Collier
Ian.C...@prg.ox.ac.uk | i...@ecs.ox.ac.uk
Ian> Well an easy method would be:
Ian> \long\def\ignore#1{}
Ian> and put "\ignore{" at the start of the block and "}" at the end.
Ian> If you think that brace would get lost too easily, define
Ian> \long\def\ignore#1\endignore{}
Ian> and put "\ignore" at the start and "\endignore" at the end. If
Ian> you have unmatched braces in the ignored text, then TeX will say
Ian> either "Argument of \ignore has an extra }" or "File ended while
Ian> scanning use of \ignore."
Ian> Note: TeX has to read in the whole of the ignored text before it
Ian> throws it away, so this does not make the most efficient use of
Ian> memory. However, I can successfully ignore over 250K of text on
Ian> this Sun workstation...
Hmmmm I'm on a Sun Workstation too, but I cant even ignore 8 bytes
using this macro.
\long\def\ignore#1{}
\ignore{\newtoks}
In fact sometimes it dies with even smaller arguments
\iffalse
\ignore{\fi }
\fi
The only robust way to do a comment/ignore environment is read one
line at a time in verbatim mode, and throw the line away.
Look at verbatim.sty (and I think comment.sty) for ignore macros that
actually do ignore stuff, not parse it for \outer rubbish, unmatched
braces, unmatched \fi's etc etc.
David
>Ian> \long\def\ignore#1\endignore{}
>Hmmmm I'm on a Sun Workstation too, but I cant even ignore 8 bytes
>using this macro.
>\ignore{\newtoks}
>\iffalse \ignore{\fi } \fi
Oh, that's a bit harsh! :-) The questionner clearly indicated that the text
to be ignored is supposed to be well-formed LaTeX (and as such it shouldn't
contain any \outer things either). I hinted at this by referring to braces.
>The only robust way to do a comment/ignore environment is read one
>line at a time in verbatim mode, and throw the line away.
Strictly speaking, this is not correct. LaTeX's \begin{verbatim} command
does exactly the same as the above except that it changes the catcode of
all the special characters first. We can easily imitate this:
\begingroup \catcode`@=11 \catcode `|=0 \catcode`\\=12
|long|gdef|@ignore#1\endignore{|endgroup}
|gdef|ignore{|begingroup|def|do##1{|catcode`##1=12}|dospecials|@ignore}
|endgroup
This has nothing to do with "lines", whatever they are. Usage:
Hello,
\ignore\newtoks\endignore
world.
[Note that we can fool this definition, for example by typing \catcode`\==0.
However, we can fool LaTeX's "verbatim" environment in exactly the same way.
The moral is that you can easily muck things up by changing a character's
catcode unless you are very careful.]
Now, in article <1993Oct5.1...@midway.uchicago.edu>,
tri...@curie.uchicago.edu (Anil Trivedi) wrote:
> \long\def\Ignore#1\endIgnore{\relax}
Oh look, there it is again! :-)
>For example, the following defines two commands, \informal and \formal.
>All stuff between \Informal and the next \endInformal will be kept if
>\informal is in effect. It will be ignored if \formal is in effect.
This sort of thing is probably better done with \if commands unless the
bulletproof definition I gave above is needed, because \if is much more
efficient. That is, whereas \ignore collects the whole of the ignored
text before throwing it away, \if just skips over it and is thus slightly
faster and also uses much less memory.
You can write:
\newif\ifformal % "formal" starts out false
\ifformal
This text is only read in formal mode
\else
This text is only read in informal mode
\fi
This text is always read
\formaltrue % Now in formal mode
\formalfalse % Now in informal mode
Note that the skipped text may not contain any \outer things or any
unamtched \fi commands, etc..
Ian Collier
Ian.C...@prg.ox.ac.uk | i...@ecs.ox.ac.uk
You say: \include{draft}
or \exclude{draft}
and put a \begin{draft} ... \end{draft} around it.
for draft you can say anything you want (and that hasn't
been previously defined, of course). comment is
pre-defined. This allows as many versions of one
document as you want.
Volker
> This sort of thing is probably better done with \if commands...
> because \if is much more efficient. That is, whereas \ignore
> collects the whole of the ignored text before throwing it away,
> \if just skips over it and is thus slightly faster and also uses
> much less memory.
This is certainly true. And I have written macros which exclude or
include text dpending on some \if* condition.
The advantage of \ignore construction is simply convenience. Each
person must arrive at an optimum balance, on a case by case basis,
between convenience and economy. For me, \ignore...\endignore is
most convenient; the MOST economical is simply to move the text
to a save file (I do this too!); others fall somewere in between.
BTW, David Carlisle's suggestion for \comment was a good one.
That file is called comment.sty (by Eijkhout?); in spite of that
LaTeX'y name, the macros do work with plain TeX as well.
-----