[l2h] different versions of the tex-file

Phil Lanch phil at subtle.clara.co.uk
Sat Nov 22 19:14:22 CET 2003

On Fri, Nov 21, 2003 at 08:39:07PM +0100, webmaster at steinam.de wrote:
> I have the problem, that I want to write a large document (> 300 pages) 
> with pdflatex for different groups of users, say teachers, students, rest of 
> the world
> With the package comment no problem in pdflatex
> \begin{teacher} .... \end{teacher}
> \begin{student} .... \end{student}
> But I need html-output too !!
> The problem now is that latex2html doesn't work together with the 
> package comment. When parsing the source, l2h produces for  this 
> environments an image file, that has nothing to do with the original 
> source.
> Has anybody had this problem too ? Can't believe that I'am the first one 
> :-)
> How can this problem be solved or workarounded ?

this sounded familiar, and i found that i've been using an ugly
workaround for this problem.  it's a filter to pre-process a LaTeX file
(i.e. it's to be applied to a .tex before latex2html): attached.

for a proper solution: latex2html can process \begin{htmlonly} and
\begin{latexonly} sections correctly, so i guess it could easily be
extended to handle comments in general.

Phil Lanch                    0xD78D598DA6635CF32AB24593C98994B7D95B33E3
   http://www.subtle.clara.net/rephrase/ - GnuPG passphrase recovery

  If I knew then what I know now, I would have said 'I don't recall'.
-------------- next part --------------
#! /usr/bin/perl -w

use strict;

my $tex=join "",<>;
my %opt;
$opt{$2}=$1 eq "in" while $tex =~ /\\(in|ex)cludecomment{\s*([^{}\s]+)\s*}/g;
$tex =~ s/\\begin{\s*\Q$_\E\s*}(.*?)\\end{\s*\Q$_\E\s*}/$opt{$_} ? $1 : ""/egs foreach keys %opt;
print $tex;

More information about the latex2html mailing list