ingham@triton.unm.edu (Kenneth Ingham) (05/21/91)
Important data: Ultrix 4.0 on a Decstation 5000/200 TeX C Version 2.95 SliTeX Version 2.09 - Release 10 November 86 It seems that it is possible to have the contents of a verbatim environment make a difference. The file runoff.tex: \documentstyle{slides} \onlyslides{2} \begin{document} \blackandwhite{slides} \end{document} The file slides.tex: \begin{slide}{} \begin{verbatim} { % } \end{verbatim} \end{slide} If the onlyslides line above is commented out, everything runs fine. However, with it there, the following error is produced: This is TeX, C Version 2.95 (no format preloaded) (runoff.tex SliTeX Version 2.09 - Release 10 November 86 (/usr/local/lib/tex/inputs/slides.sty Document Style 'slide' -- released 17 January 1986 ) Only Slides 2 No file runoff.aux. (slides.tex) Runaway argument? \fi \begin {verbatim} { \end {verbatim} \end {slide} ! File ended while scanning use of \@ggobtoend. <inserted text> \par <to be read again> \let \@makingslidesfalse ->\let \if@makingslides =\iffalse l.4 \blackandwhite{slides} ? x No pages of output. Transcript written on runoff.log. It appears that the % inside the verbatim environment is acting as a comment. I discovered this the hard way because of a short C function with a printf statement which happened to be in a verbatim environment. Is there an easy work-around for this problem? A hard one? -- Kenneth Ingham ingham@ariel.unm.edu Hummin' lil Grumman N9646L
texinfo1@rusmv1.rus.uni-stuttgart.de (Rainer Schoepf) (05/30/91)
In article <1991May20.204251.16804@ariel.unm.edu> ingham@triton.unm.edu (Kenneth Ingham) writes: >Important data: >Ultrix 4.0 on a Decstation 5000/200 >TeX C Version 2.95 >SliTeX Version 2.09 - Release 10 November 86 current release is June 88 ^^^^^^^^^^^^^^ > >It seems that it is possible to have the contents of a verbatim >environment make a difference. > >The file runoff.tex: > >\documentstyle{slides} >\onlyslides{2} >\begin{document} >\blackandwhite{slides} >\end{document} > >The file slides.tex: > >\begin{slide}{} >\begin{verbatim} >{ % } >\end{verbatim} >\end{slide} > >If the onlyslides line above is commented out, everything runs fine. >However, with it there, the following error is produced: What happens is this: when you use \onlyslides{something} SliTeX will skip over the slides that are excluded. But then the \begin{verbatim} command is not executed, so the percent character is treated as start of comment. There is no way around this, since you don't want to execute \begin{verbatim} when you don want that specific slide. Now wait a minute, you say, can't you treat verbatim environments in a special way so that it works. Well, you can, but this needs a very complicated look-ahead mechanism that will probably not catch all the cases. This is one of the places where you hit TeX's limitations. > >Is there an easy work-around for this problem? A hard one? > It depends on what you want to do. For example, there is the alltt style option defining the alltt environment. This is like verbatim, except that backslash and braces retian their usual meaning. Since you want to display C code, this doesn't help very much. There is another, more complicated solution: instead of putting your code between \begin{verbatim} ... \end{verbatim} put it into an extra file. There are several style options that define some sort of \verbatiminput command that processes the file contents as if they appeared between \begin{verbatim} ... \end{verbatim}. One example of this is the verbatim style option I wrote a while ago. Rainer Sch"opf