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
57 views

PythonTex showing matrices in the document

I'm trying to plot a simple matrix in a LaTeX document but without success. I compile the .tex file, then pythontex.py, then the .tex file again, and it compiles without errors but the final document ...
0
votes
0answers
34 views

How to run a document containing both PythonTeX and BibTeX in one go on TeXstudio?

Let's say that I have the pythonbiblio.bib file that contains this: @misc{Einstein, author = "Albert Einstein", title = "The Art of the Calculus", year = "2042" } And my pythonbiblio.tex ...
0
votes
0answers
94 views

Convert Jupyter Notebook to Latex with margin handled automatically

Is there a way to convert Jupyter Notebook to .tex with margins being taken care automatically. I have some lines that overshoots the margin on LaTex. Is it possible to automatically put new line ...
2
votes
1answer
63 views

Pycode code inside exsheet question

I want to create a table inside of a exsheets question (or solution) (using data defined in another pycode environment outside of it). But this doesn't work. What did I do wrong and how can I make it ...
1
vote
0answers
41 views

How can I hide (or blur) some code in a pythontex environment?

My question is directly related to this one. Does there exists a solution for pythontex ? At least for the verbatim environment. More precisely, let us consider the following MWE : \documentclass[...
1
vote
1answer
46 views

how to pass section numbers to python in pythontex?

I am writing out some parameters to JSON files using pythontex, but would like to add context information in form of section numbers (for example \thesection or \thesubsubsection, perhaps also the ...
3
votes
0answers
48 views

Pysub the entire document

In pythontex the pysub environment provides a nice syntax to refer to python variables (for example !{a}) inside your latex code. Suppose you have only one pythontex session in your document. Is ...
1
vote
1answer
45 views

pythontex environments and savebox

I want to use the same code in several pythontex environments: \documentclass{article} \usepackage{pythontex} \begin{document} \begin{pyconsole} print('Hello \\LaTeX{} World!') \end{pyconsole} \...
1
vote
1answer
105 views

tikz \foreach to iterate over a python list via pythontex

I am using pythontex to read in a large python list from disk into my .tex file; I wish to use the \foreach command from the tikz package to do some typesetting for each of the items in the list. MWE ...
2
votes
1answer
163 views

Issue with Pythontex using a LaTeX editor (MacOS - Anaconda)

I just achieved a clean install of MacOS Mojave. I have reinstalled Pythontex with the help of TeX Live Utility. Python 3 is installed with Anaconda. The package works fine when the typesetting is ...
2
votes
1answer
258 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
264 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 ...
1
vote
0answers
86 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 ...
3
votes
0answers
86 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} \...
1
vote
0answers
101 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
61 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
37 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
107 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 ...
1
vote
1answer
373 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 ...
4
votes
1answer
49 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{...
1
vote
0answers
267 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
141 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
912 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
76 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}
1
vote
0answers
335 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
2answers
255 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
111 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
364 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
175 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
63 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
297 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
493 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
405 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
151 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 ...
5
votes
1answer
207 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
560 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
86 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
407 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
432 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
157 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
144 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
286 views

What would it take to create juliatex?

In analogy to pythontex, what would it take to create juliatex?
1
vote
0answers
1k 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
289 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
122 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
118 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
216 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 ...
3
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
626 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
491 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: é, ...