[NTG-pdftex] Re: backslashes in \pdfoutline

Martin Schröder ms@artcom-gmbh.de
Sun Jul 11 18:35:00 CEST 2004

On 2004-07-10 20:39:06 -0400, Karl Berry wrote:
> Hi Martin,
> As you may have noticed, I reported an issue on the pdftex lists a few
> days ago regarding catcode 12 backslashes in \pdfoutline et al.
> Although Hartmut and Heiko and I have discussed it some, and Hartmut has
> written some patches, I haven't seen any definitive decisions on what we
> want to do, and I want to fix texinfo.tex accordingly.
> (It comes up in practice with Texinfo because in Texinfo, unlike most
> (all?) other common formats, backslash is supposed to be a "normal"
> character that can be used in cross-reference targets.)
> In short, suppose we have:
>   \catcode`\/=0 /catcode`\\=12
>   /pdfcompresslevel=0
>   /pdfdest name {xyz\} hello from xyz /vfill/eject
>   /pdfoutline goto name{xyz\}{to xyz\}
> This produces an invalid PDF file, because the \ escapes the
> end-of-string ) delimiter in the output:
>   << /S /GoTo /D (xyz\) >>
>   ...
>   (to xyz\)
> The choices seem to be:
> 1) do nothing, and leave it up to the document's TeX code to double the
>    backslashes in all cases.  This is the current situation, de facto.
> 2) have pdftex escape the backslashes in the target names only, so that
>    it would produce (xyz\\) and (to xyz\).
> 3) have pdftex escape the backslashes in the outline text only, so that
>    it would produce (xyz\) and (to xyz\\).
> 4) have pdftex escape the backslashes in all situations, so that
>    it would produce (xyz\\) and (to xyz\\).

4 would be the logical choice for pdf.

> Escaping the backslashes implies that TeX code cannot produce PDF string
> escapes.  This does not seem like a serious limitation to me, since TeX
> can write any byte value (and pdftex "should" escape as necessary into
> \nnn octal notation in string constants -- I have not tested this).

I will.

> Not escaping the backslashes implies that it's possible to write TeX
> documents which produce invalid PDF.  This seems bad, however, if this
> is the case with other pdftex commands also, the argument loses its force.

We'll have to check this for consistency.

Best regards

PS: I'm cc'ing the ntg-pdftex list so that Hans and Thanh and
    others are included.
               Martin Schröder, ms@artcom-gmbh.de
     ArtCom GmbH, Lise-Meitner-Str 5, 28359 Bremen, Germany
          Voice +49 421 20419-44 / Fax +49 421 20419-10

More information about the ntg-pdftex mailing list