BPChem 的 \IUPAC 与 hyperref 冲突

BPChem 的 \IUPAC 与 hyperref 冲突

当我尝试在标题内部使用时,无法进行编译\IUPAC;但在标题外部使用则可以正常工作。

最小工作示例:取消注释\section以查看错误。

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

答案1

hyperref无法处理\IUPAC书签。解决方法是使用\texorpdfstring,在以下情况下:

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

答案2

\IUPAC\BPChem不支持 的hyperref书签:

  • 宏不可扩展。
  • 由于数学模式不可用,因此通常不支持下标和上标。此外,Unicode 中的升号和降号字符并不多。puenc.defhyperref选项unicode)支持:
\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
  • 宏 \|、_、\^ 通常具有不同的含义。例如,\|在数学模式下是双垂直线,但在 中用作多断点\IUPAC

在问题中,唯一有问题的功能是\|。 如果在书签中未以双垂直线的形式使用它,则可以使用以下内容:

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

\BPChem文档中的示例可以通过以下方式近似\texorpdfstring可以通过以下方式近似(参见egreg 的回答):

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

结果

AR9/Linux 的书签:

AR9/Linux

评论:

  • 我不知道如何将Unicode 中上标移至2下标左侧。4

  • 软件包bookmark改进了 的书签管理hyperref,功能更多且书签更新速度更快。

相关内容