TransWikia.com

Problem with Pythontex

TeX - LaTeX Asked by habib on February 5, 2021

I would like to use Pythontex. I am on Mac texlive2019, python 3.7 (anaconda) TeXShop V 4.31
I followed all that was written on the documentation for the installation but impossible to have the result ?

documentclass[12pt,french]{article}

usepackage[utf8]{inputenc}
usepackage[T1]{fontenc} 
usepackage{lmodern}
usepackage{babel}
usepackage{pythontex}
setlength{parindent}{0pt}

begin{document}

begin{pyverbatim}
import math
def racine(a):
    return math.sqrt(a)
print(racine(9))
end{pyverbatim}
bigskip
Résultat : 
begin{pycode}
import math
def racine(a):
    return math.sqrt(a)
print(racine(9))
end{pycode}
begin{pyconsole}
var = 1 + 1
var
end{pyconsole}
end{document}

One Answer

Please download the file Pythontex-platexmkrc.zip from https://herbs.github.io and unzip it. That produces a platexmkrc file that contains information for TeXShop's pdflatexmk engine on how to process the files created by pythontex. Place that file in the same folder as your Source file. Then add the line % !TEX program = pdflatexmk to the top of your source file (it tells TeXShop to use the pdflatexmk engine to typeset the file) and typeset the file using Typeset->Typeset (Cmd-T).

NOTE: PLEASE READ THE NOTE BELOW. It is necessary to make a change to the platexmkrc file to work with anaconda3.

Answered by Herb Schulz on February 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP