[l2h] Re: verbatim-like environments

Ross Moore ross at maths.mq.edu.au
Fri Nov 12 00:24:34 CET 2004


Hi Igor,

On 12/11/2004, at 9:42 AM, Igor Pechtchanski wrote:

> For the record, I managed to fix this using
>
> \newenvironment{AAApreform}[1]{%
> \begin{tabular}{|l|}\hline%
> #1
> \begin{alltt}
> }{\end{alltt}% This has to be on the same line as the braces
> \hline\end{tabular}%
> }
> \newenvironment{BBBpreform}{%
> \begin{AAApreform}{\color[rgb]{1.0,0.0,0.0}}{\end{AAApreform}%
> }
>
> And adding the following
>
> $alltt_rx = 'AAApreform|BBBpreform';
> 1;

Yes, this will make the environment behave like an  alltt  environment,
and respect spaces, etc.
However, macros will be expanded as \ remains with its escape-char
interpretation.


Also, it really ought to be:

     $alltt_rx .= '|AAApreform|BBBpreform';

or (just to be safe):

    $alltt_rx = ($alltt_rx ? $alltt_rx.'\' : '' ) . 
'AAApreform|BBBpreform';



If you want it to be a real 'verbatim-like' environment, for 
program-listings
where '\' has a different meaning, then there's a lot more work to do.

There should be a recent message from me on this list about this,
and the need to catch the environment by hacking the  texexpand  script.



>
> to .latex2html-init.
>
> Hope this helps someone.

And this too.


Cheers

	Ross Moore



> 	Igor
>
> On Wed, 13 Oct 2004, Igor Pechtchanski wrote:
>
>> Hi,
>>
>> I'm attempting to define a verbatim-like environment, like so:
>>
>> \newenvironment{AAA}{%
>> \begin{tabular}{|l|}\hline%
>> \color[rgb]{1.0,0.0,0.0}%
>> \begin{rawhtml}<PRE>\end{rawhtml}%
>> }{%
>> \begin{rawhtml}</PRE>\end{rawhtml}%
>> \hline\end{tabular}%
>> }
>>
>> and then use it:
>>
>> \begin{AAA}
>>   Hello
>>     there,
>>       hi?
>>
>>   Well,
>>      goodbye!
>> \end{AAA}
>>
>> I'm getting the following output (approximated in ASCII art), the red
>> color is properly set:
>>
>> .--------------.
>> |              |
>> |Hello         |
>> |    there     |
>> |      hi?     |
>> |              |
>> |              |
>> |              |
>> |Well,         |
>> |     goodbye! |
>> |              |
>> `--------------'
>>
>> As I see it, there are two problems with the above picture:
>>
>> 1) the first line after every double line break loses its leading 
>> spaces
>> 2) there are extra lines on every double line break and at the start 
>> and
>>    end of the <PRE>..</PRE> block
>>
>> The expected output would be something like
>>
>> .--------------.
>> |  Hello       |
>> |    there     |
>> |      hi?     |
>> |              |
>> |  Well,       |
>> |     goodbye! |
>> `--------------'
>>
>> Is there a way of fixing this?  I'm not using the actual verbatim
>> environment because I'd like to be able to change colors in the 
>> middle of
>> those pseudo-verbatim blocks.
>>
>> $ /usr/bin/latex2html --version
>>  [english]This is jLaTeX2HTML Version 2002 (1.62) JA patch-1.4
>> by Kenshi Muto, Debian Project.
>>
>> Original LaTeX2HTML Version 2002 (1.62)
>> by Nikos Drakos, Computer Based Learning Unit, University of Leeds.
>>
>> $ rpm -qf /usr/bin/latex2html
>> tetex-latex-1.0.7-66
>>
>> $ uname -srvmpio
>> Linux 2.4.20-18.9 #1 Thu May 29 07:08:16 EDT 2003 i686 i386 GNU/Linux
>>
>> Any ideas and help would be appreciated.
>> 	Igor
>
> -- 
> 				http://cs.nyu.edu/~pechtcha/
>       |\      _,,,---,,_		pechtcha at cs.nyu.edu
> ZZZzz /,`.-'`'    -.  ;-;;,_		igor at watson.ibm.com
>      |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
>     '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
>
> "The Sun will pass between the Earth and the Moon tonight for a total
> Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT
>
> _______________________________________________
> latex2html mailing list
> latex2html at tug.org
> http://tug.org/mailman/listinfo/latex2html



More information about the latex2html mailing list