Pythontex Help
Pythontex Help
1. Install python
2. Go to Options>Configure TeXstudio>Build>[Default compiler>>pdflatex]>User commands
User: pythontex:pythontex
Important: While writing python code inside pycode, always start writing code from leftmost side otherwise there will be indentation error
Example:
\documentclass{article}
\usepackage{pythontex}
\begin{document}
\begin{pycode}
def factorial(n):
if n == 0 or n == 1:
return 1
else:
return n * factorial(n-1)
result = factorial(10)
\end{pycode}