为了将大写字母与大写连字符连接起来,我创建了一个命令
\DeclareRobustCommand{\capitalhyphen}{\raisebox{0.24ex}{\resizebox{0.4em}{\height}{-}}\kern-0.07em}
它使用graphicx
包。我想在\chapter
和类似的“移动参数”中使用此命令。此代码:
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english,ukrainian]{babel}
\usepackage{graphicx}
\DeclareRobustCommand{\capitalhyphen}{\raisebox{0.24ex}{\resizebox{0.4em}{\height}{-}}\kern-0.07em}
\begin{document}
\chapter{ФІЗИКО\capitalhyphen МАТЕМАТИЧНИЙ}
\end{document}
运行良好,可以完成工作。但是,添加
\usepackage[unicode]{hyperref,xcolor}
\hypersetup{citebordercolor=green,linkbordercolor=white}
到序言部分,结果出现错误。如何修复它?
更新:我发现如果我们添加bookmarks=false
选项,问题就会消失。有没有可能使用这个\DeclareRobustCommand
并且仍然保留书签?
答案1
对于书签宏\capitalhyphen
可以使用以下方法重新定义\pdfstringdefDisableCommands
:
\usepackage[unicode]{hyperref}
\pdfstringdefDisableCommands{%
\def\capitalhyphen{-}%
}
答案2
您需要在序言中定义命令并加载graphicx
包。
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english,ukrainian]{babel}
\usepackage{graphicx}
\DeclareRobustCommand{\capitalhyphen}{\raisebox{0.24ex}{\resizebox{0.4em}{\height}{-}}\kern-0.07em}
\begin{document}
\chapter{ФІЗИКО\capitalhyphen МАТЕМАТИЧНИЙ}
\end{document}
*File List*
report.cls 2007/10/19 v1.4h Standard LaTeX document class
size11.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
inputenc.sty 2008/03/30 v1.1d Input encoding file
utf8.def 2008/04/05 v1.1m UTF-8 support for inputenc
t1enc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
ot1enc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
omsenc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
babel.sty 2008/07/08 v3.8m The Babel package
english.ldf 2005/03/30 v3.3o English support from the babel system
ukraineb.ldf 2008/03/21 v1.1l Ukrainian support from the babel system
t2aenc.dfu 2008/04/05 v1.1m UTF-8 support for inputenc
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
t2acmr.fd 2001/08/11 v1.0a Computer Modern Cyrillic font definitions
supp-pdf.mkii
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
***********
如果你添加
\usepackage[unicode]{hyperref,xcolor}
\hypersetup{citebordercolor=green,linkbordercolor=white}
\height
您收到未定义的错误。hyperref
需要对字符进行大量规范化以满足 pdf 书签中允许的限制编码。它显然禁用了 latex 保护机制来执行此操作。
您可以添加\let\height\relax
,然后您不会收到任何错误,但书签列表不正确。然而
\usepackage{hyperref,xcolor}
\hypersetup{citebordercolor=green,linkbordercolor=white}
似乎有效