I am trying to use Pythontex with Sublime Text editor.
I have installed the Pythontex package from: https://ctan.org/pkg/pythontex?lang=en
I have then set up Sublime by going to: Preferences > Package Settings > LatexTools > Settings - User
and I have selected the script option for the builder in line 379.
I then have at line 411:
"windows" : {
"script_commands":
"pdflatex -shell-escape %.tex|pythontex -shell-escape %.tex|pdflatex -shell-escape %.tex|"
},
My understanding is that this is supposed to compile the pdfLatex, then pythonTex, then again pdfLatex.
I have written the following Latex example here.
\documentclass{article}
\usepackage{blindtext}
\usepackage{pythontex}
\title{Sections and Chapters}
\author{Overleaf}
\date{\today}
\begin{document}
\maketitle
\section{Introduction}
This is the first section.
\begin{pycode}
a=2+3
\end{pycode}
\section{Second Section}
This is the second section
My value is $\py{a}$
\end{document}
I have saved this in my directory C:\Users\craws\debug If I go to the cmd terminal, and run the following commands:
C:\Users\craws\debug> pdflatex debug.tex
C:\Users\craws\debug> pythontex debug.tex
C:\Users\craws\debug> pdflatex debug.tex
This correctly compiles the latex document. However, if I try using Ctrl + B in Sublime, the build does not update the python code, and so my output becomes:
This is the second section My value is 4
So using Ctrl+B, I can update the Latex, but not the Python component. Any help would be much appreciated