Purpose
-------
A package to help creating 4ht files for configuring seeded hooks.
A sample self-explanatory template file make-4ht.tex is shown at the
end. The sample file can be retrieved in ascii form from the file
info4ht.4ht.
General Information
-------------------
To get a better understanding of the structural meaning of some of the
available hooks
a. Compile the mktex4ht.4ht file with the ‘htlatex mktex4ht.4ht’
command (or, ‘xhlatex mktex4ht.4ht’ for XHTML output).
Visit the links in the index of the outcome ‘mktex4ht.html’ file.
b. Compile your sorce file with a command similar to
htlatex filename "html,info" "" "-p"
and check the source file.
c. Compile your sorce file with a command similar to
htlatex filename "html,0.0,hooks" "" "-p"
and view the outcome with a html browser.
d. Take a look at the *.4ht configuration files mentioned in tex4ht.4ht.
Setting up a calling command
----------------------------
i. Create a tex4ht.usr file, and introduce there \Configure command(s)
similar to those found in tex4ht.4ht. For instance,
\Configure{foo}{%
\Hinclude[*]{myhtml.4ht}%
\Hinclude[*]{mymath.4ht}%
}
Choose arbitrary name in the first argument, and include *.4ht
configuration files of your liking in the second argument.
You might want to temporarily include also the file html0.4ht, as a
first entry, while constructing new *.4ht configuration files. For
instance,
\Configure{foo}{%
\Hinclude[*]{html0.4ht}%
\Hinclude[*]{myhtml.4ht}%
\Hinclude[*]{mymath.4ht}%
}
ii. A configuration setting may be loaded by mentioning its name
within the option list of the htlatex command. For instance,
htlatex filename "xhtml,foo" "unicode/!" "-p"
iii. Alternatively, a htlatex-like command can be tailored to
automatically load a configuration setting. That can be done
by including the name in the argument list of
\csname tex4ht\endcsname, within the script of the command. For
instance, replace ‘docbook’ with ‘foo’ in the script of dblatex.
Defining a New Configuration File with mktex4ht.4ht
---------------------------------------------------
1. Define a parameter-less macro \HTML to hold a comma separeted list
of the output file names. Place the definition at the top of the
source document. For instance
\def\HTML{myhtml,mymath}
request the files myhtml.4ht and mymath.4ht.
2. Define a parameter-less macro \CONFIG to hold the name of the file
containing the contributed configurations. Place the definition at
the top of the source document.
3. The configurations contributed to output file YYYY.4ht for style
XXXX should be provided within code fragments of the form
\<configure XXXX YYYY\><<<
.......
>>>
Arbitrary valid LaTeX source code may be inserted around the code
fragments.
Example:
Configurations for class book.cls:
\<configure myhtml book\><<<
\Configure{chapter} {...}{...}{...}{...}
\Configure{section} {...}{...}{...}{...}
>>>
Configurations for class article.cls:
\<configure mymath article\><<<
\Configure{section} {...}{...}{...}{...}
>>>
The hooks are provided in book.4ht and article.4ht.
4. Define a parameter-less macro \MAKETITLE with contribution for
the \maketitle command (e.g., \def\MAKETITLE{\title{my name}}). Place
the definition at the top of the source document.
5. A file may reload itself, if it starts with preamble similar to
the following one.
\ifx \HTML\UnDef
\def\HTML{...}
\def\CONFIG{\jobname}
\def\MAKETITLE{\author{...}}
\def\next{\input mktex4ht.4ht \endinput}
\expandafter\next
\fi
A Template File make-4ht.tex
-----------------------------
%--------------------- start of template -----------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% make-4ht.4ht Eitan M. Gurari
%
% A sample file with instructions for creating 4ht
% configuration files through literate programming.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% * Compile this file twice with the command ‘latex make-4ht’
% (or with ‘htlatex make-4ht’)
%
% * Inspect the outcome files sample.4ht and example.4ht
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% * Change ‘sample,example’ in (1) below to a comma-separated list
% of your choice. Each entry in the list stands for a name
% of a 4ht configuration file to be created. The current list
% requests the configuration files ‘sample.4ht’ and ‘example.4ht’.
%
% * Change ‘my title’ in (2), and ‘my name’ in (3), to a
% content of your choice
%
% * Go to (4)
%
%%%%%%%%%%%%%%%%%% load style files %%%%%%%%%%%%%%%%%%%%%%%%%%
\ifx \HTML\UnDef
\def\HTML{sample,example} %<------------ (1)
\def\CONFIG{\jobname}
\def\MAKETITLE{\title{my title}% %<------------ (2)
\author{my name}} %<------------ (3)
\def\next{\input mktex4ht.4ht \endinput}
\expandafter\next
\fi
%%%%%%%%%%%%%%%%%%%%% useful definitions %%%%%%%%%%%%%%%%%%%%%
\newcount\tmpcnt \tmpcnt\time \divide\tmpcnt 60
\edef\temp{\the\tmpcnt}
\multiply\tmpcnt -60 \advance\tmpcnt \time
\edef\version{\the\year-\ifnum \month<10 0\fi
\the\month-\ifnum \day<10 0\fi\the\day
-\ifnum \temp<10 0\fi \temp
:\ifnum \tmpcnt<10 0\fi\the\tmpcnt}
\def\CopyYear.#1.{%
\ifnum #1=\year #1\space\space\space\space\space\space
\else #1--\the\year\fi
}
%<--------------------------------------------------------------- (4)
%
% * The code for the configuration files is to be written within
% fragments of the form
%
% \<fragment name\><<<
% fragment content
% >>>
%
% * References from code fragments to other code fragments should
% take the form
%
% |<fragment name|>
%
% * The character | is treated as an escape character
% within the code fragments. References to the
% character should take the form
%
% ||
%
% * Insertions outside the code fragments are ignored in the
% configuration files, and they should abide to the latex
% conventions.
%
% * Change all the prose and code fragments below to meet
% your needs. Make sure to follow the given instructions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Root Code}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<--------------------------------------------------------------- (5)
%
% * For each entry in the list of (1), you may have arbitrary many
% code fragments named by the entry.
%
% * The order of fragments is relevant only among those having
% identical names.
%
\<sample\><<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sample.4ht |version %
|<copyright statement|>
>>>
\<example\><<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% example.4ht |version %
|<copyright statement|>
>>>
\<copyright statement\><<<
% Copyright (C) |CopyYear.2000. my name %
% %
% My copyright statement %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\immediate\write-1{version |version}
>>>
%<--------------------------------------------------------------- (6)
%
% * Each configuration of tex4ht requires a base 4ht configuration
% file containing the following ‘Hinclude’ code.
% * The supplied html4.4ht, html32.4ht, html0.4ht, tei.4t,
% and docbook.4ht files already include such code.
%
% * In a compilation of a file, exactly one 4ht configuration
% file should load ‘Hinclude’ code.
%
% * Either remove the following three code fragments, or replace
% ‘sample’ in their titles with an entry from (1)
%
\<configure sample tex4ht\><<<
\if:latex |<Hinclude latex|>
\else |<Hinclude plain|> \fi
>>>
\<configure sample plain\><<<
|<Hinclude plain lib|>
|<Hinclude plain + latex lib|>
>>>
\<configure sample latex\><<<
|<Hinclude latex lib|>
|<Hinclude plain + latex lib|>
>>>
\endinput
%--------------------- end of template -------------------
-_-_-