Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [pythontex]

PythonTeX al­lows you to en­ter Python code within a LaTeX doc­u­ment, ex­e­cute the code, and ac­cess its out­put in the orig­i­nal doc­u­ment.

2
votes
1answer
30 views

Setting conda environment for pythontex in TexStudio

I am using Texstudio with a build configuration based on this question in order to run PythonTex and embed python code into my documents. This worked and I was able to use the \begin{pycode} and \end{...
1
vote
0answers
62 views

How to include figures using Pythontex

I try the solution of G.Poore (https://github.com/gpoore/pythontex/wiki/matplotlib) in order to include easily a lot of figures in a TeX document using Pythontex. Unfortunately I get the following ...
0
votes
0answers
33 views

Invoke Jupyter from within LaTeX

I'd like to be able to write a LaTeX document that contains blocks of code in any of the languages for which I've installed a Jupyter kernel, and have the LaTeX compilation run Jupyter's console on ...
0
votes
0answers
19 views

Pythontex : automatic importation of a figure

I would like to define a command showing the last figure saved by pythontex on a png file (Figurecount.png) where count is a Python counter numbering the figure. Next I use includegraphics to import ...
3
votes
0answers
40 views

UnicodeDecodeError pythontex

An error occurred when I try to compile the following minimal example with xelatex --8bit and pythontex. \documentclass[a4paper]{book} \usepackage{fontspec} \defaultfontfeatures{Ligatures=TeX} \...
0
votes
0answers
29 views

Interpreter python Pythontex [duplicate]

I try to define python3 as the interpreter of pythontex on MacOS with the following command : pythontex --interpreter python:python3. Unfortunately I obtain an error message pythontex: error: too ...
1
vote
0answers
31 views

What kind of templating engines besides jinja can be used for latex?

I have started to create automated reports in latex using jinja, also looked at pylatex as well and was wondering what other templating engines are available for programatically generating latex ...
0
votes
1answer
35 views

Pythontex and mdframed in an environment

I try to define an environment called "codeaux" printing a piece of python code inside a mdframed environment. After that my aim will be to redefine "codeaux" in a pyconsole version (pyblock/verbatim ...
1
vote
0answers
25 views

PythonTex stderr - error on line 364 [duplicate]

I am new to pythonTex. I get following error. I checked working of simple python code. However, when I try to import math within pycode it gives error. using code: \begin{pycode} import math from ...
1
vote
1answer
52 views

PythonTex stderr

I am new to pythontex. I could run simple python code. However, I get error with slightly complex things. The error I get is following: This is PythonTeX 0.16 ---- Messages for py:default:default ...
0
votes
0answers
78 views

Send tabular data to Latex

I need to send data from Python to Latex code. The data is tabular data, hence looping in such data in Latex would be tough. So, I thought creating a latex code in Python and adding it there would ...
0
votes
0answers
35 views

Script for typesetting with pythontex on MacOS

My Latex editor is TexPad on MacOS and I would like to add a BuildScript for typesetting pythontex in addition to XeLatex but I'm not able to write it. My encoding is UTF-8. I tried this possibility:...
4
votes
1answer
41 views

call \pygment with `#` or `%` character in tabularx environment

I have the following MWE : \documentclass{article} \usepackage{pythontex} \usepackage{tabularx} \begin{document} \begin{tabularx}{\linewidth}{X} \pygment{c}{#include <stdio.h>} \\ \end{...
0
votes
0answers
43 views

pythontex with virtualenv

I'm running macOS High Sierra with a virtualenv python 3.5 installation. Invoking pythontex insists in using the default python 2.7. How can I get pythontex to use python 3.5 from the virtualenv ...
1
vote
0answers
154 views

Interactive Plot with controls in the frame [closed]

I would like to know if there is any way to include a plot which can interactively change using slider controls in a Beamer presentation. For example, I would like to show the following ipython ...
1
vote
0answers
75 views

Create new command python

I want create a new command in python, in https://tex.stackexchange.com/a/234232/153360 add the command sage to pythontex. How can I change or add a command which output a string instead of a latex ...
2
votes
1answer
609 views

TeXmaker (MikTeX) using pythontex

I am trying to use pythontex with Texmaker 5.0.2 (MikTeX 2.9.6637). I use an example code provided by overleaf.com (see below). On overleaf.com the example code does compile without any problems. When ...
1
vote
0answers
48 views

I can't not run python tex in my document [closed]

His code not run \documentclass{article} \usepackage{pythontex} \begin{document} This is my code. \begin{pycode} a='andrey' print('Hi es ',a) \end{pycode} \end{document}
0
votes
0answers
30 views

Pythontex compiling OSerror

I've installed pythontex via tlmgr and Python3 via apt-get. Than I've run the tex file with pdflatex, pythontex and pdflatex. But pythontex returns the terminal output: root@localhost:/# pythontex ...
1
vote
0answers
191 views

Pythontex and latexmk

The compilation works fine if I use LaTeX, Python, and then LaTeX, with the command for Python : python "C:\Program Files (x86)\MiKTeX 2.9\scripts\pythontex\pythontex.py" But I can't use latexmk ...
1
vote
1answer
118 views

Pythontex : Input into a pyverbatim environment

With the package Pythontex, I want to input a Python file into a pyverbatim environment : For example, I tried the code : \begin{pyverbatim} \input{file_1.py} \end{pyverbatim} where file_1.py is a ...
1
vote
2answers
70 views

Expand macros at pythontex environments

I would like to pass "variables" to my code. Minimal example (example.tex): \documentclass{article} \usepackage[usefamily=bash]{pythontex} \begin{document} \bash|echo "\jobname"| \end{document} ...
0
votes
1answer
236 views

PythonTex and Beamer [duplicate]

I try to build a Beamer presentation with Python-code in it: \documentclass[11pt]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usetheme{Madrid} \usepackage{pythontex} \usepackage{...
3
votes
3answers
163 views

diagnosing an incompatibility between pythontex and a siam .cls file

I'm using pythontex within a documentclass provided by SIAM (see http://www.siam.org/meetings/ns14/siam-wns-article.cls - less than 100 lines for the 2014 version which has the same problem as the ...
1
vote
0answers
52 views

how to retrieve multiples variables separatly with pythontex?

Edit I found something, but not working as I would like under tikz. Here is the code : \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amsmath} \...
3
votes
2answers
215 views

using pythontex to do calculations

I would like to use pythontex for some repetitive calculations. edit instead of having a solution with the first code I posted below (it's a bit complicated and there is a simple way to do it with ...
0
votes
1answer
335 views

Inserting multiple figures using loop and python in Windows 7 [Solved]

Hello because I have a set of figures in a folder that I want to put in a document sequentially, I am trying to create an automatic procedure. Looking around I found this old post Inserting figures ...
0
votes
1answer
259 views

Importing Python functions using pythontex

I have a lengthy python script (for a ML project), and I want to use some results in a Latex report. Using pythontex, I import my project, and it properly displays anything printed in project.py (e.g. ...
0
votes
1answer
108 views

Call Python code with argument `\addplot {\py{1+\x}};`

The pythontex package allows us to do evaluate Python in LaTeX simply by \py{1+3}. However, this is not possible inside an addplot. A solution is wrapping the entire tikzpicture inside a substitute ...
4
votes
1answer
144 views

How can I make imports in pythontex which apply to all sessions?

How can I make imports in pythontex which apply to all sessions? Consider for example the following pseudocode. I want to have separate sessions sessionA and sessionB, but want to import in both ...
1
vote
1answer
301 views

importing packages with pythontex on overleaf or journals

Alright, so I am using overleaf, and overleaf provides a simple example of pythontex which requires a latexmkrc file. So far so good. You can even open that example and start editing it. This is ...
2
votes
1answer
65 views

Standalone package with pythontex and tikz: How to avoid space around picture?

I want to to produce a pdf-picture used in another document. Despite the usage of the standalone package, the image has a lot of white space on the left side. MWE: \documentclass[crop]{standalone} \...
3
votes
2answers
243 views

How can I pass a pythontex variable to latex

I want to pass a float variable from a pythontex calculation to latex such that the variable can be used in a pgfplots plot as in the following example. The example code shows two approaches that don'...
0
votes
1answer
274 views

Pythontex - Unable to import .py files

I am using pythontex to execute python code in latex. Since I have a large python code, I am trying to import the code using pycode ("\pyc{import code}"). The latex and python codes compile fine, but ...
1
vote
2answers
116 views

How can I access a float defined via \pgfmathsetmacro from pythontex?

How can I access a float variable defined via \pgfmathsetmacro from pythontex? Something like: \documentclass{article} \usepackage[gobble=auto]{pythontex} \usepackage{tikz} \begin{document} \...
1
vote
0answers
119 views

Using PythonTex in Lyx2.2.2 under Windows 10

I have this simple ERT code in LyX: Say hello Python \begin{pycode} print ('Hello, \\LaTeX') \end{pycode} The output (I click on the pair of eyes) is simply: Say hello Python It seems that the ...
4
votes
1answer
222 views

What would it take to create juliatex?

In analogy to pythontex, what would it take to create juliatex?
1
vote
0answers
875 views

How to configure Texstudio to use PythonTeX? [closed]

I learned how to add User commands to TeXstudio here: http://texstudio.sourceforge.net/manual/current/usermanual_en.html In particular, for PythonTeX, I added the following command: Then, I formed ...
1
vote
1answer
245 views

“now exiting Console” message in beamer using pythontex

After I asked on other forum, I was told that this behavior is due to python 3.6 code module. code module update in python 3.6 I do produce slides for my training presentation with Beamer. To ...
3
votes
1answer
99 views

Using pythontex inside itemize

\newcommand{\test}[2]{% \begin{itemize} \pyc{strs = u"#1".split(u"#2");} \pyc{for s in strs: print("\item " + s);} \end{itemize} } When using this command, I get the folowing output: ...
4
votes
1answer
106 views

Arara rule for Pythontex

Does anyone have a rule which allows to call Pythontex from Arara? I'd like to run the following set of commands for example: %!TEX TS-program = Arara % arara: pdflatex % arara: pythontex % arara: ...
1
vote
1answer
157 views

Automatic generation of latex source

I have a python script that reads a file containing data + some "latex template". The script produces a long latex source which is compiled to obtain a PDF. Incidentally, the LaTeX source heavily ...
2
votes
1answer
1k views

MiKTeX with PythonTeX causes ImportError: No module named 'pygments' from .bat file, not from command line

I am trying to get PythonTeX 0.15 working with my MiKTeX 2.9 installation, but running into issues. The problem is that when running the batch file from MiKTeX, I get the error ImportError: No module ...
0
votes
2answers
522 views

Problem with Python 3 and Pythontex

I've install portable WinPython (python-3.6.0b4.amd64 from http://winpython.github.io/). I use Miktex and TexStudio as IDE. I'm compiling the example(pythontex_gallery.tex) of the pythonTeX package, ...
3
votes
1answer
423 views

PythonTex: Mixing console and normal code session, with unicode characters

I'm trying to do pretty much the same thing as in here Typeset functions with PythonTeX and execute them in console afterwards, except that I'd like to use some unicode characters (French accents: é, ...
1
vote
0answers
85 views

How do I make PythonTex accepts french accent? [closed]

I have some strings to print using PythonTex. With strings in english, no problem. E.g., I can use string like "a string of char printed using python" and it works \pyc{print("a string of char ...
0
votes
1answer
54 views

fbox and pythontex

Why this does not work? \fbox{ \begin{pycode} print (1+1) \end{pycode} } Is there a way around?
2
votes
1answer
155 views

tkz, tikz-grph, tikzexternalize and pythontex

my code looks like that: \documentclass{minimal} \usepackage{amsmath} \usepackage{tikz} \usepackage{tkz-graph} \usepackage{pythontex} \usetikzlibrary{external} \tikzexternalize[] \begin{pycode} ...
3
votes
1answer
445 views

How to write chemical formulas from Python variables?

I would like to store/read chemical names from some Python code, and pretty-print them using the mhchem package. However, the following code doesn't work. I expect it has something to do with when the ...
2
votes
1answer
225 views

Problems with using the result from an external python function

I am trying to implement a python function (which processes text for me) in my tex document. Thus I started as following: Tex: %& -shell-escape \documentclass{article} \usepackage{pythontex} \...