1

In a previous post, I had problems with hyperref. With the MWE that was given, my problem was solved. But when I tried to combine both English and Greek languages I faced the warning Token not allowed in a PDF string (Unicode):(hyperref) removing \<def>-command'.

Please, look at the following MWE:

\documentclass[12pt,a4paper]{book}

\usepackage[T1]{fontenc} % <============================================
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,amsfonts,amssymb}
\usepackage[english,greek]{babel}
\usepackage{mathtools}
\usepackage{enumerate} 
\usepackage{textcomp}
\usepackage{tcolorbox,xcolor}
\usepackage{array}
\usepackage{extarrows} %για να γράφω πανω από συνεπαγωγές 

\newcommand{\rightarrowdbl}{\rightarrow\mathrel{\mkern-14mu}\rightarrow} % για να γραφω πανω απο βελη επιμορφισμων
\newcommand{\xrightarrowdbl}[2][]{%
  \xrightarrow[#1]{#2}\mathrel{\mkern-14mu}\rightarrow
}

\sloppy %Ρυθμίζει τα overfull/underfile στις γραμμές!

%Φτιάχνει το μέγεθος της γραμματοσειράς μέσα στα math enviroments δηλαδή μέσα στα δολάρια. Το πρώτο bracket είναι για το κείμενο και το δεύτερο για τα δολάρια. Δες και https://texfaq.org/FAQ-mathsize
\usepackage{lmodern}
\usepackage{anyfontsize}
\DeclareMathSizes{12}{13}{7}{5}

\theoremstyle{definition}

% Define amsthm theorems first
\newtheorem{defin}{Ορισμός}[section] % Creates a new counter, number within section
\newtheorem{prt}[defin]{Παρατήρηση} % Putting [defin] in second position uses defin's counter instead of creating a new one
\newtheorem{prts}[defin]{Παρατηρήσεις} % Again share defin's counter
\newtheorem{exmp}[defin]{Παράδειγμα} % etc.
\newtheorem{exmps}[defin]{Παραδείγματα}
\newtheorem*{simiosi}{Σημείωση}

\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[use counter*=defin, number within=section]{mytheo}{Θεώρημα}%
{colback=black!5,colframe=red!35!black,fonttitle=\bfseries}{th} % <=====================
\newtcbtheorem[use counter*=defin, number within=section]{myprop}{Πρόταση}%
{colback=black!5,colframe=red!50!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{mylem}{Λήμμα}%
{colback=black!5,colframe=red!50!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{mypor}{Πόρισμα}%
{colback=black!5,colframe=red!35!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{myax}{Αξίωμα}%
{colback=black!5,colframe=blue!35!black,fonttitle=\bfseries}{th}
\renewcommand{\rmdefault}{udidot}

\usepackage{calrsfs}
\usepackage[unicode]{hyperref} % <======================================


\raggedbottom

\BeforeBeginEnvironment{mylm}{\begin{minipage}{\linewidth}}
\AfterEndEnvironment{mylm}{\end{minipage}\par}

\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}



\begin{document}

\title{\Huge Το Θεώρημα των \\ \latintext Hopkins - Levitzki \greektext} % <==========
\author{{\Large ασδφ}\\  ΑΠΘ} % <=======================================
\maketitle{} 
\thispagestyle{empty}
\newpage

%\frontmatter % <============================ resulting in roman numbers
\tableofcontents

%\mainmatter % <========================================================
\chapter{Πρώτα και Μέγιστα Ιδεώδη}
\section{\latintext Maximal - \greektext Μέγιστα}  
\begin{myprop}[label=krmegid]{\latintext Critirion - \greektext Κριτήριο Μέγιστων Ιδεωδών}{}
Έστω $R$ 
ιλθυηβξν
\end{myprop}
Από την Πρόταση \ref{krmegid}

\end{document}

PS: Feel free to suggest some solution in addition to the liked post, if you want. Thank you.

enter image description here

2
  • It compiles and gives a functionnal PDF. Where's the problem? I can't seem to know what was removed.
    – Vinccool96
    Commented Apr 2, 2019 at 0:33
  • @Vinccool96 Dear, Vinccool96, thank you for your comment.The pdf can be compiled, indeed. But, as you can see in the screenshot I added, we take this warning, that I would like to fix :)
    – Chris
    Commented Apr 2, 2019 at 0:41

2 Answers 2

2

The issue here is the usage of the two commands \latintext and \greektext to change the font/language.

Using it in the parameter of a section is the culprit here, because in the pdf bookmarks is a character or command \latintext/\greektext not known.

The way out here is to use command \texorpdfstring{\latintext}{} and \texorpdfstring{\greektext}{} inside the section parameter like this:

\section{\texorpdfstring{\latintext}{} Maximal - \texorpdfstring{\greektext}{} Μέγιστα}

So with the complete code

\documentclass[12pt,a4paper]{book}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amsthm,amsfonts,amssymb}
\usepackage[english,greek]{babel}
\usepackage{mathtools}
\usepackage{enumerate} 
\usepackage{textcomp}
\usepackage{tcolorbox,xcolor}
\usepackage{array}
\usepackage{extarrows} %για να γράφω πανω από συνεπαγωγές 

\newcommand{\rightarrowdbl}{\rightarrow\mathrel{\mkern-14mu}\rightarrow} % για να γραφω πανω απο βελη επιμορφισμων
\newcommand{\xrightarrowdbl}[2][]{%
  \xrightarrow[#1]{#2}\mathrel{\mkern-14mu}\rightarrow
}

\sloppy %Ρυθμίζει τα overfull/underfile στις γραμμές!

%Φτιάχνει το μέγεθος της γραμματοσειράς μέσα στα math enviroments δηλαδή μέσα στα δολάρια. Το πρώτο bracket είναι για το κείμενο και το δεύτερο για τα δολάρια. Δες και https://texfaq.org/FAQ-mathsize
\usepackage{lmodern}
\usepackage{anyfontsize}
\DeclareMathSizes{12}{13}{7}{5}

\theoremstyle{definition}

% Define amsthm theorems first
\newtheorem{defin}{Ορισμός}[section] % Creates a new counter, number within section
\newtheorem{prt}[defin]{Παρατήρηση} % Putting [defin] in second position uses defin's counter instead of creating a new one
\newtheorem{prts}[defin]{Παρατηρήσεις} % Again share defin's counter
\newtheorem{exmp}[defin]{Παράδειγμα} % etc.
\newtheorem{exmps}[defin]{Παραδείγματα}
\newtheorem*{simiosi}{Σημείωση}

\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem[use counter*=defin, number within=section]{mytheo}{Θεώρημα}%
{colback=black!5,colframe=red!35!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{myprop}{Πρόταση}%
{colback=black!5,colframe=red!50!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{mylem}{Λήμμα}%
{colback=black!5,colframe=red!50!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{mypor}{Πόρισμα}%
{colback=black!5,colframe=red!35!black,fonttitle=\bfseries}{th}
\newtcbtheorem[use counter*=defin, number within=section]{myax}{Αξίωμα}%
{colback=black!5,colframe=blue!35!black,fonttitle=\bfseries}{th}
\renewcommand{\rmdefault}{udidot}

\usepackage{calrsfs}
\usepackage[unicode]{hyperref}


\raggedbottom

\BeforeBeginEnvironment{mylm}{\begin{minipage}{\linewidth}}
\AfterEndEnvironment{mylm}{\end{minipage}\par}

\DeclareMathAlphabet{\pazocal}{OMS}{zplm}{m}{n}



\begin{document}

\title{\Huge Το Θεώρημα των \\ \latintext Hopkins - Levitzki \greektext}
\author{{\Large ασδφ}\\  ΑΠΘ}
\maketitle{} 
\thispagestyle{empty}
\newpage

%\frontmatter
\tableofcontents

%\mainmatter
\chapter{Πρώτα και Μέγιστα Ιδεώδη}
\section{\texorpdfstring{\latintext}{} Maximal - \texorpdfstring{\greektext}{} Μέγιστα}   % <=====================
\begin{myprop}[label=krmegid]{\latintext Critirion - \greektext Κριτήριο Μέγιστων Ιδεωδών}{}
Έστω $R$ 
ιλθυηβξν
\end{myprop}
Από την Πρόταση \ref{krmegid}

\end{document}

you get the following result without warnings:

resulting pdf

1

You can avoid the error if you instead use the Babel mechanism to switch the text to English (which will also provide proper hyphenation):

\documentclass[12pt]{scrbook}
\usepackage{lmodern}
\usepackage[english,main=greek]{babel}
\babeltags{english = english}
\usepackage[unicode]{hyperref}

\begin{document}

\title{Το Θεώρημα των \\ \textenglish{Hopkins - Levitzki}}
\author{ασδφ ΑΠΘ}
\maketitle

\frontmatter
\tableofcontents

\mainmatter
\chapter{Πρώτα και Μέγιστα Ιδεώδη}
\section{\textenglish{Maximal} -- Μέγιστα} 
Από την Πρόταση
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .