Re: CTM modification by \pdfliteral{}
Heiko Oberdiek via pdftex <[email protected]> Thu, 11 Jun 2020 22:21:47 +0200
| Newsgroups | gmane.comp.tex.pdftex |
|---|---|
| Message-ID | <[email protected]> |
Hello,
On 2020-06-11 18:02, Alexander Grahn wrote:
>
> According to the pdftex documentation, \pdfliteral{<general text>} sets the
> transformation matrix to the current position before inserting <general text>.
> \pdfliteral{}% <-- modfies CTM
Please do *not* use \pdfliteral for setting the transformation matrix,
because pdfTeX does *not* parse the contents of \pdfliteral. Thus it
does not know, that there is a transformation. But links and anchors,
for example, require the exact location.
There is a dedicated primitive for setting the transformation matrix
in pdfTeX: \pdfsetmatrix. Translations are not covered, but they
can easily and much more safer be done with the usual TeX means.
Also it is *very* important, that the transformation stuff
needs to be surrounded by the PDF operators q (save) and Q (restore).
Again use \pdfsave and \pdfrestore instead of \pdfliteral to get
pdfTeX informed. Both \pdfsave and \pdfrestore must occur at the
*same* TeX location, e.g. (\hbox{\pdfsave\hbox to 0pt{...}\pdfrestore}).
Otherwise the internal TeX location and the location at the PDF output
page gets out of sync.
Yours sincerely
Heiko