[l2h] Questions on implementing ifthen.perl

2002-12-23 Thread Leigh Smith
While the conditional commands in the html.perl package are great when 
choosing which code to process depending on latex2html or LaTeX2e are 
being used, I sometimes need conditional processing when processing 
with LaTeX2e. I assume html.perl can't do general purpose conditional 
processing with LaTeX2e?

I have a partially complete implementation of ifthen.perl to support
 \ifthenelse{condition}{cond true commands}{cond false commands}

One thing that stymies me is that the parameter sent to 
do_cmd_ifthenelse is delimited by the next \section/\subsection 
command. This produces problems if you want to conditionally process a 
section, i.e.

\ifthenelse{\boolean{dothissection}}
{
\section{This is a section that will be processed if dothissection is 
true}

And it's contents.
}
{
\section{This is a section that will be processed if dothissection is 
false}

And it's contents.
}

I assume that ifthenelse needs to be processed via 
substitute_meta_cmds since according to the documentation, these are 
processed prior to splitting the input text into chunks at section 
boundaries?

The other issue raised in a previous mail list posting by Ross is it 
seems booleans are not guaranteed to expand in the same way in 
latex2html than in LaTeX, I can live with/work around that, although 
fairly simple set of commands like

\newboolean{condition}
\setboolean{condition}{true}

\boolean{condition}

in 1.70 of latex2html.pin always produce 0. I've sent the changes to 
Ross to fix those bugs in \boolean processing. However, am I correct in 
assuming latex2html-2002-2-1.tar.gz is still the latest release?

The link http://saftsack.fs.uni-bayreuth.de/~latex2ht/current/ from 
www.latex2html.org lists all files as written on the 29th of November 
2002, I assume the other ones cover releases in 1999 (i.e 
latex2html-99.2beta8.tar.gz)  and 2000 (latex2html-2K.1beta.tar.gz)?

Do I understand that to mean latex2html-2002-2-1.tar.gz does not change 
it's name when updates have been made, or that no changes have been 
made since the 2002-2-1 release?

I'm sorry for all the questions, but the version numbering in the name 
of the tarball seems non-standard. Also, am I correct in assuming that 
the CVS repository itself is not accessible but only a checked out 
distribution accessible at 
http://saftsack.fs.uni-bayreuth.de/~latex2ht/user/?

In any case, the changes I made to 1.70 of latex2html.pin are:

14415c14415,14417
 if (defined $global{$bool}) { $val= $global{$bool} }
---
 if (defined $global{if$bool}) {
   $val= $global{if$bool}
 }
14528c14530
   $global{if$bool} = (($val = ~/true/) ? 1 : 0);
---
   $global{if$bool} = (($val =~ /true/) ? 1 : 0);

Once ifthen.perl is a bit more functional, I'd like to contribute it to 
the distribution.

Happy Holidays
--
Leigh Smith
mailto:[EMAIL PROTECTED]
http://www.leighsmith.com

___
latex2html mailing list
[EMAIL PROTECTED]
http://tug.org/mailman/listinfo/latex2html


Re: [l2h] Questions on implementing ifthen.perl

2002-12-23 Thread Ross Moore
 While the conditional commands in the html.perl package are great when 
 choosing which code to process depending on latex2html or LaTeX2e are 
 being used, I sometimes need conditional processing when processing 
 with LaTeX2e. I assume html.perl can't do general purpose conditional 
 processing with LaTeX2e?
 
 I have a partially complete implementation of ifthen.perl to support
   \ifthenelse{condition}{cond true commands}{cond false commands}
 
 One thing that stymies me is that the parameter sent to 
 do_cmd_ifthenelse is delimited by the next \section/\subsection 

Yes; LaTeX2HTML calculates the document-structure before it expands
macros. So this can never work.

Essentially you have one document for when the condition is 'true' and 
a different document for when the condition is 'false'.
If the condition changes according to the contents of the LaTeX source,
then LaTeX2HTML will not know this at the correct time.
(Your model is then of document-content determining document-structure;
this is very much against the tree-like structure of HTML and XML documents.)

On the other hand, if it changes according to some externally-supplied
input; e.g. something that is set once in the LaTeX preamble, and never
changes after this, then you can use Perl coding to set declarations
that will enable you to handle it.

e.g.
Study comment.sty  with its conditional 'comment' environments.
Surround your conditional sections by comment-like environments.
Develop the logic to handle \includecomment  and  \excludecomment
commands.


Alternatively, your conditional sections could be \input from separate
files. Adjust the values of $DO_INCLUDE and $DONT_INCLUDE within the
 .latex2html-init file, before starting the LaTeX2HTML job.


 command. This produces problems if you want to conditionally process a 
 section, i.e.
 
 \ifthenelse{\boolean{dothissection}}
 {
 \section{This is a section that will be processed if dothissection is 
 true}
 
 And it's contents.
 }
 {
 \section{This is a section that will be processed if dothissection is 
 false}
 
 And it's contents.
 }
 
 I assume that ifthenelse needs to be processed via 
 substitute_meta_cmds since according to the documentation, these are 
 processed prior to splitting the input text into chunks at section 
 boundaries?

Yes; I suppose that is an alternative approach.

But it all depends upon what determines when you want the sections included
or not included. If it is something that will not be known until detailed
expansion of macros has taken place, then you are out of luck.
If it depeneds on some global parameter that is known at the very start of
the job, then there is almost certainly a better way to organise your LaTeX
sources that makes the relevant logic easier to handle.

 
 The other issue raised in a previous mail list posting by Ross is it 
 seems booleans are not guaranteed to expand in the same way in 
 latex2html than in LaTeX, I can live with/work around that, although 
 fairly simple set of commands like
 
 \newboolean{condition}
 \setboolean{condition}{true}
 
 \boolean{condition}
 
 in 1.70 of latex2html.pin always produce 0. I've sent the changes to 
 Ross to fix those bugs in \boolean processing. However, am I correct in 
 assuming latex2html-2002-2-1.tar.gz is still the latest release?

Yeah; sorry.
I've been too busy to make those changes generally available.

I'd need to study examples to ensure that they work correctly,
and establish guidelines on just what working correctly actually means.


As my above comments indicate, use of \ifthenelse is not a good idea for
controlling document structure.
I don't want to make such commands available, and then have to field dozens
of complaints that users are not getting what they expected to get.

This is the surely the real reason why these commands were never implemented
years ago. (Giving unexpected wrong results is worse than giving no results
at all, for this kind of thing.)


 
 The link http://saftsack.fs.uni-bayreuth.de/~latex2ht/current/ from 
 www.latex2html.org lists all files as written on the 29th of November 
 2002, I assume the other ones cover releases in 1999 (i.e 
 latex2html-99.2beta8.tar.gz)  and 2000 (latex2html-2K.1beta.tar.gz)?
 
 Do I understand that to mean latex2html-2002-2-1.tar.gz does not change 
 it's name when updates have been made, or that no changes have been 
 made since the 2002-2-1 release?
 
 I'm sorry for all the questions, but the version numbering in the name 
 of the tarball seems non-standard. Also, am I correct in assuming that 
 the CVS repository itself is not accessible but only a checked out 
 distribution accessible at 
 http://saftsack.fs.uni-bayreuth.de/~latex2ht/user/?

With Marek Rouchal returning after a long absence, the anonymous CVS
logins may become accessible again soon.


THanks for your interest, and hopefully there will be more time
in the New Year to make further improvements to LaTeX2HTML.


All the best,

Ross Moore


 
 In any