0% found this document useful (0 votes)
17 views1 page

Pythontex Help

Uploaded by

saifamu2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

Pythontex Help

Uploaded by

saifamu2000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

How to setup TeXstudio for PythonTeX?

1. Install python
2. Go to Options>Configure TeXstudio>Build>[Default compiler>>pdflatex]>User commands
User: pythontex:pythontex

Command: txs:///pdflatex | pythontex %.tex | txs:///pdflatex


3. Open MikTex and install package Currfile
4. Write your code as usually and go to Tools>User>1.pythontex everytime to compile your document
5. Done

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}

The factorial of $10$ is \py{result}.


\end{document}

You might also like