3

I have installed Windows 7, MiKTeX 2.9, TeXnicCenter 2.02 stable and Python 3.4.1 (distribution pyzo2015a). I use

latex pythontex.ins

form cmd to install the package pythontex:

enter image description here.

It seems to me that no files have been created in MiKTeX. Hence I have recopied manually the files to the appropriate directories as README.

My pythontex.bat (in C:\MiKTeX 2.9\miktex\bin) contains

@echo off "C:\MiKTeX 2.9\scripts\pythontex\pythontex.py" %*

My PATH contains

C:\pyzo2015a;C:\MiKTeX 2.9\miktex\bin;C:\windows\system32

I used the following commands in the cmd:

enter image description here

From the quickstart of this package:

"Compiling a document that uses pythontex involves three steps: run LATEX, run pythontex.py, and finally run LATEX again".

I tried: enter image description here

And the .pdf file obtained from the tex file (after several latex compilation) looks like this: ??

1) I am not able to process the second step. How do I activate pythontex.py on a .tex file from TeXnicCenter? My feeling is that my system does not recognise pythontex.py: there is a problem in my installation of pythontex.

2) Is it possible to make automatic this task with TeXnicCenter (by using a postprocessor?)? I use

C:\MiKTeX 2.9\miktex\bin\pdflatex.exe

in my profile.

4
  • Using a postprocessor would work. It should add only a tiny amount of overhead compared to creating a special profile or keyboard shortcut for running pythontex, and then manually running pythontex as needed. If you used the pythontex installation script, there should be a batch file pythontex.bat under C:\MiKTeX 2.9\miktex\bin that you can use to run pythontex. Otherwise, you could run pythontex.py directly.
    – G. Poore
    Aug 4, 2015 at 13:00
  • Thank you for your answer. I have updated the question. Any help is welcome.
    – Zouba
    Aug 5, 2015 at 6:21
  • I should have clarified that the installation script I meant was pythontex_install.py, which can be used after generating pythontex.sty to move files automatically. At this point, running pdflatex test.tex, pythontex test.tex, and finally pdflatex test.tex should work. If pythontex is giving any error messages, please add those to your question. Also, knowing what is in test.tex might help.
    – G. Poore
    Aug 5, 2015 at 11:37
  • It has been more than 10 years since I used TeXnicenter. You need to open Help-Search-Contents-Configuration-ManualConfiguration. You will read about how to use the different tabs. Now set your LaTeX compiler choice on the first tab, the python compiler in the preprocessing tab, and choose the viewer on the fourth tab if desired. When I was using TeXnicenter with students, we ran Python, C+, Java, MySQL, sed, awk, perl, asmptote, and R either as pre- and/or post-processors with settings in the build menu. Aug 5, 2015 at 11:56

1 Answer 1

0

I was also groping for a solution to "How to run PythonTeX within my local computer" while CoCalc did it (very slowly and intermittently, but) correctly and seamlessly on the cloud.

This is what I could figure out for myself, and hope should work for anyone too:

  1. If pythontex is installed (as is evident from the options displayed when you type MiKTeX 2.9\scripts\pythontex\pythontex.py), then just locate the pythontex code file in your project. In my case it was test.pytxcode, while my main TeX file was test.tex (both in the same directory).

  2. On my console, I just ran the command :

    pythontex test.pytxcode
    

    and that did it all !
    This is the output I got--

    This is PythonTeX 0.16
    --------------------------------------------------
    PythonTeX:  local_test - 0 error(s), 0 warning(s)
    
    
  3. As in the guidelines, compile with [pdf]LaTeX before and after the python run.

  4. ...and Voila !

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .