Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54713

Re: python, pythontex and plots

From Piet van Oostrum <piet@vanoostrum.org>
Newsgroups comp.lang.python
Subject Re: python, pythontex and plots
Date 2013-09-24 14:38 -0400
Message-ID <m2vc1qhxpz.fsf@cochabamba.vanoostrum.org> (permalink)
References (1 earlier) <523f9252$0$29988$c3e8da3$5496439d@news.astraweb.com> <ffb00909-ed74-4330-a448-dd778b346b3b@googlegroups.com> <523fb7b3$0$29992$c3e8da3$5496439d@news.astraweb.com> <0a4edbd9-8ed7-4967-9996-0b70c398859d@googlegroups.com> <cc20c136-91a2-4b32-bba3-4907482852ce@googlegroups.com>

Show all headers | View raw


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 <piet@vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

python, pythontex and plots chitturk@uah.edu - 2013-09-22 13:26 -0700
  Re: python, pythontex and plots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-23 00:58 +0000
    Re: python, pythontex and plots chitturk@uah.edu - 2013-09-22 19:16 -0700
      Re: python, pythontex and plots Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-23 03:38 +0000
        Re: python, pythontex and plots rusi <rustompmody@gmail.com> - 2013-09-22 21:54 -0700
          Re: python, pythontex and plots chitturk@uah.edu - 2013-09-23 07:09 -0700
            Re: python, pythontex and plots Piet van Oostrum <piet@vanoostrum.org> - 2013-09-24 14:38 -0400

csiph-web