> Ross very speedily fixed an alltt related problem for me a few months
> ago by introducing the $alltt_rx variable. This works fine in most
> cases but I've just come across a very strange case that I am at a
> loss to explain. Take the following file
> 
...
> %\chcol{firebrick4}
> \begin{doutput}
> Enter a key: john
> No information about `john'
> Enter a key: John
> Info for `John' is 
>         Name: John Latham Phone: 6250 Room: CB-2.113
> Enter a key: ^D
> \end{doutput}
> \end{document}
 
> This (using l2h982b8) produces a <TT> environment but without the
> <BR>'s at the end of each line, which was the problem I reported to
> you in the first place. However, if I delete the **comment** line
> %\chcol{firebrick4} 
> that occurs before the start of the douput environment everything
> works fine!
> 
> Any ideas what's going on here?
 
Yes. It is the test for an alltt-like environment bein hidden
behind comments that is failing; e.g.

% \begin{alltt} 
something here
and some more ...

The above must *not* put in the <BR>s.
However the following should:

% a comment
\begin{alltt}
something here
and some more
...
\end{alltt}


The test for this is being done as follows:

local(@check) = split("\n",$before);
local($lastline) = pop @check;

$alltt = &alltt_helper($alltt)   # shield special chars
    unless ($lastline =~ /(^|[^\\])(\\\\)*%.*$/m);  # unless commented out

The intention is that the \n at the end of $before in the 2nd case,
should leave an empty last element in @check , so that the 'unless' test
of $lastline will fail and the <BR>s will be put in.

But this doesn't happen; instead the  pop @check;  is picking up
the commented line as $lastline; ergo, no <BR>s.

Fix it by inserting an extra conditional, as follows:

local(@check) = split("\n",$before);
local($lastline) = pop @check unless ($before =~ s/\n$//s);

> Thanks
> 


Hope this helps.

        Ross Moore


PS, http://www-texdev.mpce.mq.edu.au/ptest/tabtest/
has the result of testing this.
It also shows my latest efforts to clean up enumerated lists.

Reply via email to