Questions tagged [pylatex]

PyLaTeX is a Python library for creating and compiling LaTeX files. The goal of this library is to be an easy, but extensible interface between Python and LaTeX.

PyLaTeX has two quite different usages: generating full pdfs and generating LaTeX snippets. Generating full pdfs is mostly useful when all the text that pdf should contain is generated by python, for instance exporting the data from a database. Snippets are useful when some text still needs to be written by hand, but some stuff can be automatically generated, for instance writing a report with a couple of matplotlib plots.

53 questions
11
votes
3 answers

PyLaTeX: pylatex.errors.CompilerError: No LaTex compiler was found

I am trying to run the exact code from here to get an example of pylatex working. In the directory that I am working in, I have copied and pasted from the link: from pylatex import Document, Section, Subsection, Command from pylatex.utils import…
Slowat_Kela
  • 1,377
  • 2
  • 22
  • 60
6
votes
2 answers

How to hide command prompt popup during launching PyLatex or Latexmk

How could I hide command prompt that pops up during launch and execute pylatex codes. I have a page working on it and generate pdf. I need to hide popup window when I run the code. Talking about this window: Is there a way to hide or not showing…
Pavel.D
  • 561
  • 1
  • 15
  • 41
3
votes
0 answers

How to force position of figure with PyLaTeX ?

I'm using PyLaTeX to generate automatically a report file. This report is to be filled with matplotlib plots and I want them to be placed exactly where the code says so. Usually in Latex, I would use the [h] suffix or even [H], but here, no matter…
Mounsif Mehdi
  • 83
  • 1
  • 7
2
votes
0 answers

Command '['latexmk', '--pdf', '--interaction=nonstopmode', 'XXX']' returned non-zero exit status 12

I wanted to use pylatex and tried to generate the example file. I have installed the packages with anaconda (pylatex and latexmk with conda-forge) and having following code: from pylatex import Document, PageStyle, Head, MiniPage, Foot, LargeText,…
2
votes
2 answers

How to write unicode characters to LaTeX document via pylatex

Assume the string myStr which contains three special characters. myStr = "emdash —; delta Δ; thin space:  ;" Further assume that we wish to write this string to a LaTeX document via pylatex. If we write the string as is to a LaTeX document, errors…
Michael Gruenstaeudl
  • 1,609
  • 1
  • 17
  • 31
2
votes
0 answers

pylatex - build .pdf from tex, bib, and images in folder

I am currently working on a project (in Python) that requires a PDF report to be compiled from various results. These results are stored as variables and inserted into a copy of the .tex by substituting keywords throughout the .tex file, using the…
Connor
  • 53
  • 4
2
votes
0 answers

Python - Pylatex header?

Currently I am making a .txt file with Python, to later transform it into a PDF file using PyLaTeX. This is the code I am using: from pylatex import Document, PageStyle, LineBreak, Section, Subsection, Math, Alignat, LargeText, Center,…
LoboFJP
  • 21
  • 3
2
votes
1 answer

How do I compile a greek letter in PyLaTeX into a table?

I am trying to do a code to create a LaTex table from Python implementing PyLaTeX. Two cells of the table I want them to be greek letters, like [what is shown in the image][1]. Look at my block of code and see that I am typing '\gamma' and…
2
votes
0 answers

How to make the string not go out of the table in pylatex

cur.execute("SELECT * FROM services WHERE host_id = " + str(row['id'])) services = cur.fetchall() with doc.create(LongTabu("l l l l l",)) as data_table: data_table.add_hline() …
Brainwreck
  • 21
  • 2
2
votes
0 answers

python pylatex line spacing, units and math equations in strings

I have a text block as a string that contains some SI units and equations. How can I for example use superscript numbers (e.g. 10^-10 m^2) and math equations in strings? Greek letters and e.g. the ± symbol work fine. from pylatex import…
mati
  • 1,093
  • 4
  • 12
  • 18
2
votes
2 answers

Is there any way to add borders to a table generated by to_latex()?

I am creating a table by passing DataFrame to to_latex(), which is generating a table without a border. Is there any way to add it?
P.Natu
  • 131
  • 1
  • 3
  • 12
1
vote
1 answer

How to avoid braces in \usepackage generated with pylatex for package names containing "-"?

I need to create a LaTeX document with the package "tikz-feynman" in Python. I use pylatex but, when I try to create the file like this doc = Document("my_diagram") doc.packages.append((Package("tikz-feynman", options=["compat =…
1
vote
0 answers

Problem with softPageBreaks when reading a odf file with lxml to create a LaTeX file

I have a Google Doc that I want to convert into a LaTeX file while stripping out some content of the Google Doc. Specifically I want to remove all headlines in the Google Doc. I also currently have four-line paragraphs in the Google Doc where each…
Christian
  • 25,249
  • 40
  • 134
  • 225
1
vote
1 answer

Pylatex - Beamer - Option clash for package xcolor. Unable to resolve using python

Please find my code below from pylatex import Tabular, Document, Package, MultiColumn, SmallText, Command, MiniPage, Center, NoEscape import pandas as pd import numpy as np #region Create document with the necessary packages # Create a document…
1
vote
1 answer

Attribute error when working with 'self' and 'with'

I'm working on a Python script to generate a report in PDF using PyLatex. I set up a class ReportGeneration. Inside, a table 'overview_table' is defined. When I try to work with table from 2 functions, it gives me the error: AttributeError: args A…
epodegrid
  • 29
  • 6
1
2 3 4