Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperref Warning: "Glyph not defined in PU encoding" in title, author, etc., for non-Unicode input encoding #889

Open
alekhe opened this issue Feb 18, 2024 · 12 comments

Comments

@alekhe
Copy link

alekhe commented Feb 18, 2024

I’m using 8-bit input encoding and some sort of a clash happens with encodings for hyperref. For my \title, \subtitle and \author (which I set in the preamble), I get

Package hyperref Warning: Glyph not defined in PU encoding,
(hyperref)                removing `\CYRN' on input line 12.
...

The title page is correctly produced, but the PDF properties (title and author) do not contain removed symbols. Everything is alright if I use article and hyperref.

Example:

\documentclass{beamer}
%\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[cp866]{inputenc}
\usepackage[russian]{babel}
%\usepackage{hyperref}
%\hypersetup{
%	pdftitle={Название hyper},
%	pdfauthor={Автор hyper},
%}

\title{Название main}
\author{Автор main}
\begin{document}
\maketitle
\end{document}

I tried usepdftitle=false with \hypersetup{...}, and hyperref={unicode=true} in options, but no success.

Everything’s fine if UTF-8 inputenc is used.

@josephwright
Copy link
Owner

Why are you using a non-UTF-8 setup nowadays?

@samcarter
Copy link
Collaborator

@alekhe Can you double check the encoding of your file? If it works with utf8, maybe your file is actually encoded in utf8?

@josephwright
Copy link
Owner

Indeed: I'm struggling to know how to create a file with this encoding - my normal editor can't

@u-fischer
Copy link

u-fischer commented Feb 18, 2024

The encoding is a bit outdated but not really relevant. You get the same warning in utf8 with this:

\documentclass{article}
\usepackage{hyperref}
\usepackage[T2A]{fontenc}
\hypersetup{pdftitle=\CYRN}
\begin{document}
xxx
\end{document}

The problem is that hyperref only defines cyrillic commands if cyrillic has been loaded earlier.

Add this before the \documentclass command:

\providecommand\CYRDZE{}

@josephwright
Copy link
Owner

@u-fischer So not-beamers fault?

@u-fischer
Copy link

@josephwright well beamer loads hyperref a bit early. But in view that I claim that one should resolve loading order dependencies, I would say, open an issue for hyperref.

@alekhe
Copy link
Author

alekhe commented Feb 19, 2024

Why are you using a non-UTF-8 setup nowadays?

Unfortunately I have to use BibTeX, which can’t deal correctly with UTF-8 encoded bib files.

Can you double check the encoding of your file? If it works with utf8, maybe your file is actually encoded in utf8?

Yes, I checked. Moreover, if the source encoding is different from [cp866]{inputenc} then the resulting PDF will not be readable.

Indeed: I'm struggling to know how to create a file with this encoding - my normal editor can't

There are settings in TeXstudio, Notepad++, Notepad2 (et el.), Vim. I haven’t worked in TeXworks.

The encoding is a bit outdated but not really relevant. You get the same warning in utf8 with this:

I don’t know how this works, but you get no warnings if you write \CYRN in a “natural” way:

\documentclass{article}
\usepackage{hyperref}
\usepackage[T2A]{fontenc}
\hypersetup{pdftitle=Н}
\begin{document}
xxx
\end{document}

well beamer loads hyperref a bit early. But in view that I claim that one should resolve loading order dependencies, I would say, open an issue for hyperref.

I found out that hyperref should be loaded after fontenc. That is, this one results in warnings with symbols removed:

\documentclass{article}
\usepackage{hyperref}
\usepackage[T2A]{fontenc}
\usepackage[cp866]{inputenc}
\usepackage[russian]{babel}

And this one works fine:

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage{hyperref}
\usepackage[cp866]{inputenc}
\usepackage[russian]{babel}

Is it possible to tell beamer to \usepackage (with options) before hyperref?

@alekhe
Copy link
Author

alekhe commented Feb 20, 2024

A workaround:

\RequirePackage[T2A]{fontenc}
\documentclass{beamer}

@u-fischer
Copy link

Why don't you use what I suggest?

\providecommand\CYRDZE{}
\documentclass{beamer}

should work fine.

@alekhe
Copy link
Author

alekhe commented Feb 20, 2024

Yes, you’re right, it works fine. Thank you.

I just didn’t get (and still don’t) what that meant. E.g., changing \CYRDZE to \CYRA doesn’t work. So I decided to play around.

@u-fischer
Copy link

hyperref is currently using \CYRDZE as a test to decide if cyrillic has been loaded or not.

@alekhe
Copy link
Author

alekhe commented Feb 20, 2024

Ah, OK, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants