Text Formattinghyperref, t1enc and \H{o}

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Major
Posts: 8
Joined: Fri Feb 18, 2011 7:39 pm

hyperref, t1enc and \H{o}

Post by Major »

Hello

My problem is with the hyperref and t1enc package.
I use MikTex and recently updated it's packages.
Since then when I use the hyperref and t1enc packages,
I can't write the \H{o} accented char to the pdftitle
for example. It prints a circled R instead.

See the mwe.tex for details.

The title in the document prints an ő correctly

The input file's encoding is UTF-8 without BOM.

What can be done to solve this? If i don't use t1enc
it prints o125 o in the pdftitle.

Major
Attachments
mwe.tex
The minimal working example
(191 Bytes) Downloaded 362 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

hyperref, t1enc and \H{o}

Post by localghost »

The t1enc package is obsolete [1]. A modified version of your example works partway if you swap the option to \hypersetup.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}

\hypersetup{%
  pdftitle={The title with \H{o}}
}

\title{The title with \H{o}}

\begin{document}
  \maketitle
\end{document}
But you will get a warning.

Code: Select all

Package hyperref Warning: Glyph not defined in PD1 encoding,
(hyperref)                removing `\H' on input line 6.
Perhaps the fontenc manual has an answer since it seems to be a problem of font encoding (although the warning comes from hyperref).

[1] View topic: Obsolete packages and document classes — Avoid usage!


Thorsten
Major
Posts: 8
Joined: Fri Feb 18, 2011 7:39 pm

Re: hyperref, t1enc and \H{o}

Post by Major »

Hello

Thanks, then I will not use t1enc package.

I compiled your code, saw the warning but in
the pdf title there is only an o not ő.

So it's better but still not good enough.
What can I do?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

hyperref, t1enc and \H{o}

Post by localghost »

I get the correct character in the title. But if you are able to insert the „ő“ here, then you can also insert it directly in the source.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[unicode]{hyperref}

\hypersetup{%
  pdftitle={The title with ő}
}

\title{The title with ő}

\begin{document}
  \maketitle
\end{document}
That's what the inputenc package is for. And I also remembered and additional option for the hyperref package (see code above). This works fine for me. And the warning also vanished.
Major
Posts: 8
Joined: Fri Feb 18, 2011 7:39 pm

Re: hyperref, t1enc and \H{o}

Post by Major »

Thanks, now it's perfect!
Extra thanks for the quick solution!

Major
Post Reply