TeXML
Previous step: “Better layout

PDF literal strings

Let's start with the following LaTeX code:

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage{hyperref}
\begin{document}
\section{Заголовок (Title)}
Текст (Text)
\end{document}

The code looks fine, but due to the Russian letters, LaTeX raises the errors:

Package hyperref Warning: Glyph not defined in PD1 encoding,
(hyperref)                removing `\CYRZ' on input line 6.
...

A possible solution is to use "\usepackagep[unicode]{hyperref}", but this solution is not generic. For example, for CJK texts, it fails with some obscure error like:

! Incomplete \ifx; all text was ignored after line 10.

I prefer to use a generic solution which uses the unicode strings for the pdf names:

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage[unicode]{hyperref}
\begin{document}
\section[ \texorpdfstring{Заголовок (Title)}{\004\027\004\060\004\063
\004\076\004\073\004\076\004\062\004\076\004\072\000\040\000\050\000
\124\000\151\000\164\000\154\000\145\000\051}
]{Заголовок (Title)} Текст (Text)
\end{document}

Comparing to the previous example, I use

The content of texorpdfstring is created by the TeXML command pdf:

<TeXML>
<TeXML escape="0">
\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[koi8-r]{inputenc}
\usepackage[unicode]{hyperref}
</TeXML>
<env name="document">
  <cmd name="section">
    <opt>
      <cmd name="texorpdfstring">
        <parm>Заголовок (Title)</parm>
        <parm><pdf>Заголовок (Title)</pdf></parm>
      </cmd>
    </opt>
    <parm>Заголовок (Title)</parm>
  </cmd>
  Текст (Text)
</env>
</TeXML>

Next step: “TeXML and XSLT


TeXML
This page: http://getfo.org/texml/tour_pdf.html