1

Let's say I have a simple document having some sections and Unicode and/or math in their titles. How to produce a decent PDF output? By that I mean:

  • It contains correct metadata.
  • It contains correct bookmarks.
  • It is a PDF/A document.

I have produced the following example. (I know that it may not be a good idea to have that much math and Unicode in titles, but to some extent it's ok, and the source below is just an example.)

\begin{filecontents*}{\jobname.xmpdata}
\Title{Properties of ℝ^ω} 
\Author{Foo Barovič\sep Baz Pequeño} 
\end{filecontents*}

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[nomath]{lmodern}
\usepackage{amssymb}
\usepackage[a-2u]{pdfx}

\pdfstringdefDisableCommands{
    \def\omega{ω}
}
\begin{document}
    \title{Properties of $\mathbb{R}^\omega$}
    \author{Foo Barovič, Baz Pequeño}
    \date{}
    \maketitle

    \section{\texorpdfstring
            {Basic properties of $\mathbb{R}^\omega$}
            {Basic properties of ℝ\textasciicircumω}
        }
        Here we shall talk about the basic properties.

        \subsection{\texorpdfstring
                {$\mathbb{R}^\omega$ vs.\ $\bigcup_{n \in \omega} \mathbb{R}^n$ according to Pequeño}
                {ℝ\textasciicircumω vs. ⋃\_\{n ∈ ω\} ℝ\textasciicircum n according to Pequeño}
            }
            A short note about this inductive limit approach.

    \section{\texorpdfstring
            {Advanced properties of $\mathbb{R}^\omega$}
            {Advanced properties of ℝ\textasciicircum\omega}
        }
        Here we shall talk about the advanced properties.

\end{document}

What still annoys me:

  • The duplicities in titles. It is possible to map a Unicode character to a macro via the inputenc package. For PDF bookmarks the situation is opposite: it is possible to map macros to Unicode characters using \pdfstringdefDisableCommands. This works well for \omega or \bigcup, but what to do with superscripts, subscripts, groups, $, and \mathbb{R}? Is there a way to declare that ^, _, {, } should be taken literally, $ should be ignored, and \mathbb{R} means ℝ? Then, \texorpdfstring won't be needed.
  • The duplicities in the main title and authors.
  • The fact that filecontents* does not rewrite existing document. I know this can be changed by filecontents package, but it still emits a warning, and it cannot be loaded before \documentclass, while generating of xmpdata is recommended before \documentclass.

I'd be glad for any tips or tricks in improving the given source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.