# TeXmaker (MikTeX) using pythontex

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)


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{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}

• Your code doesn't contain anything related to bibliographies. So why do you call bibtex? – Ulrike Fischer May 14 '18 at 14:25
• It is my standard setting. Without pythontex it does not lead to any errors. Should I remove it? – MrYouMath May 14 '18 at 14:27
• I don't know if it is the source of your problems but I would never use "quick builds" and unnessary tools while investigating an error. They only make things more complicated. – Ulrike Fischer May 14 '18 at 14:30
• You must run pythontex yourfile and then pdflatex again. – Ulrike Fischer May 14 '18 at 14:43
• No, I don't use texmaker. I only know that the documentation says that you can add tools (xm1math.net/texmaker/doc.html#SECTION33). – Ulrike Fischer May 14 '18 at 15:35

pdflatex -shell-escape %.tex|pythontex %.tex|pdflatex -shell-escape %.tex|