\IUPAC
or \BPChem
are not supported for hyperref
's bookmarks:
- The macros are not expandable.
- Subscripts and superscripts cannot be supported in general, because math mode is not available. Also there are not many raised and lowered characters in Unicode.
puenc.def
(hyperref
option unicode
) supports:
\DeclareTextCommand{\texttwosuperior}{PU}{\80\262}%* U+00B2
\DeclareTextCommand{\textthreesuperior}{PU}{\80\263}%* U+00B3
\DeclareTextCommand{\textonesuperior}{PU}{\80\271}%* U+00B9
\DeclareTextCommand{\textiinferior}{PU}{\9035\142}%* U+1D62
\DeclareTextCommand{\textrinferior}{PU}{\9035\143}%* U+1D63
\DeclareTextCommand{\textuinferior}{PU}{\9035\144}%* U+1D64
\DeclareTextCommand{\textvinferior}{PU}{\9035\145}%* U+1D65
\DeclareTextCommand{\textbetainferior}{PU}{\9035\146}%* U+1D66
\DeclareTextCommand{\textgammainferior}{PU}{\9035\147}%* U+1D67
\DeclareTextCommand{\textrhoinferior}{PU}{\9035\150}%* U+1D68
\DeclareTextCommand{\textphiinferior}{PU}{\9035\151}%* U+1D69
\DeclareTextCommand{\textchiinferior}{PU}{\9035\152}%* U+1D6A
\DeclareTextCommand{\textzerosuperior}{PU}{\9040\160}%* U+2070
\DeclareTextCommand{\textisuperior}{PU}{\9040\161}%* U+2071
\DeclareTextCommand{\textfoursuperior}{PU}{\9040\164}%* U+2074
\DeclareTextCommand{\textfivesuperior}{PU}{\9040\165}%* U+2075
\DeclareTextCommand{\textsixsuperior}{PU}{\9040\166}%* U+2076
\DeclareTextCommand{\textsevensuperior}{PU}{\9040\167}%* U+2077
\DeclareTextCommand{\texteightsuperior}{PU}{\9040\170}%* U+2078
\DeclareTextCommand{\textninesuperior}{PU}{\9040\171}%* U+2079
\DeclareTextCommand{\textplussuperior}{PU}{\9040\172}%* U+207A
\DeclareTextCommand{\textminussuperior}{PU}{\9040\173}%* U+207B
\DeclareTextCommand{\textequalsuperior}{PU}{\9040\174}%* U+207C
\DeclareTextCommand{\textparenleftsuperior}{PU}{\9040\175}%* U+207D
\DeclareTextCommand{\textparenrightsuperior}{PU}{\9040\176}%* U+207E
\DeclareTextCommand{\textnsuperior}{PU}{\9040\177}%* U+207F
\DeclareTextCommand{\textzeroinferior}{PU}{\9040\200}%* U+2080
\DeclareTextCommand{\textoneinferior}{PU}{\9040\201}%* U+2081
\DeclareTextCommand{\texttwoinferior}{PU}{\9040\202}%* U+2082
\DeclareTextCommand{\textthreeinferior}{PU}{\9040\203}%* U+2083
\DeclareTextCommand{\textfourinferior}{PU}{\9040\204}%* U+2084
\DeclareTextCommand{\textfiveinferior}{PU}{\9040\205}%* U+2085
\DeclareTextCommand{\textsixinferior}{PU}{\9040\206}%* U+2086
\DeclareTextCommand{\textseveninferior}{PU}{\9040\207}%* U+2087
\DeclareTextCommand{\texteightinferior}{PU}{\9040\210}%* U+2088
\DeclareTextCommand{\textnineinferior}{PU}{\9040\211}%* U+2089
\DeclareTextCommand{\textplusinferior}{PU}{\9040\212}%* U+208A
\DeclareTextCommand{\textminusinferior}{PU}{\9040\213}%* U+208B
\DeclareTextCommand{\textequalsinferior}{PU}{\9040\214}%* U+208C
\DeclareTextCommand{\textparenleftinferior}{PU}{\9040\215}%* U+208D
\DeclareTextCommand{\textparenrightinferior}{PU}{\9040\216}%* U+208E
\DeclareTextCommand{\textainferior}{PU}{\9040\220}%* U+2090
\DeclareTextCommand{\texteinferior}{PU}{\9040\221}%* U+2091
\DeclareTextCommand{\textoinferior}{PU}{\9040\222}%* U+2092
\DeclareTextCommand{\textxinferior}{PU}{\9040\223}%* U+2093
\DeclareTextCommand{\textschwainferior}{PU}{\9040\224}%* U+2094
\DeclareTextCommand{\texthinferior}{PU}{\9040\225}%* U+2095
\DeclareTextCommand{\textkinferior}{PU}{\9040\226}%* U+2096
\DeclareTextCommand{\textlinferior}{PU}{\9040\227}%* U+2097
\DeclareTextCommand{\textminferior}{PU}{\9040\230}%* U+2098
\DeclareTextCommand{\textninferior}{PU}{\9040\231}%* U+2099
\DeclareTextCommand{\textpinferior}{PU}{\9040\232}%* U+209A
\DeclareTextCommand{\textsinferior}{PU}{\9040\233}%* U+209B
\DeclareTextCommand{\texttinferior}{PU}{\9040\234}%* U+209C
\DeclareTextCommand{\textjinferior}{PU}{\9054\174}%* U+2C7C
- Macros \|, _, \^ usually have different meanings. For example,
\|
is a double vertical line in math mode, but used as multi-breakpoint in \IUPAC
.
In the question the only problematic feature is \|
. If it is not used otherwise in bookmarks as double vertical line, then the following can be used:
\documentclass[a4paper, 11pt, titlepage]{article}
\usepackage{bpchem}
\usepackage{hyperref}
\usepackage{bookmark}
\pdfstringdefDisableCommands{%
\let\IUPAC\@firstofone
\let\|\relax
}
\begin{document}
\section{%
\IUPAC{4,4''-bis[2-(4-meth\|oxy-2,6-di\|methyl\|phenyl)\|eth\|ynyl]\|\-5,5'' }
\end{document}
The examples for \BPChem
in the documentation can be approximated via \texorpdfstring
(see egreg's answer):
\documentclass[a4paper, 11pt, titlepage]{article}
\usepackage{bpchem}
\usepackage[pdfencoding=auto]{hyperref}% or `unicode'
\usepackage{bookmark}
\bookmarksetup{open,numbered}
\begin{document}
\section{%
\texorpdfstring{\BPChem{C\_2H\_5OH}}{%
C\texttwoinferior H\textfiveinferior OH%
}%
}
\section{%
\texorpdfstring{%
\BPChem{SO\_4\^{2-}}%
}{%
SO\textfourinferior\texttwosuperior\textminussuperior
}%
}
\end{document}

Bookmarks of AR9/Linux:

Remarks:
I do not know a way to move the superscript 2
to the left on top of the subscript 4
in Unicode.
Package bookmark
improves the management of bookmarks of hyperref
, more features and the bookmarks are updated faster.