4

I can't compile when attempting to use \IUPAC inside a heading; outside a heading works fine.

Minimal working example: uncomment \section to see the error.

\documentclass[a4paper, 11pt, titlepage]{article} 
\usepackage{bpchem}

\usepackage{hyperref} 

\begin{document}

%\section{\IUPAC{4,4''-bis[2-(4-meth\|oxy-2,6-di\|methyl\|phenyl)\|eth\|ynyl]\|\-5,5''\-bis\|(meth\|oxy\|meth\|oxy)-2,2':6',2''-ter\|pyr\|idine}}

\IUPAC{4,4''-bis[2-(4-meth\|oxy-2,6-di\|methyl\|phenyl)\|eth\|ynyl]\|\-5,5''\-bis\|(meth\|oxy\|meth\|oxy)-2,2':6',2''-ter\|pyr\|idine}

\end{document}

2 Answers 2

4

hyperref is unable to process \IUPAC for the bookmark. The solution is to use \texorpdfstring, in these cases:

\section{%
  \texorpdfstring{\IUPAC{4,4''-bis[2-(4-meth\|oxy-2,6-%
                  di\|methyl\|phenyl)\|eth\|ynyl]\|\-5,5''\-bis\|%
                  (meth\|oxy\|meth\|oxy)-2,2':6',2''-ter\|pyr\|idine}
                 {<abbreviated version for the bookmark>}}
5

\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}

Result

Bookmarks of AR9/Linux:

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.

1
  • The latest IUPAC rules say that we (chemists) should not move the 2- over the 4 in [SO4]2-, so the bookmark is actually 'right' :-)
    – Joseph Wright
    Aug 14, 2013 at 16:10

You must log in to answer this question.

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