[l2h] \verbatim and \endverbatim
Ross Moore
ross at ics.mq.edu.au
Wed Jan 7 15:33:11 CET 2004
On Wed, 7 Jan 2004, Jens Lehmann wrote:
> Ross Moore wrote:
> > Hi Jens,
>
> This explains the behaviour of Roland's example in the Debian bug
> report. Personally I'd prefer to avoid this undocumented feature for
> your next release.
> > Here's the result:
> >
> > http://www-texdev.ics.mq.edu.au:LEHMANN/test5/
obvious typo, sorry -------------^------- should be /
> >
> > (source at http://www-texdev.ics.mq.edu.au:LEHMANN/test5.tex )
and here ---------------------^
>
> I get only 404 errors trying to access the documents above.
>
> > My edits to latex2html (5 simple edits) effect the following.
> >
> >
> > Environments with names ending: ....verbatim or ....Verbatim
> > have
> > 1. their contents placed 'verbatim' (ie. in <PRE>....</PRE> tags)
> > (as at present)
> >
> > as well as
> >
> > 2. their \newenvironment replacements interpreted, both before
> > and after;
> > 3. occurrences of \verbatim and \endverbatim are ignored.
> >
> >
> > Thus the following kind of definition works as expected:
> >
> > \newenvironment{\myverbatim}
> > {... some stuff before .. e.g., for stylish purposes ...
> > \verbatim }
> > {\endverbatim
> > ... and closing stuff afterwards ... }
> >
> > The 5 short edits are not yet committed to the repository
> > at www.latex2html.org , but I'll send them to you if you
> > are prepared to implement them yourself.
>
> Personally I'm quite happy that you added support for this environment.
> For the future of latex2html in general it would be better to add real
> support for \verbatim and \endverbatim, if this is possible. Please send
Real support is not possible, without a significant addition to the
structure of LaTeX2HTML, because of the order in which environment and
macro replacements are made and processed.
In particular, verbatim-like environments are identified early, and
their contents stored in a database, so as to be unaffected by further
processing rules and replacements.
Since with your environments, the \verbatim is not present until
a macro replacement has been made, then this `implicit' verbatim
environment will be missed by the existing coding.
> me the patch along with some short instructions, so I can test it.
Here's a context diff for relevant parts of the latex2html script.
The line-numbers refer to latex2html.pin .
landau.ics.mq.edu.au> cvs diff -c latex2html.pin
Index: latex2html.pin
===================================================================
RCS file: /home/latex2ht/cvs/latex2html/user/latex2html.pin,v
retrieving revision 1.71
diff -c -r1.71 latex2html.pin
*** latex2html.pin 6 Jan 2004 23:49:54 -0000 1.71
--- latex2html.pin 7 Jan 2004 14:19:46 -0000
***************
*** 1445,1455 ****
#protect \verb|\begin/end....| parts, for LaTeX documentation
s/(\\verb\*?(.))\\(begin|end)/$1\003$3/g;
local(@processedV);
local($opt, $style_info,$before, $contents, $after, $env);
while (($UNFINISHED_COMMENT)||
(/\\begin\s*($opt_arg_rx)?\s*\{($verbatim_env_rx|$keepcomments_rx)\}/o)) {
! ($opt, $style_info) = ($1,$2);
$before=$contents=$after=$env='';
if ($UNFINISHED_COMMENT) {
$UNFINISHED_COMMENT =~ s/([^:]*)::(\d+)/$env=$1;$after=$_;
--- 1456,1467 ----
#protect \verb|\begin/end....| parts, for LaTeX documentation
s/(\\verb\*?(.))\\(begin|end)/$1\003$3/g;
+ my ($begin_env, $end_env) = ('','');
local(@processedV);
local($opt, $style_info,$before, $contents, $after, $env);
while (($UNFINISHED_COMMENT)||
(/\\begin\s*($opt_arg_rx)?\s*\{($verbatim_env_rx|$keepcomments_rx)\}/o)) {
! ($opt, $style_info, $begin_env) = ($1,$2,$&);
$before=$contents=$after=$env='';
if ($UNFINISHED_COMMENT) {
$UNFINISHED_COMMENT =~ s/([^:]*)::(\d+)/$env=$1;$after=$_;
***************
*** 1466,1472 ****
print "'";$before = '';
}
if ($after =~ /\s*\\end{$env[*]?}/) { # Must NOT use the s///o option!!!
! ($contents, $after) = ($`, $');
$contents =~ s/^\n+/\n/s;
# $contents =~ s/\n+$//s;
--- 1478,1484 ----
print "'";$before = '';
}
if ($after =~ /\s*\\end{$env[*]?}/) { # Must NOT use the s///o option!!!
! ($contents, $after, $end_env) = ($`, $', $&);
$contents =~ s/^\n+/\n/s;
# $contents =~ s/\n+$//s;
***************
*** 1478,1483 ****
--- 1490,1496 ----
if ($env =~ /rawhtml|$keepcomments_rx/i) {
$contents = &revert_to_raw_tex($contents);
} else {
+ # character sequences such as \< and \> may be present
$contents =~
s/([^\\](?:\\\\)*\\)([$html_escape_chars])/$1.&special($2)/geos;
$contents =~ s/\\\\ /\\\\/go;
}
***************
*** 1518,1523 ****
--- 1531,1540 ----
, $global{'verbatim_counter'},"#"
, "\\end\{tex2html_preform\}",$after);
} else {
+ if ($env =~ /(\w)+[Vv]erbatim/) {
+ push(@processedV,$begin_env);
+ $after = $end_env.$after;
+ }
push (@processedV
, join("","\\begin", $opt, "\{tex2html_preform\}"
, $verbatim_mark,$env
***************
*** 16147,16152 ****
--- 16200,16207 ----
twocolumn
unskip
#upshape
+ verbatim
+ endverbatim
vfil
vfill
vfilll
***************
(The last of these is just cosmetic, to inhibit reporting
that \verbatim and \endverbatim are unknown commands.
I may change this in the not-too-distant future.)
> > Within the next few weeks (maybe as many as 6 or 7 !)
> > I'll be announcing a new version of LaTeX2HTML, which will
> > have numerous small bug-fixes and improvements, and other
> > extended functionality (e.g. support for .jpg images/icons
> > thanks to coding contributed by Shigeharu TAKENO).
>
> It's good to hear that. Maybe it's time for me to mail you more feature
> requests to get them in the release. :-) I didn't report every problem I
> encountered to the mailing list, because the verbatim-problem and
> mnemonic anchor problem are the most important for me.
>
> I don't want to go offtopic, but one of the things, which would be nice
> is to put the content of every html-page in a table and specify its
The trouble with using a fixed-width table is that it upsets the layout
in a horrible way for people wishing to use large fonts; e.g. for
readability by those with sight-impairment.
> width (optionally configured by an option). (CSS even allows to specify
> min-width and max-width, which is supported by Mozilla!) For some
But if you really want this, it can be added through a post-processing
routine. LaTeX2HTML provides a 'hook' for this.
Indeed there are 2 such hooks:
&post_process --- already used extensively for encodings and
special characters/entities in the output
and
&post_post_process --- kept free for user-use.
It would be nice to have a library of useful functions to call at this
point. But it really needs users to write these and submit for general
use.
> documents it's better to have a max width of say 750, because otherwise
> documents are difficult to read for people with a 1600x1200 resolution.
If you have that kind of luxury, it's surely no problem to adjust the
size of your windows. :-)
>
> If you want I can try to find out more issues. The Debian bug tracking
> system is also a good resource.
Sure.
Almost all of the outstanding `bugs' will be fixed in the forthcoming
revision.
All the best,
Ross Moore
>
> Jens
>
>
> --
> PGP Public Key: http://studenten-dresden.de/public_key.asc
>
>
More information about the latex2html
mailing list