> I love the idea. IMHO it's a proper way of doing. > It' far better that "\ifdefined\HCode" conditional in tex file. >
Sure, the conditional compilation should be the last resort. There is a patch for savetrees and fontspec, as I said, it needs testing, as there is potentially dangerous change. Also, fontspec-alt4ht.sty isn't on CTAN yet, as it doesn't have proper documentation. Also, I've changed xhlatex calls in the Makefile to mk4ht xhlatex, as xhlatex script seems to be missing in TL. Michal
Index: Makefile =================================================================== --- Makefile (revision 170) +++ Makefile (working copy) @@ -19,7 +19,7 @@ geometry.4ht graphicx.4ht hyperref.4ht listings.4ht \ memoir.4ht multicol.4ht quoting.4ht reading.4ht \ scrartcl.4ht scrbook.4ht scrreprt.4ht spanish.4ht subscript.4ht \ - titlesec.4ht tocloft.4ht wrapfig.4ht + titlesec.4ht tocloft.4ht wrapfig.4ht usepackage.4ht # and many, many more. derived += $(tex4ht_bibtex2_derived) @@ -46,6 +46,10 @@ derived += $(tex4ht_fonts_cjk_utf8_derived) tex4ht_fonts_cjk_utf8_derived = tex4ht-fonts-cjk-utf8.html # and lots more + +derived += $(tex4ht_sty_derived) +tex4ht_sty_derived = tex4ht.sty + # noncjk.tex \input's modern, but seems more maintainable # to have separate lists. derived += $(tex4ht_fonts_noncjk_derived) @@ -206,10 +210,10 @@ tex $(tex_opts) cond4ht.4ht $(tex4ht_docbook_derived): tex4ht-docbook.tex $(common) - xhlatex $< "html,3" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3" "" "-d./" $(tex_1opt) $(tex4ht_docbook_xtpipes_derived): tex4ht-docbook-xtpipes.tex $(common) - xhlatex $< "html,3" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3" "" "-d./" $(tex_1opt) $(tex4ht_env_derived): tex4ht-env.tex $(common) htlatex $< "xhtml,3" "" "-d./" $(tex_1opt) @@ -228,16 +232,16 @@ ht tex $< $(tex4ht_html_speech_derived): tex4ht-html-speech.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_html_speech_xtpipes_derived): tex4ht-html-speech-xtpipes.tex $(common) htlatex $< "html,next,3" "" "-d./" $(tex_1opt) $(tex4ht_html0_derived): tex4ht-html0.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_html32_derived): tex4ht-html32.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) # must create/update html4.4ht-released by hand. $(tex4ht_html4_derived): tex4ht-html4.tex $(common) @@ -247,7 +251,7 @@ latex $(tex_opts) $< $(tex4ht_info_html4_derived): tex4ht-info-html4.tex $(common_info) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_info_javahelp_derived): tex4ht-info-javahelp.tex $(common_info) htlatex $< "html,sections+" "" "-d./" $(tex_1opt) @@ -262,31 +266,31 @@ htlatex $< "html,sections+" "" "-d./" $(tex_1opt) $(tex4ht_info_derived): tex4ht-info.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_javahelp_derived): tex4ht-javahelp.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_javahelp_xtpipes_derived): tex4ht-javahelp-xtpipes.tex $(common) htlatex $< "xhtml,next,3" "" "-d./" $(tex_1opt) $(tex4ht_jsmath_derived): tex4ht-jsmath.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_jsml_xtpipes_derived): tex4ht-jsml-xtpipes.tex $(common) htlatex $< "xhtml,next,3" "" "-d./" $(tex_1opt) $(tex4ht_jsml_derived): tex4ht-jsml.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_mathltx_derived): tex4ht-mathltx.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_mathml_derived): tex4ht-mathml.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_mathplayer_derived): tex4ht-mathplayer.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_misc_derived): tex4ht-misc.tex $(common) ht tex $< @@ -297,7 +301,7 @@ latex $(tex_opts) mkht-scripts.4ht $(tex4ht_moz_derived): tex4ht-moz.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_oo_xtpipes_derived): tex4ht-oo-xtpipes.tex $(common) htlatex $< "xhtml,next,3" "" "-d./" $(tex_1opt) @@ -315,19 +319,19 @@ ht tex $< $(tex4ht_svg_derived): tex4ht-svg.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_t4ht_derived): tex4ht-t4ht.tex $(common) ht tex $< $(tex4ht_tei_derived): tex4ht-tei.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_unicode_derived): tex4ht-unicode.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_word_derived): tex4ht-word.tex $(common) - xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) + mk4ht xhlatex $< "html,3,sections+" "" "-d./" $(tex_1opt) $(tex4ht_xhtml_xtpipes_derived): tex4ht-xhtml-xtpipes.tex $(common) htlatex $< "xhtml,3,next" "" "-d./" $(tex_1opt) Index: tex4ht-4ht.tex =================================================================== --- tex4ht-4ht.tex (revision 170) +++ tex4ht-4ht.tex (working copy) @@ -3431,6 +3431,34 @@ >>> %%%%%%%%%%%%%%%%%% +\Section{savetrees.sty} +%%%%%%%%%%%%%%%%%% + +\<use package\><<< +savetrees,>>> + +\<add to usepackage\><<< +\def\:temp{savetrees}\ifx \@currname\:temp +\:dontusepackage{savetrees} +\fi +>>> + +%%%%%%%%%%%%%%%%%% +\Section{fontspec.sty} +%%%%%%%%%%%%%%%%%% + +\<use package\><<< +fontspec,>>> + +\<add to usepackage\><<< +\def\:temp{fontspec}\ifx \@currname\:temp +\:dontusepackage{fontspec} +\usepackage{fontspec-alt4ht} +\fi +>>> + + +%%%%%%%%%%%%%%%%%% \Section{url.sty} %%%%%%%%%%%%%%%%%% Index: tex4ht-sty.tex =================================================================== --- tex4ht-sty.tex (revision 170) +++ tex4ht-sty.tex (working copy) @@ -560,6 +560,7 @@ |<try taking care of hyperref.sty|> |<early latex subs/sups|> \fi +|<block package loading|> |<hook at usepackage|> >>> @@ -570,15 +571,23 @@ \expandafter\def\csname o...@hyperref.sty\endcsname{tex4ht} >>> +\<block package loading\><<< +\def\:dontusepackage#1{% + \@namedef{ver@#1.sty}{9999/12/31}% + \@namedef{opt@#1.sty}{\:currentoptions} +} +>>> + \<hook at usepackage\><<< \let\:onefilewithoptions\@onefilewithoptions -\def\@onefilewithoptions#1[{% +\def\@onefilewithoptions#1[#2]{% \let\:temp\@reset@ptions \def\@reset@ptions{% \let\@reset@ptions\:temp |<cats for usepackage|>\a:usepackage |<recall usepackage cats|>}% - \:onefilewithoptions#1[} + \def\:currentoptions{#2} + \:onefilewithoptions#1[#2]} \def\a:usepackage{\input usepackage.4ht } >>> @@ -593,7 +602,6 @@ \TivhTcats >>> - %%%%%%%%%%%%%%%%%%%%%%%%% \Section{Second Pass} %%%%%%%%%%%%%%%%%%%%%%%%%