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
1
vote
0 answers

pylatex: quantities passed in string

I'm using pylatex and the python quantities packages to create a formatted pdf and want to be able to write something like: My custom text and the math: F = 1.982 × 10^20 N I can use pylatex's doc.append() to add text and I can use it to add a…
Sandy
  • 201
  • 2
  • 9
1
vote
1 answer

pylatex Add Horizontal Line

If I have a simple document set up with pylatex... import pylatex as pl geometry_options = { "head": "1pt", "margin": "0.2in", "bottom": "0.2in", "includeheadfoot": False} doc =…
user7086216
1
vote
1 answer

How do I add a page background image in pylatex?

I have written the following code, and have given the latex commands for drawing background, by using the NoEscape module. I have an image reportbg.png in the same directory as the program. Now, I want this image to appear as a background in all…
Atul Balaji
  • 804
  • 4
  • 15
  • 29
0
votes
1 answer

Got error when installing pylatex py `pip install pylatex`

Got the following error (partly) when installing pylatex py pip install pylatex(Python3.10, MacOS). How can I fix it? Building wheel for pylatex (setup.py) ... error error: subprocess-exited-with-error python setup.py bdist_wheel did not run…
0
votes
0 answers

WinError 5: Access is denied when trying to write pdf with pylatex

Code: import pylatex as pl #import latexmk doc = pl.Document() doc.append(pl.Math(data=['x^2+3x+1'])) path = r"C:/Users/maach/OneDrive/Documents/Python…
0
votes
0 answers

python styler object to pylatex (.to_latex)

I create a dataframe with very long titles and can also display them correctly with the Styler Object. In a next step, I would like to pass the dataframe formatted in this way in ".to_latex" of pylatex- Class and generate a PDF. Unfortunately,…
Peter70
  • 1
  • 1
0
votes
0 answers

Change "Continued on next page" in df.to_latex / PYLATEX

Good afternoon. I would like to change the phrase "Continued on next page" from df.to_latex. when running import pylatex to pl pl.NoEscape(dff1.to_latex(longtable=True, index=False, multicolumn=True, multirow=True,caption='Tabla de anexos')) turns…
0
votes
0 answers

Python - Display Function - Prevent new line while using Latex Object

I am trying to output an answer to a differential equation. My Code: function = "cos(z)" def Complex_Function(z): f1=eval(function) return f1 f_subsituted = Complex_Function(a+b*exp(x)) # make z = a+b e^x DerivativeN1_Func =…
0
votes
0 answers

Reading in a LaTex - File in Python

I would like to have a simple way of reading in a LaTex File in python. The main problem are the escape signs \ that are supposed to be escaped for a python string like \ -> \\. (re.escape seems to escape not just \ but all other signs like { as…
Uwe.Schneider
  • 1,112
  • 1
  • 15
  • 28
0
votes
1 answer

pylatex tex file generation in NoEscape container

i want to create PDF`s via Python 3.7.9 and Pylatex 1.4.1. I dont know if i encountered a bug. I try to generate the following formula in the NoEscape container from Pylatex: from pylatex import Document, Section, Math from pylatex.utils import…
Ajanix123
  • 3
  • 1
0
votes
0 answers

Adding code generated by PyLaTeX to existing LaTeX code

I have .tex file and i want to add to it code that I generated with PyLaTeX. How can I do it? This is what I have by now. with open('file1.tex', encoding='utf-8') as file: tex = file.read() doc = Section('a') doc.append(NoEscape(tex)) #code for…
Jan Dzban
  • 1
  • 1
0
votes
1 answer

Is there a way to append a list or text to an existing tex file using pylatex?

I tried to run latexTop() first then latexMiddle() but it does not seem to work however it does not show error message it just does not append latexmiddle into latextop ,I also tried open('name.tex','r') as myfile: text = myfile.read() def…
Vmpful
  • 1
  • 3
0
votes
1 answer

How can I use pandas Styler.to_latex() if I have a Series instead of a Dataframe?

I've been using the Series.to_latex() method to generate a table in my LaTeX doc as it follows: section.append(NoEscape(s.transform(lambda x: f"{x:,}").to_latex())) My Serie looks like this: All channels 1099592 Telefe 158738 El Trece …
Seba Rossi
  • 91
  • 7
0
votes
2 answers

Show Sympy Expression using Pylatex

I am trying to display sympy expression using pylatex and generate pdf ultimately. See below for a simple example. The code does not display the expression correctly. from pylatex import Document import sympy as sp W,L=sp.symbols('W…
0
votes
0 answers

pylatex.errors.CompilerError: No LaTex compiler was found when using Crontab to execute

I am trying to run this line of code to generate a report using pylatex: doc.generate_pdf(report_name, clean_tex=True) This works well to generate a pdf file without any error when I use Spyder and Jupyter Notebook to execute the program, but when…