groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PDF outline anomaly


From: Peter Schaffter
Subject: PDF outline anomaly
Date: Mon, 29 Apr 2024 12:45:53 -0400

I recently updated a mom file that uses \*[COND] in the string
passed to HEADING and noticed that the PDF outline has started
prepending u] (i.e. the letter u and a square bracket) to the
outline entries.  Unsurprisingly, \*[EXT] is also affected.  Process
this little example with pdfmom to see what I mean:

.TITLE "PDF Outline Test
.PRINTSTYLE TYPESET
.CONDENSE 80
.EXTEND   120
.START
.HEADING 1 "\*[COND]Condensed heading\*[CONDX]"
.PP
Normal text.
.br
\*[COND]Condensed text.\*[CONDX]
.HEADING 1 "\*[EXT]Extended heading\*[EXTX]"
.PP
Normal text.
.br
\*[EXT]Extended text.\*[EXTX]

I can't say when this started happening because I haven't updated
the file in question in a very long time and it's the only one I
have where \*[COND] is part of the HEADING string.  Previous
PDF versions of the file do not exhibit the behaviour.

The issue appears to stem from (recent?) changes to pdf.tmac's
pdfbookmark definition.  The pdfbookmark macro is called in HEADING
via om.tmac's PDF_BOOKMARK macro.

The CONDENSE macro in om.tmac defines a long string (COND) that
creates several registers inline and uses them to establish the
width-to-height ratio of subsequent text.

.ds COND \
\R'#PT_SIZE_IN_UNITS \En[.ps]'\
\R'#CONDENSE 1'\
\R'#COND_WIDTH (\En[#PT_SIZE_IN_UNITS]*\E*[$COND_PERCENT])/100'\
\s[\En[#COND_WIDTH]u]\H'\En[#PT_SIZE_IN_UNITS]u'
                   ^^
The extraneous u] seems to result from the scaling unit and closing
delimiter of the \s inline being interpreted as literal text when
the text of a heading with \*[COND] is passed to pdfbookmark.

-- 
Peter Schaffter
https://www.schaffter.ca



reply via email to

[Prev in Thread] Current Thread [Next in Thread]