TeX4ht: Low-level Commands

\HCode and \Tg

These are the two commands used in TeX4ht to insert target markup elements as \specials into the dvi file which are then extracted while post-processing with tex4ht binary program. \Tg has the following syntax:

  \Tg<#1>

Between the angle brackets, you might add whatever markup you need to insert. The examples sited above to explain the functionality of \Configure command make use of \Tg. It is fit for inserting a single element with or without attributes. The angle brackets act as delimiters.

The functionality of \HCode command is also the same, except that there are no delimiters, which allows one to insert any kind of arbitrary code as arguments to \HCode.

  \HCode{<section id="}%
    \stepcounter{sctr}sec.\thesctr%
   \HCode{">}

This will generate the following HTML element in the output, assuming that we have 9 as the value for \thesctr:

  <section id="sec.9">

TeX4ht has already defined \Configure with different numbers of hooks for commonly used commands in LaTeX and several popular packages used in LaTeX. However, if you want to manipulate any of the default structure or want to add extra functionality over those already available, \NewConfigure comes handy and above explanation might be of help to explore further.

Pages: 1 2

2 Responses to “TeX4ht: Low-level Commands”


Leave a Reply