TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to tie capital letters with a capital hyphen, I created a command


which uses graphicx package. I'd like to use this command in \chapter and similar 'moving arguments'. This code:

\chapter{ФІЗИКО\capitalhyphen МАТЕМАТИЧНИЙ}

works fine and does the job. However, adding


to the preamble, results in an error. Ho to fix it?

UPDATE: I figured out that if we add bookmarks=false option the problem disappears. Is there any chance to use this \DeclareRobustCommand and still have bookmarks??

share|improve this question
\DeclareRobustCommand instead of \newcommand or your definition but \protect\capitalhyphen when used in a moving argument. See this question for a technical description of the problem and this question for a similar problem. – egreg Jan 31 '13 at 16:55
You will need to delete your toc file after making your command robust and let latex write a new clean one. The old one will be corrupted. – David Carlisle Jan 31 '13 at 17:08
I get the error message when I try to put \DeclareRobustCommand{}, not even when I use this in the \chapter{}. And yes, I deleted toc file – Physicsworks Jan 31 '13 at 17:14
Please edit your question to include a complete small document starting \documentclass and ending \end{document} that shows the problem. – David Carlisle Jan 31 '13 at 17:16
\DeclareRobustCommand{\capitalhyphen}{...} is the correct way; sorry if my comment has been misleading. Then you don't have to use \protect in front of \capitalhyphen – egreg Jan 31 '13 at 17:20
up vote 6 down vote accepted

For the bookmarks macro \capitalhyphen can be redefined using \pdfstringdefDisableCommands:

share|improve this answer
Thank you!! It works. – Physicsworks Jan 31 '13 at 20:26

You need to define the command in the preamble and also load graphicx package.


\chapter{ФІЗИКО\capitalhyphen МАТЕМАТИЧНИЙ}

enter image description here

 *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
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

If you add


You get an error that \height is undefined. hyperref needs to do a lot of normalising of characters to meet the restricted encoding allowed in pdf bookmarks. It apparently disables the latex protection mechanism to do that.

You can add \let\height\relax then you get no error but the bookmark list isn't right. however


seems to work

share|improve this answer
I forgot to include it in the minimal example, but I DO HAVE IT in my main document. Please, see the log file I've added to my question. It's odd, but when I use the usual hyphen inside \chapter{} in my main document I have no error, the error pops up when I try to use \captialhyphen, and this error has to do with inputenc (see the log)... – Physicsworks Jan 31 '13 at 17:30
@Physicsworks The error is completely unrelated to \capitalhyphen. – egreg Jan 31 '13 at 17:37
@Physicsworks The code in my answer runs without error and produces the result shown. – David Carlisle Jan 31 '13 at 17:43
@DavidCarlisle, this is what I'd like to get. Unfortunately, what I get is the error message above =( : ! Undefined control sequence. Strangely, in the minimal working example I get ANOTHER error (! inputenc). Just great... – Physicsworks Jan 31 '13 at 17:46
Which just shows why we always ask for full working examples in questions:-)(I'll update my answer to match( – David Carlisle Jan 31 '13 at 19:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.