[pdftex] CTM modification by \pdfliteral{}
Alexander Grahn
A.Grahn at web.de
Thu Jun 11 18:02:07 CEST 2020
Hello,
According to the pdftex documentation, \pdfliteral{<general text>} sets the
transformation matrix to the current position before inserting <general text>.
The purpose, I guess, is to facilitate insertion of PDF drawing operators using
relative coordinates w.r.t. the current position.
However, I wonder why this CTM modification is not undone immediately after
inserting <general text>, but only at the beginning the following text
insertion (in front of the next BT operator).
In the following situation (code listing below) this leads to an undesired
displacement of the complete page content following a text portion (`Hello')
that was enclosed by a q/Q pair.
If the CTM were reset immediately at the end of \pdfliteral{}, q/Q could safely
be placed around text without the risk of hiding a delayed CTM resetting.
I need to use q/Q around typeset text in order to limit the scope of a Tr (Text
Render Mode) operator.
Thus my question: Could pdftex/luatex be changed to reset the CTM immediately
at the end of \pdfliteral{} instead of delaying it to the next BT?
Kind regards,
Alexander
--
\documentclass[11pt,a4paper]{article}
\begin{document}
\pdfliteral{}% <-- modfies CTM
\pdfliteral page {q} Hello \pdfliteral page {Q} World!
\end{document}
Resulting page stream:
======================
stream
1 0 0 1 117.828 715.095 cm % <--- first \pdfliteral{} sets CTM to current position
q
1 0 0 1 -117.828 -715.095 cm % <--- CTM modification undone at beginning (BT) of text
BT % insertion that follows, but hidden by q/Q
/F25 10.9091 Tf 134.765 704.136 Td [(Hello)]TJ
ET
Q
BT % `World!' and page number `1' at wrong positions
/F25 10.9091 Tf 162.946 704.136 Td [(W)83(orld!)]TJ 131.482 -612.503 Td [(1)]TJ
ET
endstream
More information about the pdftex
mailing list.