[l2h] Re: verbatim-like environments
Igor Pechtchanski
pechtcha at cs.nyu.edu
Fri Nov 12 17:32:41 CET 2004
On Fri, 12 Nov 2004, Ross Moore wrote:
> 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.
Yup, that's exactly what I wanted. As outlined in the original message
below, I needed an environment that preserved spaces but honored control
macros.
> Also, it really ought to be:
>
> $alltt_rx .= '|AAApreform|BBBpreform';
>
> or (just to be safe):
>
> $alltt_rx = ($alltt_rx ? $alltt_rx.'\' : '' ) . 'AAApreform|BBBpreform';
Ah. Yes, that makes sense, thanks. My approach worked for me since no
latex2html packages installed on my system used $alltt_rx except
alltt.perl.
> 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.
Yes, but if I wanted a real verbatim environment, I could have just used
\begin{verbatim}...\end{verbatim}. :-)
> 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.
Well, I did search the list before posting, fruitlessly, so if you have a
direct pointer to the message, that'd be helpful.
> > to .latex2html-init.
> >
> > Hope this helps someone.
> > Igor
>
> And this too.
> Cheers
> Ross Moore
Thanks for the reply and the advice.
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
More information about the latex2html
mailing list