Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id p5ELP8oK024229 for ; Tue, 14 Jun 2011 23:25:09 +0200 Received: (qmail 24998 invoked by alias); 14 Jun 2011 21:25:03 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 14 Jun 2011 21:25:02 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx069) with SMTP; 14 Jun 2011 23:25:02 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p5ELMgmk001760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 14 Jun 2011 23:22:42 +0200 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p5ELEs8J011894; Tue, 14 Jun 2011 23:22:41 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1230458 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 14 Jun 2011 23:22:41 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p5ELMfRY010586 for ; Tue, 14 Jun 2011 23:22:41 +0200 Received: from anchor-post-3.mail.demon.net (anchor-post-3.mail.demon.net [195.173.77.134]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p5ELMTni030084 for ; Tue, 14 Jun 2011 23:22:35 +0200 Received: from morningstar2.demon.co.uk ([80.176.134.7] helo=palladium.local) by anchor-post-3.mail.demon.net with esmtp (Exim 4.69) id 1QWb49-0003ZH-nG; Tue, 14 Jun 2011 21:22:29 +0000 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 References: <4DF7CBEF.6080402@arcor.de> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4DF7D114.3020601@morningstar2.co.uk> Date: Tue, 14 Jun 2011 22:22:28 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: xparse and hyperref: Token not allowed in a PDF string (PDFDocEncoding) To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4DF7CBEF.6080402@arcor.de> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (eXpurgate); Detail=5D7Q89H36p7z6Vo8/b0rxOTUp160Rh/QI6QWCau9qmHOJMuwqiyLn7THr3LKs6TVxDSgC EVpxqqvK98/mrz+vnjKqO1yphGAPJfLklJho1ksPPfb7CTmC1Pu/cekqRUGSBLVJi7y+cv10J/oQ A7saFOujidp5y318qgPz7zCB2O5eHIJN0qp+qRpZe1uHQz7NtfT5W2PQDFuWx4gWasB5960cyVOQ m2C8hDsU+WSyhU=V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6781 On 14/06/2011 22:00, Stephan Hennig wrote: > Hi, > > xparse's \NewDocumentCommand doesn't seem to play well with hyperref > bookmarks. In this code > > \listfiles > \documentclass{article} > \usepackage{xparse} > \usepackage{hyperref} > \begin{document} > \NewDocumentCommand{\fooa}{}{FooA} > \DeclareExpandableDocumentCommand{\foob}{m}{FooB} > \section{aaa \fooa\ bbb \foob{} ccc} > \end{document} > > text from macro \fooa doesn't show up in the bookmark. Fortunately, it > works at least for macro \foob. > > Is that expected behaviour? Would it be possible to make > \NewDocumentCommand macros work with hyperref bookmarks? I'd prefer > using \NewDocumentCommand macros because of the mandatory argument of > \DeclareExpandableDocumentCommand macros which I don't need in my context. > > Best regards, > Stephan Hennig Hello Stephan, That is not trivial in general because you need to know what definition to use in an expansion context (arguments or not). That can only really be done by a programmer, not an automated system. For example, in siunitx I do provide appropriate 'shortcut' definitions and hook them into hyperref using \pdfstringdefDisableCommands. Doing that means making some pretty careful judgements on what should happen in bookmarks: many things simply do not make sense there. In the case case you mention, I'm not sure why you have used \DeclareExpandableDocumentCommand{\foob}{m}{FooB} rather than \DeclareExpandableDocumentCommand{\foob}{}{FooB} which works fine. -- Joseph Wright