Paweł Jackowski wrote:
Pawel:
returns doubled hash of category 12. Is that ok? I mean if it was two hashes in category 6 it wouldn't that strange, but all the characters returned by \pdfescape* are \other. So I think the result for \pdfescapestring{#} should be just one hash of cat 12. ?
Heiko:
It's correct. \pdfescape* call the classic routine "tokens_to_string" to get a string representation of the tokens. Then the escape rules are applied.
During tokens_to_string TeX doubles # in this process and add spaces after macro names.
"tokens_to_string" calls "show_token_list", defined by original TeX; and is called by "print_pdf_toks" that many primitives use.
Same behaviour as \message, \detokenize, ...
It convinces me, that all of those commands should work consequently and I won't insist on changing anything -)
Yes, I know it complies all character-catcode-6-rules, but was just thinking is there is any profit of that behaviour in the case of \pdfescape*. I mean
\message{#} -> ## (writing) \def\hash{##} -> # (reading)
is texish and is symetric. But
\pdfescapename{#} -> #23#23 \pdfescapehex{#} -> 2323 \pdfescapestring{#} -> ##
is just a consequence of hash-rulez but the doubled hash is always redundant. And of course double hash of category 12 remains double hash
\pdfunescapehex{#23#23} -> ##
unless \scantokened or something...
So, the fact that \pdfescape* primitives doubles a hash is unusable. In practise, you need to use \string# to avoid doubles and I couldn't find realistic example, one may need to have them doubled. But still, it is good that all that commands are consistent.
in generall i think that it would be handy to have a way to disable the hash duplication (also in the other situations), because now one sometimes ends up in parsing them away; something \pdfduplicatesixcode [0|1] or so; getting rid of the space after the \cs is more tricky since info about a space originaly being there is lost at that stage. Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------