Bug 460366 - pdflatex in Kile creates inccomplete .pytxcode file
Summary: pdflatex in Kile creates inccomplete .pytxcode file
Status: REPORTED
Alias: None
Product: kile
Classification: Applications
Component: general (other bugs)
Version First Reported In: 2.9.93
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Michel Ludwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-13 14:06 UTC by oliver
Modified: 2022-10-13 14:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oliver 2022-10-13 14:06:19 UTC
SUMMARY
***
While trying to use python code in LaTeX in Kile via the pythontex package, pdflatex executed from Kile creates an incomplete .pytxcode file.
***


STEPS TO REPRODUCE
1.  Consider the following MWE:
\documentclass[aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{svg}
\usepackage{pythontex}

\begin{document}
\begin{frame}[fragile]{Frame title}
\begin{pycode}
import matplotlib
import matplotlib.pyplot as plt
import math

matplotlib.use("pgf")
matplotlib.rcParams.update({
    "pgf.texsystem": "pdflatex",
    'font.family': 'serif',
    'text.usetex': True,
    'pgf.rcfonts': False,
})
x = [7, 14, 21, 28, 35, 42, 49]
y = [8, 13, 21, 30, 31, 44, 50]

plt.figure(figsize=(1,2))
plt.plot(x, y, color='red')
plt.savefig("xy.pgf")
\end{pycode}

\begin{center}
    \input{xy.pgf}
\end{center}
\end{frame}
\end{document}


2.  From the command line:
pdflatex test.tex 
pythontex test.tex
pdflatex test.tex 


OBSERVED RESULT
The following .pytxcode is created by pdflatex:
=>PYTHONTEX#py#default#default#0#code#####2#
import matplotlib
import matplotlib.pyplot as plt
import math

matplotlib.use("pgf")
matplotlib.rcParams.update({
    "pgf.texsystem": "pdflatex",
    'font.family': 'serif',
    'text.usetex': True,
    'pgf.rcfonts': False,
})
x = [7, 14, 21, 28, 35, 42, 49]
y = [8, 13, 21, 30, 31, 44, 50]

plt.figure(figsize=(1,2))
plt.plot(x, y, color='red')
plt.show()
plt.savefig("xy.pgf")
=>PYTHONTEX:SETTINGS#
version=0.17
outputdir=pythontex-files-test
workingdir=.
workingdirset=false
gobble=none
rerun=default
hashdependencies=default
makestderr=false
stderrfilename=full
keeptemps=none
pyfuture=default
pyconfuture=none
pygments=true
pygglobal=:GLOBAL||
fvextfile=-1
pyconbanner=none
pyconfilename=stdin
depythontex=false
pygfamily=py|python3|
pygfamily=pycon|pycon|
pygfamily=sympy|python3|
pygfamily=sympycon|pycon|
pygfamily=pylab|python3|
pygfamily=pylabcon|pycon|

4. Execute pdflatex within kile

OBSERVED RESULT
the following .pytxcode is created 
=>PYTHONTEX#py#default#default#0#code#####2#
import matplotlib
import matplotlib.pyplot as plt
import math

matplotlib.use("pgf")
matplotlib.rcParams.update({
    "pgf.texsystem": "pdflatex",
    'font.family': 'serif',
    'text.usetex': True,
    'pgf.rcfonts': False,
})
x = [7, 14, 21, 28, 35, 42, 49]
y = [8, 13, 21, 30, 31, 44, 50]

plt.figure(figsize=(1,2))
plt.plot(x, y, color='red')
plt.show()
plt.savefig("xy.pgf")

EXPECTED RESULT
The .pytxcode files should be the same.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION