Hi,I could reproduce it on Debian 11 (not yet released). It seems related to the upgrade to TeX Live 2020, which added the l3backend (was not present before). This package adds specials by \AtBeginDvi{...}, which unboxes the box send to \shipout and re-boxes it. By that the vertical alignment, which we set to zero height for the hbox passed to \shipout, gets lost at the first box shipped out by PyX.
There is a simple solution in applying this vertical setting at the box nested inside, before we also fix the horizontal alignment according to the output requirements. This should not introduce any difference for regular use, although (as it is TeX/LaTeX) any difference can always be utilized (as the l3backend shows). Please try the attached patch. I hope it resolves the issue for you. (And we probably should release this soon ...)
AndréPS: The additional special output (warning by PyX) has not yet been addressed/silenced. Also, I have not yet checked whether we can continue to use the pyx.def output driver as before. There are various open questions, which need further investigation ...
Am 22.06.21 um 20:11 schrieb Thomas Bending:
I've used PyX happily for years, but I've recently noticed what seems to be a bug in text placement when using LaTeX for text processing. Here's my code:import pyx pyx.text.set(engine = pyx.text.TexEngine) c = pyx.canvas.canvas() c.text(0, 0, 'A') c.text(0, 0, 'B') c.writePDFfile('out.pdf')This produces the file attached as out_tex.pdf, with the A and B superimposed as I'd expect. However, if I change the engine specified in line 2 to pyx.text.LatexEngine then1. I see the warning /ignoring special 'header=l3backend-dvips.pro <http://l3backend-dvips.pro>'/ 2. The script produces the file attached as out_latex.pdf, with the A displaced downwards (and hence almost off the page).I'm using PyX 0.15, Python 3.9.5, TeX = TeX 3.14159265 (TeX Live 2020/Debian) and LaTeX = pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian), all running under Ubuntu 21.04. I believe that this issue appeared when I upgraded to Ubuntu 21.04, which may also have involved upgrades to some of these packages.Can anyone suggest what I can do to prevent this displacement of the text when using the LaTeX engine, please? Is this displacement related to the warning? Any advice welcomed,Thomas _______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
-- by _ _ _ / \ \ / ) Dr. André Wobst, [email protected], https://www.wobsta.de / _ \ \/\/ / wobsta GmbH, Ulmer Straße 248, 86156 Augsburg, Germany (_/ \_)_/\_/ Office: +49 (0)821 90796043, Mobile: +49 (0)160 93804217
diff --git a/pyx/text.py b/pyx/text.py
index d7958490..1dd1dac7 100644
--- a/pyx/text.py
+++ b/pyx/text.py
@@ -1202,8 +1202,8 @@ class SingleEngine:
"rt=\\the\\PyXDimenHAlignRT,"
"ht=\\the\\ht\\PyXBox,"
"dp=\\the\\dp\\PyXBox:}%\n"
+ "\\ht\\PyXBox0pt%\n" # baseline alignment (hight to zero)
"\\setbox\\PyXBoxHAligned=\\hbox{\\kern-\\PyXDimenHAlignLT\\box\\PyXBox}%\n" # align horizontally
- "\\ht\\PyXBoxHAligned0pt%\n" # baseline alignment (hight to zero)
"{\\count0=80\\count1=121\\count2=88\\count3=#2\\shipout\\box\\PyXBoxHAligned}}%\n" # shipout PyXBox to Page 80.121.88.<page number>
"\\def\\PyXInput#1{\\immediate\\write16{PyXInputMarker:executeid=#1:}}%\n" # write PyXInputMarker to stdout
"\\def\\PyXMarker#1{\\hskip0pt\\special{PyX:marker #1}}%", # write PyXMarker special into the dvi-file
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ PyX-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyx-user
