[l2h] Both \latex{} and \html{} blocks appear in images.tex

Julius Smith jos@w3k.org
Tue, 11 Dec 2001 10:59:53 -0800


Hi Ross,

Thanks for your clarifications and suggestions.  I especially liked the 
idea of using separate macro expansions for latex and html cases.  It is 
great to be able to edit one case without worrying about breaking the 
other.  However, after splitting up my figure macros, I seem to have 
introduced a couple of strange bugs:

(1) Verbatim environments are being replaced by random formulas.
(2) A small number of figure captions are suddenly not recognized.

When I copy the figures with unrecognized captions to a small test file, 
the problem disappears.  Similarly, the verbatim environments are ok in the 
small test file.

I am now in the tedious process of trying to create the smallest failing 
example.  Any debugging ideas would be greatly appreciated.

Thanks,
Julius

>It is definitely arguable that this is the *right* way to use conditional
>constructions. That is, define a macro for each, so that there is no need
>to edit in the main document body; make alterations by adjusting the
>expansion of the macro.

It is definitely arguable that this is the *right* way to use conditional
constructions. That is, define a macro for each, so that there is no need
to edit in the main document body; make alterations by adjusting the
expansion of the macro.

At 12:37 PM 12/8/2001 +1100, Ross Moore wrote:
> > I just noticed that (in l2h v2k.1beta (1.55)) the defs
> >
> >       \latex{
> >         latex-only block
> >       }
> >
> >       \html{
> >         html-only block
> >       }
> >
> > appear in images.tex as
> >
> >       \latex{
> >         latex-only stuff
> >       }
> >
> >       html-only stuff
> >
> > As a result, both blocks are compiled when processing images.tex.
> > Is this a bug? (It seems to be causing me some trouble.)
>
>It is generally not a good idea to be including large blocks
>as the argument of \latex or \html .
>These are intended for different words/phrases that are appropriate
>to the output setting:  .dvi/paper-print  or  HTML/on-screen .
>
>For whole environments that are different between the HTML/dvi
>versions, it is generally better to use the environments:
>
>   \begin{htmlonly}
>    ...
>    ...
>   \end{htmlonly}
>
>and
>
>   \begin{latexonly}
>    ...
>    ...
>   \end{latexonly}
>
>or conditional comments:
>
>  %begin{latexonly}
>    ...
>    ...
>  %end{latexonly}
>
>
> > I would expect only the \latex{} block to appear.
>
>This is not at all obvious.
>The image is being created for an HTML document,
>so one could easily argue that it is the  \html{.....}
>block that should be included.
>
>
>There is a problem with using the conditional environments
>discussed above, within coding blocks that will end up
>as part of the LaTeX source for generating an image.
>The {latexonly} parts were removed at the very beginning
>of the processing, so can *never* occur in the image.
>But the LaTeX processing will skip the {htmlonly} environments
>too; so you get *neither* version included.
>
>LaTeX2HTML provides also an  {imagesonly} environment
>that allows you to overcome precisely this type of issue.
>
>
>Another use of {imagesonly} is for the coding within the *preamble*
>of the LaTeX document.
>This lets you adjust which packages are loaded, or the expansion
>of various macros, when used within an image.
>
>This gives you another way to tackle the problem that you describe:
>
>   define a macro to expand to the coding that you want to appear
>   in conditional contexts.
>
>You can have 3 separate expansions, for the cases:
>
>    1.  appearance when processed normally by LaTeX
>
>    2.  when as normal text in an HTML document
>
>    3.  when included as part of an image in an HTML document.
>
>
>It is definitely arguable that this is the *right* way to use conditional
>constructions. That is, define a macro for each, so that there is no need
>to edit in the main document body; make alterations by adjusting the
>expansion of the macro.
>
>(This is particularly applicable for URLs, for example, where the appearance
>*must* be different in the HTML and .dvi cases.)
>
>
> > Thanks,
>
>
>Hope this helps,
>
>         Ross Moore
>
>
> > Julius
> >
> > _______________________________________________
> > latex2html mailing list
> > latex2html@tug.org
> > http://tug.org/mailman/listinfo/latex2html
>
>_______________________________________________
>latex2html mailing list
>latex2html@tug.org
>http://tug.org/mailman/listinfo/latex2html