Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
This site is currently in read-only mode; we'll return with full functionality soon. Follow @StackStatus or visit our status blog for more info.

Questions tagged [python]

Python is a general-purpose, interpreted high-level programming language.

0
votes
1answer
52 views

TexStudio doesn't find the package “Pygments” although it is installed [duplicate]

I'm try to use the minted package in latex to display code in latex document. From Texstudio, I get an error message you must have pygmentize installed to use this package. If I type pip3 install ...
0
votes
0answers
34 views

Python code environment with input and output

I am trying to set up a simple environment for displaying Python code and output. I want the output to be bold font. I have written the following \newenvironment{code}[2]{ \begin{shaded} \...
0
votes
0answers
20 views

PyLatex : how to use a tikz generated figure as a latex command with parameters?

I have to create a gallery of images with contacts of personalities in LaTex. For that purpose I'm using a mysql database so I need to use PyLatex to generate my latex file. But there is the issue : I'...
1
vote
1answer
75 views

where is the Python icon in fontawesome

I'm trying to add the python icon It appears to be in the font awesome font https://fontawesome.com/icons/python?style=brands to my document. however it seems that there is no \faPython in the ...
0
votes
1answer
46 views

Minted changes text position in slides

I am making a beamer presentation. I have this slide: The code is \begin{frame} Il problema viene affrontato utilizzando il metodo degli elementi finiti che spesso però pone numerose restrizioni ...
1
vote
0answers
24 views

Minted snippet with single quotes [duplicate]

I want to create a Python's code snippet which includes single quotes using minted package. I've put it altogether like this: \begin{minted}[ autogobble, frame=lines, framesep=4mm, ...
2
votes
1answer
59 views

mistake when exporting numpy data to csv to pgfplots

I have to plot data from a numerical simulation. I perform my simulations with python and numpy. But now I want to plot the result in a LaTeX file. Since I want to be able to modify the layout without ...
0
votes
0answers
80 views

Python and TeX, pythontex or hybrid-latex recommended?

Hi I am looking into starting to use Pyhton and (La)TeX together. Now I see two packages on ctan, pythontex and hybrid-latex. What are pros and cons? What is the better developed solution (with ...
0
votes
0answers
33 views

Texmaker - Python - Configuration

LaTex friends, I need your help configuring MacTeX, Texmaker (pdfLatex) and Python on a Mac. I have received a file where a *.tex uses a Python and I just have no idea how to make this file work. I ...
1
vote
2answers
167 views

how to present python snippet code efficiently in latex

I am quiet new to Latex and do not know how to present a simple python code like this in Latex in a professional way.. having your solutions and examples will help me a lot to learn and progress. ...
1
vote
0answers
649 views

Matplotlib error: No such file or directory: 'latex': 'latex'

I am running a public code downloaded from Github, but I have a problem when it gets to the end and it has to plot the results using latex. I get the following error:FileNotFoundError: [Errno 2] No ...
0
votes
0answers
20 views

Reference in latex document to Matplotlib(pgf) generated figure

I have a python script which draws a plot similar to this: fig = plt.figure() ax = plt.axes() x = np.linspace(-2,2,10) y = x**2 ax.plot(x, y, label='$x^2$', color="#07529a", linewidth=2.0) # <--...
2
votes
1answer
111 views

How to configure tcblisting with minted to allow copy/paste from listing with whitespace characters?

This answer from a similar question gets very close to a final copy/paste solution, but does not work for me as it does not select whitespace. I am asking a new question as the linked one is several ...
0
votes
0answers
45 views

Converting Tab-delimited reference list into a bibtex format (using R?)

I need to export search results from Web of Science (i.e. all the results of a query, 100s of entries) and import them in Mendeley with their abstract. while I usually can export a citation in a .bib ...
1
vote
1answer
50 views

matplotlib2tikz date data error

So I'm trying to convert a plot from python to Tikz with hour data in the x axis. This is the image in python: But when I use the tikz_save I got this error: TypeError: a float is required I'm ...
0
votes
0answers
49 views

How can I run an .exe in the .tex file?

I'm writing a scientific proposal and I have a .exe Python script to copy, timestamp and put into a directory. I want to use this .exe whenever I compile. From a logic point of view, this would be ...
2
votes
1answer
197 views

Setting conda environment for pythontex in TexStudio

I am using Texstudio with a build configuration based on this question in order to run PythonTex and embed python code into my documents. This worked and I was able to use the \begin{pycode} and \end{...
1
vote
0answers
70 views

How convert a .bib file to web of science or scopus fomart?

I have a list of paper in .bib format which can be open by mendeley. I want to make them readable for metaknowledge package which is a python library for creating and analyzing scientific metadata. ...
0
votes
0answers
135 views

pygments error Texstudio in Windows 10

I want to use minted package to highlighted my code block which is written in TexStudio. I installed minted package. Secondly I got error shell-escape-flag which is solved after research How-to-invoke-...
4
votes
1answer
486 views

3D matrix visualization, like in Python

I want to create something like the following, however I can’t add red brackets and the commas. This is my code: \[ \left[\left[ \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & ...
2
votes
1answer
77 views

\input{} File does not exist [duplicate]

I have written a template for a personal diary. The main tex file \input a file called entries.tex, which will \input all the diary entries, which are in a subdirectory, as well as write the title of ...
1
vote
1answer
57 views

How to use previously downloaded fonts with lualatex engine and python to create pdf file

How and where to install .ttf fonts which I've already downloaded from web. I've created latex file using online overleaf. Inside same directory I put all my .ttf fonts and LuaLaTeX engine and ...
0
votes
2answers
119 views

Python cannot compile LaTeX file

I am using a Conda Python installation and Jupyter to work with a script producing a LaTeX file I want to compile. These are the relevant code lines: import subprocess xelatex= "/usr/local/texlive/...
1
vote
1answer
391 views

How can i write my python code in LaTeX document?

Hope you are fine! in this opportunity I'd like to ask you how can I put in my LaTeX document a python code, I was using, lsting, and anothers but I have an error, I appreciate your helping. My error ...
3
votes
0answers
73 views

Compile multiple Latex files in parallel

I have around 100000 Latex scripts, each of which generates a document upon compilation, and they share same packages being included. I tried compiling 10 scripts in a sequential fashion using Python ...
1
vote
1answer
355 views

Listing jupyter notebook code in pdf from .ipynb file

I am doing my programs in jupyter notebooks and I want to list it into my pdf using listings package or some other. I don't want to insert images of my notebook. How can I do it? I can able to insert ...
1
vote
1answer
270 views

Multiple Page PDF Export Issue With pylatex

Multiple page issue: I am trying to export a multiple page pdf and there seems to be an error. I cannot find the source... I suppose that it is because of the text " âchemical exchangeâ " where non ...
1
vote
1answer
184 views

Form Fill Rest of the Page pylatex

I have the following pylatex cod: import pylatex as pl from pylatex.utils import NoEscape from pylatex import Command from pylatex import Package from pylatex import Figure import os videoNumber = 1 ...
3
votes
1answer
320 views

pylatex Change Font

How do I change the font to "helvetica" in pylatex ? I tried it, but this does not worK: doc = pylatex.Document(fontenc = 'helvet')
2
votes
1answer
182 views

Latex and SymPy error

I try to make some calculations inside LaTeX. Therefore I want to use Sympy. So I put \usepackage{sympytex} to the header and compile wit pdflatex. After compiling there occurs a .sympy file. The ...
1
vote
1answer
454 views

Convert LaTex accented characters to UTF8 equivalent with Python

I think this should be something standard, but I'm having hard finding anything that works. Given a plain string containing LaTeX accented characters, does anyone know of a python library which can ...
0
votes
1answer
105 views

Escaping HEX-characters source code in \lstinputlisting

I am currently writing a paper where I need to put full Python source code files into the appendix. Since I do not want to bloat my TeX file, I include source code with \lstinputlisting. The source ...
1
vote
0answers
233 views

Interactive Plot with controls in the frame [closed]

I would like to know if there is any way to include a plot which can interactively change using slider controls in a Beamer presentation. For example, I would like to show the following ipython ...
1
vote
0answers
75 views

LaTeX matplotlib pgf shows no colorbar - instead shows colorbar png image filename [duplicate]

Moved from Stack Overflow I'm producing various plots with matplotlib and save them as PGF files. These are then imported in my LaTeX file and compiled using the pgf package. The problem is, I can't ...
7
votes
2answers
3k views

Lstlisting Python

I'm usinglistingspackage to put a python code inside an article. I want it to be written in \ttfamily. The problem is I can't change keywordstyle to bold text. \documentclass{article} \usepackage{...
0
votes
1answer
426 views

Including a complex Matplotlib.Pytplot figure in Latex [duplicate]

I'm not sure if I should post this on the Python SE or here. I have made a complex figure in Python that is exactly how I want it to be. Now I want to include that figure in my thesis in LaTeX. As of ...
1
vote
0answers
117 views

Create new command python

I want create a new command in python, in https://tex.stackexchange.com/a/234232/153360 add the command sage to pythontex. How can I change or add a command which output a string instead of a latex ...
0
votes
0answers
129 views

Change header background color in PyLatex

The following example code is used to generate a report with header and footer. from pylatex import Document, PageStyle, Head, MiniPage, Foot, LargeText, MediumText, LineBreak, simple_page_number ...
5
votes
0answers
159 views

Is there an easy way to correct apostrophes that are the wrong way around in a code listing?

I understand that for quotation marks ` is required to open a quote, however I am listing a long code copied over from Python where some comments are written 'comment' or """comment""". Is there an ...
1
vote
2answers
159 views

Why isn't my pgf figure uncentered? [duplicate]

I am generating pgfplot files (PGF) with Python and matplotlib.pyplot as well as the following configuration for pgf export to be used with pdfLatex compiler: import matplotlib as mpl mpl.use("pgf") ...
2
votes
1answer
270 views

tikz/pgfplots - Plotting 3D surface with sphere

I am trying to solve the following problem: First I would like to produce a surface plot of a function of two variables (in this particular case this surface has a saddle shape). Then I would like to ...
0
votes
1answer
560 views

Error with pygmentize when using minted package

Problem: I get multiple undefined control sequences when using the package minted and I believe it is caused by pygmentize. Background I use the software Texpad and the active LaTeX distribution is ...
2
votes
1answer
1k views

How to include a graph from python in latex text

How would I include a figure from python in LaTeX, in order to use the same font in the text and to adjut the size. If you can include the code that would be great. Sorry, if my question is a bit ...
0
votes
1answer
1k views

How to use mathpix (a LaTeX OCR tool) to identify LaTeX from images?

I'd just heard about mathpix, a way that can identify formula from images and generate the LaTeX code. I have some handouts (already printed) from my teacher 10 years ago written in Chinese and many ...
1
vote
1answer
161 views

Can we write LaTeX inside python turtle graphics? [closed]

I am looking for a way to write latex inside a figure drawn with turtle graphics. It doesn't accept it in the turtle.write() command. Is there another way to do that?
0
votes
1answer
396 views

TeX won't recognize Pygments for use in minted

So a little bit of background: I'm fairly new to LaTeX, I've been writing up homework in it for 3 years and that's it. I'm writing my undergrad thesis with it because it's a departmental requirement, ...
2
votes
1answer
246 views

Turkish character problem when using pdfinfo,trying to get title with pdfrw module of python

I am basically trying to add metadata, especially title to pdf by using pdfinfo as follows: \documentclass{article} \usepackage[utf8]{inputenc} \title{Türkçe Karakter İçeren Başlık} \author{Abdullah ...
1
vote
1answer
750 views

Python and latex

Is there any way to compile a .tex to pdf without having to install latex. Is there any python package for this ? Or even better is there any small stand-alone portable software for this. Thanks a ...
3
votes
0answers
497 views

How to keep indentations in Python code copied from LaTeX PDF?

I tried to include Python 3.6 code in a LaTeX PDF document which should be easily be copied to save to a file or to try the Python code. Although, \begin{verbatim} for row in range(1,9): for col ...
0
votes
1answer
420 views

Inserting multiple figures using loop and python in Windows 7 [Solved]

Hello because I have a set of figures in a folder that I want to put in a document sequentially, I am trying to create an automatic procedure. Looking around I found this old post Inserting figures ...