Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am quite newbie in LaTeX. Following examples in other questions for using lower case in titles, I tried to mimic them without success, when applying it to a section:

I am working in LyX2.0.

\documentclass{book}

\usepackage{textcase}

\begin{document}
\chapter{X}
\section{Y}
\section{Introduction to A\MakeLowercase{g} compounds}

\end{document}

I get the error:

! Undefined control sequence.
\MakeLowercase ...owercaseUnsupportedInPdfStrings 

 l.17 ...roduction to A\MakeLowercase{g} compounds}

 The control sequence at the end of the top line
 of your error message was never \def'ed. If you have
 misspelled it (e.g., `\hobx'), type `I' and the correct
 spelling (e.g., `I\hbox'). Otherwise just continue,
 and I'll forget about whatever was undefined.

Is this somehow possible to get?

share|improve this question
1  
Welcome to TeX.sx! That message suggests you're using hyperref, which however is missing from the example. –  egreg Feb 8 '13 at 21:52

2 Answers 2

up vote 2 down vote accepted

As egreg points out, the message comes from the hyperref package. You need to provide an alternative to the section title, such one that can be used in PDF Bookmarks:

\section{Introduction to \texorpdfstring{A\MakeLowercase{g}}{Ag} compounds}
share|improve this answer

A general solution to the problem of chemical element names that should never be uppercased can be the following.

\documentclass{book}
\usepackage{hyperref}
\usepackage{kantlipsum} % just to provide mock text

\makeatletter
\DeclareRobustCommand{\element}[1]{\@element#1\@nil}
\def\@element#1#2\@nil{%
  #1%
  \if\relax#2\relax\else\MakeLowercase{#2}\fi}
\pdfstringdefDisableCommands{\let\element\@firstofone}
\makeatother

\begin{document}
\mainmatter
\chapter{X}
\section{Introduction to \element{Ag} compounds}

\kant[1-20]

\end{document}

The argument to \element is split into the first letter and the possible second one. If the second letter is present, it's passed to \MakeLowercase. The \element macro is then added to the set of macros that can give problems to hyperref when building the bookmarks, redefining it just to return its argument.

enter image description here

share|improve this answer
    
Thanks, it worked! –  user25693 Feb 9 '13 at 11:40

Your Answer

 
discard

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.