[tex4ht] [bug #309] tex4ht does not work with package savetrees

Michal Hoftich michal.h21 at gmail.com
Wed Jun 8 15:08:34 CEST 2016


I've just tried this method with fontspec, and it seems to work! This
is updated usepackage.4ht:


%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% usepackage.4ht                        2009-05-21-09:32 %
% Copyright (C) 2003--2009       Eitan M. Gurari         %
%                                                        %
% This work may be distributed and/or modified under the %
% conditions of the LaTeX Project Public License, either %
% version 1.3c of this license or (at your option) any   %
% later version. The latest version of this license is   %
% in                                                     %
%   http://www.latex-project.org/lppl.txt                %
% and version 1.3c or later is part of all distributions %
% of LaTeX version 2005/12/01 or later.                  %
%                                                        %
% This work has the LPPL maintenance status "maintained".%
%                                                        %
% This Current Maintainer of this work                   %
% is Eitan M. Gurari.                                    %
%                                                        %
% If you modify this program your changing its signature %
% with a directive of the following form will be         %
% appreciated.                                           %
%            \message{signature}                         %
%                                                        %
%                             gurari at cse.ohio-state.edu  %
%                 http://www.cse.ohio-state.edu/~gurari  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\immediate\write-1{version 2009-05-21-09:32}


   \def\:temp{tex4ht}\ifx \:temp\@currname
   \:warning{\string\usepackage{tex4ht} again?}
   \def\:temp#1htex4ht.def,tex4ht.sty#2!*?: {\def\:temp{#2}}
\expandafter\:temp \@filelist htex4ht.def,tex4ht.sty!*?: %
\ifx \:temp\empty  \else
   \:warning{if
    \string\RequirePackage[tex4ht]{hyperref} or
    \string\usepackage[tex4ht]{hyperref} was
    used try instead, repectively,
    \string\RequirePackage{hyperref} or
    \string\usepackage{hyperref}}
\fi

\fi
\gdef\a:usepackage{\use:package xr,xr-hyper,savetrees,fontspec,,!*?: }
\gdef\use:package#1,{%
   \if :#1:\def\:temp##1!*?: {}\else
      \def\:temp{#1}\ifx \@currname\:temp
             \def\:temp##1!*?: {\input usepackage.4ht  }%
      \else \let\:temp=\use:package \fi
   \fi \:temp}
\def\:temp{xr}\ifx \@currname\:temp
   \AtEndOfPackage{\let\XR:\XR@
   \def\XR@[#1]#2{%
    \Configure{AtBeginDocument}{\XR:[#1]{#2}}{}}%
}

\fi
\def\:temp{xr-hyper}\ifx \@currname\:temp
   \AtEndOfPackage{\let\XR:\XR@
   \def\XR@[#1]#2{%
    \Configure{AtBeginDocument}{\XR:[#1]{#2}}{}}%
}

\fi

\def\:temp{savetrees}\ifx \@currname\:temp
\:dontusepackage{savetrees}
\typeout{\@nameuse{opt at savetrees.sty}}
\fi

\def\:temp{fontspec}\ifx \@currname\:temp
\:dontusepackage{fontspec}
\usepackage{fontspec-alt4ht}
\fi

\endinput


%%%%%%%%%%

It uses package fontspec-alt4ht from helpers4ht bundle to provide some
basic Fontspec commands used in the documents. I've fixed some bugs in
this package and also in make4ht, so it needs to be updated. Now it
seems to work with both LuaTeX and XeTeX!:

%%%%%
\documentclass{article}

\usepackage{fontspec}
\setmainfont{CMU Serif}[Ligatures={TeX}]
\begin{document}

Příliš žluťoučký kůň
 которые включены во все современные дистрибутивы
\end{document}
%%%%%%

Michal



More information about the tex4ht mailing list