LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 14 Jun 2011 22:22:28 +0100
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Message-ID:
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
In-Reply-To:
Content-Type:
text/plain; charset=ISO-8859-1
From:
Joseph Wright <[log in to unmask]>
Parts/Attachments:
text/plain (49 lines)
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

ATOM RSS1 RSS2