Hi there,

I've been experimenting with PyX graphics included in beamer
presentations (the ubiquitious "beamer" LaTeX class), and noticed an
issue with fonts.

Typically, you want the same fonts in your included graphics that you
have in the surrounding document. The simplest way of achieving that is
using the same document class and font related preamble commands for PyX
that you use in your main document. Given how much font wrangling
beamer.cls does, that also seems to be the only realistic option (rather
than trying to emulate the font setup).

The attached beamer.tex includes a pdf generated from beamerpyx.py and
compares the result - the two lines should be identical, especially the
last part where the fon wrangling of beamer.cls becomes important.

The PyX file compiles only when I ask PyX to ignore (or merely warn
about) certain errors. Specifically:

begindoc
========

I can quell the message about the nav-file using texmessage.no_nav but
that leaves the stuff from hyperref, EveryShipOut and geometry.

Is there a reason not to ignore "nav"-warnings by default?
Can we maybe ignore the others by default, too, or at least provide a
default parser?

run
===

I have no clue why texmessage.load_def doesn't catch the fd-file messages.

specials
========

Is there a way to silence those warnings about ignored specials (other
than changing the overall logger level)?

Cheers
Michael

P.S.: The proper approach would be to create the slides from within PyX,
of course. :)
\documentclass{beamer}
\usepackage{graphics}
\begin{document}
T: abc123, \textit{abc123}, $abc123$

\includegraphics{beamerpyx}
\end{document}
#!/usr/bin/python3
from pyx import *
text.set(cls=text.LatexRunner, docclass="beamer", texmessages_begindoc=[text.texmessage.ignore], texmessages_run=[text.texmessage.ignore], docopt="11pt", texenc="utf8")

c=canvas.canvas()
c.text(0, 0, r"P: abc123, \textit{abc123}, $abc 123$")
c.writePDFfile()
Traceback (most recent call last):
  File "./beamerpyx.py", line 6, in <module>
    c.text(0, 0, r"P: abc123, \textit{abc123}, $abc 123$")
  File "/usr/lib64/python3.4/site-packages/pyx/canvas.py", line 409, in text
    return self.insert(self.texrunner.text(x, y, atext, *args, **kwargs))
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1428, in wrapped
    return f(self, *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1464, in text
    return self.instance.text(*args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1304, in text
    return self.text_pt(unit.topt(x), unit.topt(y), *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1278, in text_pt
    left_pt, right_pt, height_pt, depth_pt = self.do_typeset(expr, 
self.texmessages_run_default + self.texmessages_run + texmessages)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1203, in 
do_typeset
    self.go_typeset()
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1395, in 
go_typeset
    self._execute("\\begin{document}", self.texmessages_begindoc_default + 
self.texmessages_begindoc, STATE_PREAMBLE, STATE_TYPESET)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1125, in _execute
    raise e
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1114, in _execute
    raise TexResultError("unhandled TeX response (might be an error)")
pyx.text.TexResultError: unhandled TeX response (might be an error)
The expression passed to TeX was:
  \begin{document}%
  \PyXInput{4}%
The return message from TeX was:
  *No file texput.aux.
  *geometry* driver: auto-detecting
  *geometry* detected driver: dvips
  ABD: EveryShipout initializing macros
  (/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
  (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
  
  Package hyperref Warning: Rerun to get /PageLabels entry.
  
  
  
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-bas
  ic-dictionary/translator-basic-dictionary-English.dict)
  
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-bib
  liography-dictionary/translator-bibliography-dictionary-English.dict)
  
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-env
  ironment-dictionary/translator-environment-dictionary-English.dict)
  
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-mon
  ths-dictionary/translator-months-dictionary-English.dict)
  
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-num
  bers-dictionary/translator-numbers-dictionary-English.dict)
  
(/usr/share/texlive/texmf-dist/tex/latex/beamer/translator/dicts/translator-the
  orem-dictionary/translator-theorem-dictionary-English.dict)
  No file texput.nav.
  
  *PyXInputMarker:executeid=4:
After parsing the return message from TeX, the following was left:
  *
  *geometry* driver: auto-detecting
  *geometry* detected driver: dvips
  ABD: EveryShipout initializing macros
  
  
  Package hyperref Warning: Rerun to get /PageLabels entry.
  
  
  
  
  
  
  
  
  No file texput.nav.
  
  *
Traceback (most recent call last):
  File "./beamerpyx.py", line 6, in <module>
    c.text(0, 0, r"P: abc123, \textit{abc123}, $abc 123$")
  File "/usr/lib64/python3.4/site-packages/pyx/canvas.py", line 409, in text
    return self.insert(self.texrunner.text(x, y, atext, *args, **kwargs))
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1428, in wrapped
    return f(self, *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1464, in text
    return self.instance.text(*args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1304, in text
    return self.text_pt(unit.topt(x), unit.topt(y), *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1278, in text_pt
    left_pt, right_pt, height_pt, depth_pt = self.do_typeset(expr, 
self.texmessages_run_default + self.texmessages_run + texmessages)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1204, in 
do_typeset
    return self._execute(expr, texmessages, STATE_TYPESET, STATE_TYPESET)
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1125, in _execute
    raise e
  File "/usr/lib64/python3.4/site-packages/pyx/text.py", line 1114, in _execute
    raise TexResultError("unhandled TeX response (might be an error)")
pyx.text.TexResultError: unhandled TeX response (might be an error)
The expression passed to TeX was:
  \ProcessPyXBox{P: abc123, \textit{abc123}, $abc 123$%
  }{1}%
  \PyXInput{5}%
The return message from TeX was:
  *
  *(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd)
  (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)
  (/usr/share/texlive/texmf-dist/tex/latex/sansmathaccent/ot1mathkerncmss.fd)
  PyXBox:page=1,lt=0.0pt,rt=125.53001pt,ht=7.60416pt,dp=1.36874pt:
  [80.121.88.1]
  *PyXInputMarker:executeid=5:
After parsing the return message from TeX, the following was left:
  *
  *
  (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd)
  (/usr/share/texlive/texmf-dist/tex/latex/sansmathaccent/ot1mathkerncmss.fd)
  
  
  *
ignoring special '! systemdict /pdfmark known{userdict /?pdfmark systemdict 
/exec get put}{userdict /?pdfmark systemdict /pop get put userdict /pdfmark 
systemdict /cleartomark get put}ifelse'
ignoring special '! /DvipsToPDF{72.27 mul Resolution div} def/PDFToDvips{72.27 
div Resolution mul} def/BPToDvips{72 div Resolution 
mul}def/BorderArrayPatch{[exch{dup dup type/integertype eq exch type/realtype 
eq or{BPToDvips}if}forall]}def/HyperBorder {1 PDFToDvips} def/H.V {pdf@hoff 
pdf@voff null} def/H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def/H.S 
{currentpoint HyperBorder add /pdf@lly exch def dup DvipsToPDF 72 add /pdf@hoff 
exch def HyperBorder sub /pdf@llx exch def} def/H.L {2 sub dup/HyperBasePt exch 
def PDFToDvips /HyperBaseDvips exch def currentpoint HyperBaseDvips sub 
/pdf@ury exch def/pdf@urx exch def} def/H.A {H.L currentpoint exch pop vsize 72 
sub exch DvipsToPDF HyperBasePt sub sub /pdf@voff exch def} def/H.R 
{currentpoint HyperBorder sub /pdf@ury exch def HyperBorder add /pdf@urx exch 
def currentpoint exch pop vsize 72 sub exch DvipsToPDF sub /pdf@voff exch def} 
def'
ignoring special 'papersize=364.19536pt,273.14662pt'
ignoring special 'ps:SDict begin /product where{pop 
product(Distiller)search{pop pop pop version(.)search{exch pop exch 
pop(3011)eq{gsave newpath 0 0 moveto closepath clip/Courier findfont 10 
scalefont setfont 72 72 moveto(.)show grestore}if}{pop}ifelse}{pop}ifelse}if 
end'
ignoring special 'ps:SDict begin H.S end'
ignoring special 'ps:SDict begin H.R end'
ignoring special 'ps:SDict begin [/View [/XYZ H.V]/Dest (Navigation80) cvn 
/DEST pdfmark end'
ignoring special 'ps:SDict begin H.S end'
ignoring special 'ps:SDict begin H.R end'
ignoring special 'ps:SDict begin [/View [/XYZ H.V]/Dest (page.80) cvn /DEST 
pdfmark end'
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to