Questions tagged [python]
Python is a general-purpose, interpreted high-level programming language.
461 questions
7
votes
1
answer
163
views
LaTeX environment to write verbatim Python code to an external file
I’d like to have a solution environment that does the following:
It writes the contents of the environment to an external file \jobname.py. All the solutions should be in the same file \jobname.py.
...
3
votes
1
answer
175
views
minted pygments dark style do not have optimization for LaTeX syntax
I have a question .
When I use pygments dark style material , I notice that many words are invisible when displaying LaTeX/text source code , since the key/value pairs are all black . These dark ...
0
votes
1
answer
79
views
LaTeX is trying to write to python file although just call file to be read
For some reason, in the code below, LaTeX is overwriting my .py file although I am just trying to call the .py file. Here is the contents of the pycode_batch_noreg.py file:
import network3
from ...
0
votes
0
answers
54
views
Indentation in python codes get lost when using package pythonhighlight
I wrote an introduction note about python, which included something like the following
...
\usepackage{pythonhighlight}
...
the following indentation works in python
\begin{python}
a=5
if a==4:
...
3
votes
4
answers
239
views
Package memoize (python-based extraction) Error: Python module 'pdfrw' was not found
I’m looking forward to running the memoize package to reduce my compile time, but after several days of research, I’m clueless. This is my first Python rodeo, so I may be missing something that to ...
0
votes
0
answers
177
views
Match Matplotlib Fonts to Overleaf Document Fonts
I’m writing a report in Overleaf, and I want the fonts in my Matplotlib plots (legends, axis labels, and tick labels) to match the font used in my Overleaf document. So I won’t have to squint to see ...
1
vote
1
answer
87
views
How Can I change the colors of variables in lstlistings?
So I have some code blocks like the followings
\begin{lstlisting}[language=Python, caption={Ejecución de prueba}]
altura_lista = altura.tolist()
peso_lista = peso.tolist()
w, b = train(altura_lista, ...
0
votes
0
answers
380
views
"An associated PostScript font (required by Matplotlib) could not be found for TeX font 'zptmcm7y' in
An associated PostScript font (required by Matplotlib) could not
be found for TeX font 'zptmcm7y' in
'C:/Users/Admin/AppData/Local/MiKTeX/fonts/map/pdftex/pdftex.map';
this problem can often be ...
0
votes
0
answers
122
views
PDF file generated by Latex, how to extract (matlab/python) source code (verbatim/listings)
This is a bit bizarre. I have to review a bunch of PDF files, generated by Latex (but I don't have access to the source files) and that includes
matlab or python code, that was included with listings ...
0
votes
0
answers
48
views
package pythonhighlight isnt rendering in LyX 2.3.7
when I use this package in LyX it doesn't render at all without raising any errors.
the same code on overleaf works completely fine and as intended.
here's a picture from lyx of the code itself and ...
0
votes
2
answers
85
views
Multi-colored and multi-bar grouped charts [duplicate]
I have a Python script that automatically generates LaTeX codes that plot bar charts. An example of the generated code looks like:
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\...
0
votes
0
answers
819
views
Manim Latex error converting to dvi
I'm not able to use Latex on Manim due to an error converting dvi. I saw other post about this and I change my code but it still does not work. Here is my code :
from manim import *
class dvi_error(...
0
votes
0
answers
71
views
Link on pdf triggers .sh/.py/.bat
I have been looking for a while for a solution in LaTex. My intention is to create a link inside a PDF generated with LaTex that triggers a .sh/.py/.bat by clicking in the link. Not like \write18, ...
0
votes
1
answer
138
views
Unable to write a fraction in JupyterLab
I am trying to write a fraction inside the superscript of a variable (in my case $frac{1}{3}$.
I get a long error:
plt.ylabel('$\\frac{\delta T}{\delta t}$ $[^oR/min]$')
0
votes
1
answer
128
views
Automatically creating a grid of images
I have several pdf images that I have generated with matplotlib. I want to be able to arrange them in an arbitrary grid. For this purpose I have written a python script that in turn writes and runs ...
0
votes
0
answers
84
views
Customize minted environment w.r.t IDLE
I'm writing a document using Python code and I want to make it like IDLE style. With minted, we can custom the environment so that each line of code starts with >>>, however, I want >>&...
2
votes
1
answer
869
views
Custom language lexer alias not found by pygments for minted
Problem
I've made a custom lexer for a pseudocode language in Python (3.11). The file is saved in the same directory as my TeX project. I am using pdflatex to compile my project, and it has the --...
1
vote
0
answers
162
views
Packages ucs and hyperref don't get along under xelatex
I'm getting an "undefined control sequence" error for \UTFviii@loop whenever I use both the ucs package and the hyperref package under XeLaTeX (and LuaLaTeX). (I understand \UTFviii@loop has ...
0
votes
1
answer
359
views
How to configure the Python library latexmake to run with luaLaTeX?
I am working on automated templates, and I want to use latexmake with luaLaTeX, as suggested in a comment on this question, where I attempted a similar setup with XeLaTeX. However, I am facing ...
1
vote
1
answer
448
views
Error With LaTeX (TeXStudio) Package "Pygmentize"
After downloading the Minted and Pygmentize packages for TeXstudio, I am experiencing an error:
File 'pygmentize.sty' not found. \begin.
Here is the code for my document so far:
\documentclass{...
0
votes
1
answer
779
views
Markdown using LaTeX: Quotation marks in PyCharm vs. Github
I'm used to typing typographically correct English quotation marks as follows:
``text goes here"
In usual LaTeX documents this will work, no questions asked. When I use Markdown in Jupyter ...
2
votes
0
answers
100
views
Set Python's decorators in some colour but keep @ as an operator unchanged
I am using listings for code formatting and colouring in a document I'm working on, including a lot of Python code. I would like for decorators to be displayed in a specific colour but for the @ ...
2
votes
1
answer
308
views
Ticks scaling - How to change the common factor multiplier to an offset value?
I am plotting the following figure using Python and I obtain this render:
Here, Python is automatically adding an constant value offset (+9.192682e9) on the y axis to read more easily the data.
Now, ...
0
votes
1
answer
535
views
How can I export a txt table to latex? [duplicate]
I have txt file with table format, I did it in python but now I have to export this table to Latex but I don't know how. I'm not good at all in latex so I'll appreciate if you help me.
Thank you!
2
votes
1
answer
133
views
`pythontex` and `\subfigure`
pythontex causing error with \subfigure environment.
I have to rewrite my dissertation with many figures and subfigures, of which some are plotted with python inside LaTeX (I had to give up the python ...