# Hypersetup environment warnings

This is my title page of my thesis and the code is as below

\documentclass{article}
\begin{document}
\hypersetup{
pdftitle={properties of F\textsubscript{2}},
pdfauthor={xxx},
pdfsubject={Masterthesis},
pdfkeywords={Master Thesis},
pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false}
\end{document}


I get six warnings as below for using a subscript in this hypersetup environment. Is it the subscript causing the warning or something else? Could someone help me understand this better? Thank you.

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing '\mathsurround' on input line.

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing '\z@' on input line.

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding): (hyperref) removing 'subscript' on input line.

Package hyperref Info: Option 'pdfnewwindow' set 'true' on input line.

Package hyperref Info: Option 'plainpages' set 'false' on input line.

I doubt your example compiles (no \usepackage{hyperref}).

Anyway, the following works without warnings:

\documentclass{article}
\usepackage{hyperref}

\hypersetup{
pdftitle={\texorpdfstring{Properties of F\textsubscript{2}}{Properties of F2}},
pdfauthor={xxx},
pdfsubject={Masterthesis},
pdfkeywords={Master Thesis},
pdfpagelayout=OneColumn,
pdfnewwindow=true,
pdfstartview=XYZ,
plainpages=false}

\begin{document}
Blah.
\end{document}


Explanation: text strings for PDF metadata can't contain fancy TeX markup. hyperref's \texorpdfstring command allows one to specify two versions of a given string: the first argument may contain (La)TeX markup and is used for typesetting, whereas the second argument is used when the string is embedded as PDF metadata (title, author, subject, etc.)

• Thanks @frougon. I have defined the package as \usepackage[bookmarks,bookmarksnumbered=true,bookmarksopenlevel=section,breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false]{hyperref} . Is this correct way? Jun 22, 2018 at 9:48
• If you're satisfied with the answer, please mark it as accepted. Concerning what you ask, these are really different questions. bookmarksopenlevel should be an integer (see example). The rest seems okay at first sight (see here for an authoritative post about pdfborder). Jun 22, 2018 at 10:01