james@abby.chem.ucla.edu (James Wilkinson) (05/28/90)
In article <2544@media-lab.MEDIA.MIT.EDU>, djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: > I'm looking for a way to block out large portions of input from a > Latex document. This is so I can prevent the printing out of selected > sections of a large document. Of course I could just put % in front > of every line of the section I want blocked out, but this can be a > real pain for large sections of text. You might take a look at the "Splitting Your Input" section in the LaTeX manual. Put various sections of the document in smaller files, and \include{file} in your main file. Then us the \includeonly command to determine what gets processed and what doesn't. On a side note, how does one create two bibliographys in a single document using BibTeX? I want to include one bibliography for the main paper, and another in an appendix. Both lists should be independent of one another. Do I have to do two parts separately? JaW James Wilkinson Phone: 1-213-206-5104 Department of Chemistry and Biochemistry FAX: 1-213-206-5381 University of California, Los Angeles BITNET: JAMES@UCLACH 405 Hilgard Avenue Internet: JAMES@ABBY.CHEM.UCLA.EDU Los Angeles, California 90024-1569 SPAN: ABBY::JAMES or 5882::JAMES
djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) (05/28/90)
I'm looking for a way to block out large portions of input from a Latex document. This is so I can prevent the printing out of selected sections of a large document. Of course I could just put % in front of every line of the section I want blocked out, but this can be a real pain for large sections of text. It would be much nicer if I could just do something like \begin {blockcomment} blah...blah...blah \end {blockcomment} Everything between the begin and end would be ignored. Does anyone know how to do this or could some guru-type whip up a macro for this? Thanks, David Sturman MIT Media Lab djs@media-lab.media.mit.edu
mathas_a@maths.su.oz.au (andrew) (05/28/90)
If you read the LaTeX manual you will find this wonderful feature for doing exactly what you want. Put the sections that you want control over in separate files (say chapt1.tex, chapt2.tex ,...) and then put the lines \include{chapt1} \include{chapt2} ... and so on in after the \begin{document} statement. To selectively include these files put something like \includeonly{chapt1,chapt4} %**no spaces between the braces** before the \include statements. There is one possible problem though: each of these sections must start a new file. It's all in the manual though. Andrew - who needs silly quotes anyway!
dhosek@sif.claremont.edu (Hosek, Donald A.) (05/28/90)
In article <2544@media-lab.MEDIA.MIT.EDU>, djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes... >I'm looking for a way to block out large portions of input from a >Latex document. This is so I can prevent the printing out of selected >sections of a large document. Of course I could just put % in front >of every line of the section I want blocked out, but this can be a >real pain for large sections of text. It would be much nicer if I >could just do something like > \begin {blockcomment} > blah...blah...blah > \end {blockcomment} > Everything between the begin and end would be ignored. Does anyone >know how to do this or could some guru-type whip up a macro for this? What you want is the verbatim.sty written by Rainer Schoepf. This package, in addition to redefining the verbatim environment to work better also adds the ability to have a comment environment as well. The style is documented with Schoepf & Mittelbach's self-documentation scheme and is likely to form part of the new LaTeX so this is the verbatim mode to use. The relevant files are in [anonymous.tex.inputs.latex-contrib] and are: docstrip.tex docstrip.cmd-verbatim verbatim.doc verbatim.sty verbatim.readme verbtest.tex verbtest.tst doc.sty --- Don Hosek "When I was younger, I would throw dhosek@ymir.claremont.edu spitballs at girls that I liked. Now, dhosek@ymir.bitnet I beg and plead for dates. Frankly, the uunet!jarthur!ymir old way was more satisfying."
edgar@shape.mps.ohio-state.edu (Gerald Edgar) (05/28/90)
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: >I'm looking for a way to block out large portions of input from a >Latex document. ..... > \begin {blockcomment} > blah...blah...blah > \end {blockcomment} \iffalse blah...blah...blah \fi I don't use LaTeX, but this works in plain TeX. -- Gerald A. Edgar Department of Mathematics Bitnet: EDGAR@OHSTPY The Ohio State University Internet: edgar@mps.ohio-state.edu Columbus, OH 43210 ...!{att,pyramid}!osu-cis!shape.mps.ohio-state.edu!edgar
duchier@cs.yale.edu (Denys Duchier) (05/28/90)
It is truly remarkable how many times I have answered this question in the recent past. Anyway, here goes again: {\catcode`\{= 12 \catcode`\}= 12 \catcode`\@=11 \catcode`\[=1 \catcode`]=2 \catcode`\|=0 \catcode`\\=12 |global|long|def|@comment#1\end{comment}[|end[comment]] |global|def|comment[|let|do|@makeother|dospecials|@comment]] Use it as follows: \begin{comment} ... \end{comment} no nesting, sorry! --Denys
smithda@cpsvax.tmc.edu (J. Daniel Smith) (05/29/90)
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: >I'm looking for a way to block out large portions of input from a >[..] >real pain for large sections of text. It would be much nicer if I >could just do something like > \begin {blockcomment} > blah...blah...blah > \end {blockcomment} > Everything between the begin and end would be ignored. Does anyone I asked the same question a few months ago, and since I didn't get any answer then I wrote up a few macros to handle the job. I'm not sure if everything is done correctly, but they seem to work OK (I put all of latex.tex between \begin{comment} and \end{comment} and didn't get anything). These macros funciton like the 'verbatim' environment, so you can't use them as part of another environment (e.g. \newenvironment{blockout}{\begin{comment}}{\end{comment}} won't work). Send me any comments, questions, improvements, etc. Dan ------- % % J. Daniel Smith % 7 April 1990 % % comment.sty % % Copyright (c) 1990 J. Daniel Smith. All rights reserved. % Permission is hereby granted to use this code, or portions thereof, % in any way desired provided such use is strictly non-commercial % in nature. % % All text between \begin{comment} and \end{comment} is ignored by % LaTeX. Modified from the verbatim macros of LaTeX. % \typeout{Document Style option `comment' <7 Apr 90>.} % \catcode`@=11 % \def\c@tend{\catcode`@=14\catcode``=14} \def\c@mmentcat{ \let\c@=\catcode \c@`!=14 \c@`"=14 \c@`\#=14 \c@`\$=14 \c@`\&=14 \c@`'=14 \c@`(=14 \c@`)=14 \c@`*=14 \c@`+=14 \c@`,=14 \c@`-=14 \c@`.=14 \c@`/=14 \c@`0=14 \c@`1=14 \c@`2=14 \c@`3=14 \c@`4=14 \c@`5=14 \c@`6=14 \c@`7=14 \c@`8=14 \c@`9=14 \c@`:=14 \c@`;=14 \c@`<=14 \c@`==14 \c@`>=14 \c@`?=14 \c@`@=14 \c@`A=14 \c@`B=14 \c@`C=14 \c@`D=14 \c@`E=14 \c@`F=14 \c@`G=14 \c@`H=14 \c@`I=14 \c@`J=14 \c@`K=14 \c@`L=14 \c@`M=14 \c@`N=14 \c@`O=14 \c@`P=14 \c@`Q=14 \c@`R=14 \c@`S=14 \c@`T=14 \c@`U=14 \c@`V=14 \c@`W=14 \c@`X=14 \c@`Y=14 \c@`Z=14 \c@`[=14 \c@`]=14 \c@`^=14 \c@`_=14 \c@`a=14 \c@`f=14 \c@`g=14 \c@`h=14 \c@`i=14 \c@`j=14 \c@`k=14 \c@`q=14 \c@`s=14 \c@`u=14 \c@`v=14 \c@`w=14 \c@`x=14 \c@`y=14 \c@`z=14 \c@`|=14 \c@`~=14 \c@` =14\c@tend} % \begingroup \catcode `|=0 \catcode `[= 1 \catcode`]=2 \catcode `\{=12 \catcode `\}=12 \catcode`\\=12 |long|gdef|@xcomment#1\end{comment}[|end[comment]] |endgroup \def\@comment{\let\do\@makeother \dospecials\c@mmentcat} \let\endc@mment=\endtrivlist %\newenvironment{comment}{\@comment\@xcomment}{\endc@mment} \newenvironment{comment}{\@comment\@xcomment}{} % \catcode`@=12 ========================================================================= J. Daniel Smith Internet: smithda@cpsvax.cps.msu.edu Michigan State University BITNET: smithdan@msuegr East Lansing, Michigan Usenet: uunet!frith!smithda Great things can be reduced to small things, and small things can be reduced to nothing. - Chinese Proverb =========================================================================
guy@physics (Guy Metcalfe) (05/29/90)
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: >I'm looking for a way to block out large portions of input from a >Latex document. This is so I can prevent the printing out of selected >sections of a large document. Of course I could just put % in front This isn't a TeX solution but the c-preprocessor will handle this in what I think is a more useful way than has so far been mentioned. Surround blocks of text by #ifdef's, run the file through the preprocessor, then tex the output. I.e., cc -P file.tex gives a tex file with no marked blocks included. Including a block marked as COMMENT would be cc -P -DCOMMENT file.tex. This produces the same result as using TeX's file inclusion commands, but one needn't have a bunch of small files floating around. One can also mark out any number of differnt blocks and include any set of them easily without editing any files. The only problem is that the filtered output ends up in a file called file.i---it doesn't appear that the P option will write to stdout. But a simple shell script (or---gasp---doing it by hand) could make this as fancy and automatic as you liked. An example: \documentstyle{article} \begin{document} This is the some text. #ifdef COMMENT And this is a comment of some kind. #endif And this is some more text. \end{document} -- Guy Metcalfe Duke University Dept. of Physics guy@phy.duke.edu & Center for Nonlinear Studies guy@physics.phy.duke.edu Durham, N.C. 27706 guy%phy.duke.edu@cs.duke.edu
aceverj@accucx.cc.ruu.nl (Jaap Verhage) (05/30/90)
In article <DUCHIER.90May28113604@albania.cs.yale.edu> duchier-denys@cs.yale.edu writes: > >It is truly remarkable how many times I have answered this question in >the recent past. Anyway, here goes again: > I do believe that, sometime in the past, there was a message about a `Frequently Asked Questions' poster to appear regularly. I believe it did once, but I haven't seen it since ... maybe things like this could then be prevented. > [rest deleted]
peierls@bnlux0.bnl.gov (Ron Peierls) (05/31/90)
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: >I'm looking for a way to block out large portions of input from a >Latex document. This is so I can prevent the printing out of selected ....... >could just do something like > \begin {blockcomment} > blah...blah...blah > \end {blockcomment} > Everything between the begin and end would be ignored. Does anyone ......... There is a very simple way of skipping blocks of text which works very well, except when it fails, but let's start with it. Included Text....... \iffalse Text to be skipped ..... \fi Text to be included.... This works since \iffalse skips all tokens until it reaches \fi, which is what tou want. It even is smart enough to ignore most macro expansions along the way. Unfortunately a few things cause problems: for example,if a macro is used inside the skipped section which was defined as \outer\def.. then, since that is illegal within the skipped portion of a conditional, it runs into trouble. Other \if.. \fi pairs in the skipped text can sometimes cause problems also. The solution I have used, which seems to work so far is: \gdef\startskip{\catcode`\!=0 \catcode`\\=12 \iffalse} \gdef\endskip{\catcode`\\=0 `catcode`\!=12} and then to use Text to include...... \startskip Text to skip....... !fi \endskip I have not found any way of eliminating the need for the explicit sequence <escape token><character "f"><character "i"> to appear. AMSTeX has a \comment....\endcomment macro pair which is quite complex and skips explicitly one line at a time, so is relatively inefficient on large blocks. And there are other complicyted solutions in other stles, but this needs no special style.
myers@ut-emx.UUCP (Eric Myers) (06/01/90)
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: >I'm looking for a way to block out large portions of input from a >Latex document. This is so I can prevent the printing out of selected Well, I hate LaTeX, but if you can use some sort of Plain TeX equivalent, the TeXsis macros use the following: %==================================================* % COMMENTS. % % Use \comment to turn most anything into nothing (must have balanced {}!). % Usage: % \comment/* <text to be ignored> */ % the /* and */ are required! \long\def\comment#1/*#2*/{\endcomment} % lets you do stuff afterwards \def\endcomment{\relax} % but for now just do nothing -- Eric Myers "If God had intended for man to fly He would have given us the brains to build airplanes." Center for Relativity, Department of Physics, University of Texas at Austin myers@emx.utexas.edu | myers@utaphy.bitnet | myers@ut-emx.UUCP
sommer@BINAH.CC.BRANDEIS.EDU (06/01/90)
In article <2544@media-lab.MEDIA.MIT.EDU> djs@media-lab.MEDIA.MIT.EDU (David J. Sturman) writes: >I'm looking for a way to block out large portions of input from a >Latex document. This is so I can prevent the printing out of selected ....... A while back, someone (my apologies to the forgotten originator) posted the following simple LaTeX solution that even I could understand and I've used it without problems (so far), even on very large blocks of text and code. It works on text containing \footnote's and it works inside \footnote's. I think I've \comment'ed out text containing {list}'s, too. ... \newcommand{\comment}[1]{} ... This is visible text. \comment{Everything between the braces is commented out.} And so on.