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 trying to compile with Quick Build (PdfLaTeX + Bib(la)tex + PdfLaTeX(x2) + View Pdf) I get an error message
error message in Texmaker Messages/Log
This is BibTeX, Version 0.99d (MiKTeX 2.9.6630 64-bit) The top-level
auxiliary file: main.aux I found no \citation commands---while reading file
main.aux I found no \bibdata command---while reading file main.aux I found
no \bibstyle command---while reading file main.aux (There were 3 error
messages)
Process exited with error(s)
I have already added --enable-write18 to have -shell-escape
pdflatex -synctex=1 -interaction=nonstopmode --enable-write18 %.tex
EDIT: (partial solution thanks to @UlrikeFischer) I used tools >> Open Terminal and entered
pdflatex -shell-escape main
pythontex main
pdflatex -shell-escape main
main.pdf
the references in the pdf-file are working. But the pdf is not displayed in texmaker anymore.
overleaf.com example
\documentclass[12pt,a4paper]{scrartcl}
\usepackage[cm]{fullpage}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tgpagella}
\usepackage{tgadventor}
\usepackage{inconsolata}
\usepackage{minted}
\usepackage{pythontex}
\usepackage{multicol}
\usepackage{hyperref}
\title{Using PythonTeX on Overleaf}
\author{Lian Tze Lim}
\date{}
\begin{document}
\maketitle
You need the \texttt{pythontex} package, and you need a custom \texttt{latexmkrc} file, e.g.~from \url{http://mirror.unl.edu/ctan/support/latexmk/example_rcfiles/pythontex-latexmkrc}.
Examples below are taken from \url{https://tug.org/tug2013/slides/Mertz-A_Gentle_Introduction_to_PythonTeX.pdf}
\begin{minted}{latex}
\py{2+2}
\end{minted}
\py{2+2}
\begin{minted}{latex}
Did you know that $2^{65} = \py{2**65}$?
\end{minted}
Did you know that $2^{65} = \py{2**65}$?
\begin{multicols}{2}
\begin{minted}{latex}
\begin{pycode}
lo, hi = 1, 6
print(r"\begin{tabular}{c|c}")
print(r"$m$ & $2^m$ \\ \hline")
for m in range(lo, hi + 1):
print(r"%d & %d \\" % (m, 2**m))
print(r"\end{tabular}")
\end{pycode}
\end{minted}
\begin{pycode}
lo, hi = 1, 6
print(r"\begin{tabular}{c|c}")
print(r"$m$ & $2^m$ \\ \hline")
for m in range(lo, hi + 1):
print(r"%d & %d \\" % (m, 2**m))
print(r"\end{tabular}")
\end{pycode}
\end{multicols}
Simulating interactive sessions:
\begin{pyconsole}
a = 1
b = 1
a+b
\end{pyconsole}
Some discussions above the code snippet above, and then continue\ldots
\begin{pyconsole}
c = a*2 + b
\end{pyconsole}
\end{document}
pythontex yourfile
and thenpdflatex
again. – Ulrike Fischer May 14 '18 at 14:43