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.

0
votes
0answers
18 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
24 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
18 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
38 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
56 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
29 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
35 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
35 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
105 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
65 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 ...
1
vote
1answer
495 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
42 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
28 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
145 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
94 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
57 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
196 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
159 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
50 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
167 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
316 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
230 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
0answers
33 views

pythontex failing with tikzposter

I am attempting to use some python code in a tikzposter. This is failing. \documentclass{tikzposter} \usepackage{pythontex} \begin{document} \block{test block}{% \begin{pyconsole} a=1 \end{...
0
votes
1answer
95 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
128 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
209 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
59 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} \...
2
votes
2answers
214 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
196 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
107 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
105 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
203 views

What would it take to create juliatex?

In analogy to pythontex, what would it take to create juliatex?
1
vote
0answers
742 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
227 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
93 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: ...
3
votes
1answer
96 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
143 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
910 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
480 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
402 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
76 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
52 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
148 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
411 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
181 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} \...
1
vote
1answer
74 views

Forward text to PythonTeX environment

Is it possible to create a new environment in TeX, such that the text in that environment is forwarded to a Python function with PythonTeX? It is possible to forward values to Python (by using \...
3
votes
1answer
184 views

Py{} adds a none in the code

I have the following MWE using pythontex: %& -shell-escape \documentclass{article} \usepackage{pythontex} \newcommand{\printPython}[1]{ \py{print(r'Hello, #1')}% \newline } \begin{document} Say ...
1
vote
2answers
417 views

2 column layout with python code inside- overlapping problem

I am using following latex code to write my appendix to which I need to add python code. \section{Appendix} \begin{landscape} \begin{multicols}{2} \subsection{Source Code} \definecolor{keywords}{RGB}{...
2
votes
1answer
174 views

Newcommand with PythonTex

I want to realize pytontex \pyc as newcommand so that I can use it in a generic way. When I use the newcommand I just get some strange "i" (I use it for enumerating the spec variable) and no output ...
3
votes
1answer
431 views

Do we need to manually invoke pythontex? TeXShop Engine: PythonTeX with XeLaTeX

I have one problem with pythontex using TeXShop: after compiling it, I need to manually go to the terminal and call pythontex filename.pdf. Is it possible to avoid this and let TeXShop call pythontex? ...