[tex4ht] [glossaries] First (long) occurrence of an acronym not long in title

Michal Hoftich michal.h21 at gmail.com
Wed Apr 2 17:49:38 CEST 2014


Hi Denis,

I just have found this old question at TeX.sx [1]. Although you use
different package for the acronyms than is used in that question, the
issue is same. Long form of acronym is used only on first acronym use,
but when you use it in the `\title`, you are using it actually at two
places - in the `<title>` element in html header and then the title
block in your document body. Full acronym is obviously printed only in
the html header, which is a first use.

Your sample produces following html:

...
<head><title>TE X for HTML (TE X4ht)</title>
...
<div class="maketitle">
<h2 class="titleHead"><a
href="#glo:tex4ht">TE X4ht</a></h2>
...


Some solutions exist, first and easier is to not use acronyms in the
title, second is to use custom config file with configuration for the
TITLE+ hook:

file denis.cfg:


\Preamble{xhtml}
\Configure{TITLE+}{TeX for HTML}
\begin{document}
\EndPreamble

now you can compile your document with

htlatex test denis

and resulting document contains:

...
<head> <title>TeX for HTML</title>
...
<h2 class="titleHead"><a
href="#glo:tex4ht">TE X for HTML (TE X4ht)</a></h2>
...

Best regards,
Michal

[1] http://tex.stackexchange.com/q/169142/2891

2012-09-07 16:29 GMT+02:00 Denis Bitouzé <dbitouze at wanadoo.fr>:
> Hi,
>
> consider the following test.tex MCE:
>
> \documentclass{article}
> \usepackage[nonumberlist]{glossaries}
> \makeglossaries
> \newacronym{tex4ht}{\TeX4ht}{\TeX{} for HTML}
> \title{\gls{tex4ht}}
> \begin{document}
> %\maketitle
> \gls{tex4ht}
> \printglossary
> \end{document}
>
> and compile it with:
>
> htlatex test
> makeglossaries test
> htlatex test
>
> Because of the commented \maketitle, the first occurrence of the
> "acronym" \gls{tex4ht} (that appears in the current text) is displayed
> correctly (long form followed by the short form in brackets).
>
> But, if the title appears (\maketitle uncommented), the fist occurrence
> of the "acronym" (that appears this time in the title) is not displayed
> correctly: it is displayed as a not first occurrence (only the short
> form is displayed). BTW, this wrong behaviour doesn't arise if the file
> is compiled with pdflatex instead of htlatex.
>
> Do you know a way to get the right behaviour ?
>
> Thanks!
> --
> Denis




More information about the tex4ht mailing list