[tex4ht] \TeX -> TeX

William F Hammond hammond at csc.albany.edu
Mon Feb 19 20:06:19 CET 2018


Michal Hoftich <michal.h21 at gmail.com> writes:

> On Mon, Feb 19, 2018 at 12:06 AM, Karl Berry <karl at freefriends.org> wrote:
>> Does anyone know if there is an easy way to make htlatex generate a
>> plain text "TeX" for \TeX, ditto "LaTeX" for \LaTeX?  I mean, a "native"
>> way at the tex4ht level, rather than redefining the macros in TeX or
>> postprocessing the HTML with sed, etc.  --thanks, karl.
. . .

> \Preamble{xhtml}
> \def\LaTeX{LaTeX}
> \begin{document}
> \EndPreamble

There's a way, originating for me from David Carlisle some
years ago, to do this so that one gets the typeset emulation
when CSS is effective and otherwise just "LaTeX" when CSS is
not available, as in a terminal window browser like "lynx"
or "w3m".

For that:

\def\LaTeX{<span class="ltxn">L<span class="ltxna">a</span>T<span class="ltxna">e</span>X</span>}

along with the insertion of the following CSS in some appropriate place:

-------------------------
span.ltxn{
  display: inline-block;
  text-indent: 0;
}
span.ltxna{
  display: inline-block;
  font-size: 75%;
  text-transform: uppercase;
  vertical-align: .5ex;
  margin-left: -.48em;
  margin-right: -.2em;
}
span.ltxne{
  display: inline-block;
  vertical-align:-.5ex;
  text-transform: uppercase;
  margin-left: -.18em;
  margin-right: -.12em;
  margin-bottom: -0.5ex;
}
-------------------------

With slightly more advanced CSS one can omit the class names
on the sub-spans and use "child" specs.


                                    -- Bill



More information about the tex4ht mailing list