Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Piet van Oostrum Newsgroups: comp.lang.python Subject: Re: python, pythontex and plots Date: Tue, 24 Sep 2013 14:38:00 -0400 Lines: 28 Message-ID: References: <6ce735c9-dfd4-45df-8423-8eb909d4de34@googlegroups.com> <523f9252$0$29988$c3e8da3$5496439d@news.astraweb.com> <523fb7b3$0$29992$c3e8da3$5496439d@news.astraweb.com> <0a4edbd9-8ed7-4967-9996-0b70c398859d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net poKuOKGnKRO54l6kjv3shQFrNhDHLtj5VNp4/gv32cyRrDs7Vv Cancel-Lock: sha1:9DrWEkH8a56Ty5Q2QhbYBG/L5cc= sha1:rHskAKzJ0pxfJBUasNCDARCsGFc= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (darwin) Xref: csiph.com comp.lang.python:54713 chitturk@uah.edu writes: > True, I did not explain what I was trying to do. > > pythontex is a package that allows the inclusion of python code within a > LaTeX document - (sort of like python.sty, but IMO, better) - I use > it along with noweb to create documents that contain documentation, > code and output of the code - and pythontex allows me to access variables > within the python code embedded in the LaTeX - except for the case > I mentioned ... Within the python code (inside the LaTeX document) I had > a "savefig(outputfile)" and I was trying to reference the outputfile > using \py{outputfile} It could be that \includegraphics needs an expandable TeX form for its filename, and \py probably isn't. I haven't tried pythontex yet (I didn't know about it before your posting), so I can only guess. I am going to try it out later. But if I am correct then the following might work: \newcommand{\filename}{} \edef\filename{\py{outputfile}} \includegraphics[scale=0.75]{\filename} -- Piet van Oostrum WWW: http://pietvanoostrum.com/ PGP key: [8DAE142BE17999C4]