On Tue, 15 Feb 2005, Ross Moore wrote:
> Hi Igor,
>
> On 15/02/2005, at 5:09 AM, Igor Pechtchanski wrote:
>
> > Hi,
> >
> > I'm attempting to convert a LaTeX file that has custom picture commands
> > into HTML. The images in the file should ideally be generated from the
> > LaTeX version of the commands. However, latex2html includes the HTML (!)
> > versions of the commands, which results in invalid images. Manually
> > editing images.tex to include the LaTeX versions of the commands does
> > produce the correct images.
> >
> > Below is the minimal example (with the actual command definition, FWIW,
> > but that's largely irrelevant, I think). Yes, I realize that it's LaTeX
> > hackery, and that LaTeX2HTML can't be expected to parse that,
>
> Firstly, you need to:
> \usepackage{html}
> then use the special environment:
>
> \begin{imagesonly}
> ...
> \end{imagesonly}
>
> as follows:
>
> \documentclass{article}
> \usepackage{html}
> %begin{latexonly}
> [snip \ovalbox definition]
> %end{latexonly}
>
> \begin{imagesonly}
> [snip \ovalbox definition]
> \end{imagesonly}
Thanks, Ross. This works (except for some [independent] weirdness with
the \string command).
As I understand it, though, the code above should be equivalent to putting
the definition of \ovalbox outside of the %begin/end{latexonly}
environment, right? Since the \picture environment will only be
interpreted by LaTeX (either when processing the whole document, or via
images.tex), this should do no harm...
> > but I thought that's exactly what image generation was all about --
> > passing the bits that LaTeX2HTML doesn't understand to the actual
> > LaTeX for processing...
>
> The \begin{latexonly} and %begin{latexonly} environments
> are only included when LaTeX is in control of the complete
> document. These are *not* included as part of images.tex .
>
> The \begin{imagesonly} environment passes extra material
> to images.tex but should be ignored by LaTeX when doing
> the whole document.
> In this case it means duplicating your definitions, but
> this isn't the only use for such an environment.
I would like to avoid the duplication of definitions, if at all possible
(there are quite a few of them, what I sent is a stripped-down testcase).
I've tried to put the \ovalbox definition outside of the %begin{latexonly}
environment, but that didn't work. The images.tex file contained a
garbled version of the \ovalbox definition (attached).
> > I'm also attaching the generated images.tex file. Please let me know if
> > more detail is needed. Thanks,
> > Igor
>
> Alternatively, put your definitions into a .sty file, mydefs.sty say,
> and then \usepackage{mydefs}. You will need to place mydefs.sty in a
> place where it can be found by LaTeX when needed.
Right, that's another thing to consider. I may have to resort to that.
> Hope this helps,
> Ross
It does, thanks.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ [EMAIL PROTECTED]
ZZZzz /,`.-'`' -. ;-;;,_ [EMAIL PROTECTED]
|,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
\batchmode
\documentclass{article}
\RequirePackage{ifthen}
\makeatletter
[EMAIL PROTECTED]
\long
\makeatother
\usepackage[dvips]{color}
\pagecolor[gray]{.7}
\usepackage[]{inputenc}
\makeatletter
\makeatletter
[EMAIL PROTECTED] \catcode`\_=8
\newenvironment{tex2html_wrap}{}{}%
\catcode`\<=12\catcode`\_=\count@
\newcommand{\providedcommand}[1]{\expandafter\providecommand\csname
#1\endcsname}%
\newcommand{\renewedcommand}[1]{\expandafter\providecommand\csname
#1\endcsname{}%
\expandafter\renewcommand\csname #1\endcsname}%
\newcommand{\newedenvironment}[1]{\newenvironment{#1}{}{}\renewenvironment{#1}}%
\let\newedcommand\renewedcommand
\let\renewedenvironment\newedenvironment
\makeatother
\let\mathon=$
\let\mathoff=$
\ifx\AtBeginDocument\undefined \newcommand{\AtBeginDocument}[1]{}\fi
\newbox\sizebox
\setlength{\hoffset}{0pt}\setlength{\voffset}{0pt}
\addtolength{\textheight}{\footskip}\setlength{\footskip}{0pt}
\addtolength{\textheight}{\topmargin}\setlength{\topmargin}{0pt}
\addtolength{\textheight}{\headheight}\setlength{\headheight}{0pt}
\addtolength{\textheight}{\headsep}\setlength{\headsep}{0pt}
\setlength{\textwidth}{349pt}
\newwrite\lthtmlwrite
\makeatletter
\let\realnormalsize=\normalsize
\global\topskip=2sp
[EMAIL PROTECTED]@float [EMAIL PROTECTED]@float
[EMAIL PROTECTED]@[EMAIL PROTECTED]@float}
[EMAIL PROTECTED]@math\fi}
[EMAIL PROTECTED]@[EMAIL PROTECTED]@savefreelist}
[EMAIL PROTECTED]@dbflt [EMAIL PROTECTED]@float
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]@[EMAIL PROTECTED]@dbflt}
\def\adjustnormalsize{\def\normalsize{\mathsurround=0pt \realnormalsize
\parindent=0pt\abovedisplayskip=0pt\belowdisplayskip=0pt}%
\def\phantompar{\csname par\endcsname}\normalsize}%
\def\lthtmltypeout#1{{\let\protect\string \immediate\write\lthtmlwrite{#1}}}%
\newcommand\lthtmlhboxmathA{\adjustnormalsize\setbox\sizebox=\hbox\bgroup\kern.05em
}%
\newcommand\lthtmlhboxmathB{\adjustnormalsize\setbox\sizebox=\hbox
to\hsize\bgroup\hfill }%
\newcommand\lthtmlvboxmathA{\adjustnormalsize\setbox\sizebox=\vbox\bgroup %
\let\ifinner=\iffalse \let\)[EMAIL PROTECTED] }%
[EMAIL PROTECTED]@[EMAIL PROTECTED]
\expandafter\box\next\egroup}%
\newcommand\lthtmlmathtype[1]{\gdef\lthtmlmathenv{#1}}%
\newcommand\lthtmllogmath{\lthtmltypeout{l2hSize %
:\lthtmlmathenv:\the\ht\sizebox::\the\dp\sizebox::\the\wd\sizebox.\preveqno}}%
[EMAIL PROTECTED]@freelist
\lthtmlmathtype{#1}\lthtmlvboxmathA}%
\newcommand\lthtmlpictureA{\bgroup\catcode`\_=8 \lthtmlpictureB}%
\newcommand\lthtmlpictureB[1]{\lthtmlmathtype{#1}\egroup
[EMAIL PROTECTED]@freelist \lthtmlhboxmathB}%
\newcommand\lthtmlpictureZ[1]{\hfill\lthtmlfigureZ}%
\newcommand\lthtmlfigureZ{\lthtmlboxmathZ\lthtmllogmath\copy\sizebox
[EMAIL PROTECTED]@savefreelist}%
\newcommand\lthtmldisplayA{\bgroup\catcode`\_=8 \lthtmldisplayAi}%
\newcommand\lthtmldisplayAi[1]{\lthtmlmathtype{#1}\egroup\lthtmlvboxmathA}%
\newcommand\lthtmldisplayB[1]{\edef\preveqno{(\theequation)}%
[EMAIL PROTECTED]
\newcommand\lthtmldisplayZ{\lthtmlboxmathZ\lthtmllogmath\lthtmlsetmath}%
\newcommand\lthtmlinlinemathA{\bgroup\catcode`\_=8 \lthtmlinlinemathB}
\newcommand\lthtmlinlinemathB[1]{\lthtmlmathtype{#1}\egroup\lthtmlhboxmathA
\vrule height1.5ex width0pt }%
\newcommand\lthtmlinlineA{\bgroup\catcode`\_=8 \lthtmlinlineB}%
\newcommand\lthtmlinlineB[1]{\lthtmlmathtype{#1}\egroup\lthtmlhboxmathA}%
\newcommand\lthtmlinlineZ{\egroup\expandafter\ifdim\dp\sizebox>0pt %
\expandafter\centerinlinemath\fi\lthtmllogmath\lthtmlsetinline}
\newcommand\lthtmlinlinemathZ{\egroup\expandafter\ifdim\dp\sizebox>0pt %
\expandafter\centerinlinemath\fi\lthtmllogmath\lthtmlsetmath}
\newcommand\lthtmlindisplaymathZ{\egroup %
\centerinlinemath\lthtmllogmath\lthtmlsetmath}
\def\lthtmlsetinline{\hbox{\vrule width.1em \vtop{\vbox{%
\kern.1em\copy\sizebox}\ifdim\dp\sizebox>0pt\kern.1em\else\kern.3pt\fi
\ifdim\hsize>\wd\sizebox \hrule depth1pt\fi}}}
\def\lthtmlsetmath{\hbox{\vrule width.1em\kern-.05em\vtop{\vbox{%
\kern.1em\kern0.8 pt\hbox{\hglue.17em\copy\sizebox\hglue0.8 pt}}\kern.3pt%
\ifdim\dp\sizebox>0pt\kern.1em\fi \kern0.8 pt%
\ifdim\hsize>\wd\sizebox \hrule depth1pt\fi}}}
\def\centerinlinemath{%
\dimen1=\ifdim\ht\sizebox<\dp\sizebox \dp\sizebox\else\ht\sizebox\fi
\advance\dimen1by.5pt \vrule width0pt height\dimen1 depth\dimen1
\dp\sizebox=\dimen1\ht\sizebox=\dimen1\relax}
\def\lthtmlcheckvsize{\ifdim\ht\sizebox<\vsize
\ifdim\wd\sizebox<\hsize\expandafter\hfill\fi \expandafter\vfill
\else\expandafter\vss\fi}%
\providecommand{\selectlanguage}[1]{}%
\makeatletter \tracingstats = 1
\providecommand{\Beta}{\textrm{B}}
\providecommand{\Mu}{\textrm{M}}
\providecommand{\Kappa}{\textrm{K}}
\providecommand{\Rho}{\textrm{R}}
\providecommand{\Epsilon}{\textrm{E}}
\providecommand{\Chi}{\textrm{X}}
\providecommand{\Iota}{\textrm{J}}
\providecommand{\omicron}{\textrm{o}}
\providecommand{\Zeta}{\textrm{Z}}
\providecommand{\Eta}{\textrm{H}}
\providecommand{\Omicron}{\textrm{O}}
\providecommand{\Nu}{\textrm{N}}
\providecommand{\Tau}{\textrm{T}}
\providecommand{\Alpha}{\textrm{A}}
\begin{document}
\pagestyle{empty}\thispagestyle{empty}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength hsize=\the\hsize}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength vsize=\the\vsize}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength hoffset=\the\hoffset}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength voffset=\the\voffset}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength topmargin=\the\topmargin}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength topskip=\the\topskip}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength headheight=\the\headheight}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength headsep=\the\headsep}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength parskip=\the\parskip}\lthtmltypeout{}%
\lthtmltypeout{latex2htmlLength
oddsidemargin=\the\oddsidemargin}\lthtmltypeout{}%
\makeatletter
[EMAIL PROTECTED] evensidemargin=\the\evensidemargin}%
\else\lthtmltypeout{latex2htmlLength evensidemargin=\the\oddsidemargin}\fi%
\lthtmltypeout{}%
\makeatother
\setcounter{page}{1}
\onecolumn
% !!! IMAGES START HERE !!!
{\newpage\clearpage
\lthtmlfigureA{figure15}%
\begin{figure}\begin{picture}(100,20)(0,0)
\put(50,10)[EMAIL PROTECTED]@[EMAIL PROTECTED]@x{Testing [EMAIL
PROTECTED]@[EMAIL PROTECTED]@x}}
\end{picture}
\end{figure}%
\lthtmlfigureZ
\lthtmlcheckvsize\clearpage}
\end{document}
_______________________________________________
latex2html mailing list
latex2html@tug.org
http://tug.org/mailman/listinfo/latex2html