Questions tagged [python]

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

0
votes
0answers
25 views

How can I see the command that TeXworks is using and emulate this using pdflatex on the command line

I've written a program to automate generation of pdf files. In my python script I use pdflatex and call this with a command line package: command: pdflatex --interaction=batchmode my_file.tex | ...
2
votes
2answers
51 views

Definition-time expansiton of command line input

I'm trying to make the following code work correctly. I'm using command line call to python to check whether a number is in a list (no clue how to do this in pure LaTeX(?)). I then want to check ...
0
votes
0answers
19 views

newline lost with python code generated with minted in a pdf

I'm trying to insert python3 code in a Latex document with `Texstudio`` I have the following code: % !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape] \documentclass[a4paper, 12pt]{book} \...
0
votes
1answer
46 views

Extract entry keys from bib file and create a file for each entry key

In the context of ideas mentioned at How to embed a review in biblatex? one should create a file for each entry key in the bib file. These files will be named to refer to each entry key, names will be ...
1
vote
1answer
179 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
121 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
57 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
133 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
56 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 ...
0
votes
0answers
27 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, ...
3
votes
1answer
70 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
156 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
36 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
415 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
1k 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
32 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) # <--...
3
votes
1answer
183 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
62 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
89 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
50 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
258 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
95 views

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

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
184 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
541 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
90 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
72 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
187 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
422 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
83 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
430 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
371 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
231 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
404 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
217 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
578 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
114 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
267 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
90 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 ...
8
votes
2answers
4k 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
487 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
141 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 ...
5
votes
0answers
184 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
207 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
306 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 ...
2
votes
1answer
701 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 ...
3
votes
1answer
2k 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
169 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
497 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
261 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 ...