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
1 answer

Is there a function to format the index name in a pandas styler (DataFrame.style.to_latex) so can escape latex?

I am trying to format the index name so it can escape latex when using .to_latex(). Using .format_index() works only for the index values but not for the index names. Here is a Minimal, Reproducible Example. import pandas as pd import numpy as…
Jaime
  • 23
  • 4
1
vote
0 answers

With pylatex how do I place a path expression (eg. a matrix) inside a section's title?

I am trying to make this exam paper with pylatex. I think the best solution is to make sections for each problem, however I could not figure out how to make a math enviroment inside a section's title. Is that possible? I tried to make a math…
1
vote
1 answer

Failing to place an image with pylatex

I am using pylatex to create a pdf with an image in it at the coordinates that I specify. I have used the code below but no matter what coordinates I enter, the image is always in the upper left corner. Please help me. from pylatex import (Document,…
AlbrechtL
  • 13
  • 4
1
vote
0 answers

How to create a barcode using pylatex

I am writing a python script to generate a bunch of pdfs that display information from a database. I want to generate a barcode on each pdf page but I am unsure how to do it using the pylatex library. For example, in latex you can create a barcode…
NicLovin
  • 317
  • 3
  • 20
1
vote
0 answers

How to read a latex template in Python and insert table cell values from csv/dataframe

The purpose is to create a weekly report where I compute some weekly metrics and have a latex template which will get updated with the latest metrics. This latex template contains texts and tables. I want to modify just the table values. I have a…
Pallabi
  • 11
  • 1
1
vote
1 answer

pylatex: How do I change the font size of my document?

I'm trying to change the basic font size of my document. This is my code: from pylatex import Document, Command if __name__ == '__main__': doc = Document('basic') doc.documentclass = Command( 'documentclass', …
Richard
  • 62,943
  • 126
  • 334
  • 542
1
vote
0 answers

Make blank tex file handle PyLatex

I want to make a blank tex file in PyLatex with no headers and no environments added from the start. i.e. I do not want \documentclass and \begin{document} to be in my LaTex file. I've tried to write a class that does not propagate any packages or…
Shirsho
  • 313
  • 2
  • 6
1
vote
1 answer

Correct use of append and Alignat from pylatex while pdf creating (python)

I want to save some formulas from latex in pdf from pylatex import Document, Section, Subsection, Command,Package, Alignat doc = Document(default_filepath='basic.tex', documentclass='article') doc.append('Solve the equation:') …
1
vote
0 answers

Error to generate pdf. Either specify a LaTex compiler or make sure you have latexmk or pdfLaTex installed

I'm facing the same problem as PyLaTeX: pylatex.errors.CompilerError: No LaTex compiler was found but I have not found an answer yet. I´m using Windows and I have the MixTex and pylatex packages installed. I'm trying first this to then added to…
Richard21
  • 157
  • 1
  • 9
1
vote
0 answers

PyLatex Setup Basic Example

Apologies if a similar question has been posted elsewhere. I'm trying to switch to Python for typesetting new projects but find the setup quite difficult. For this I've come across PyLatex, which looks promising I've followed the setup instructions…
Paul
  • 23
  • 2
1
vote
1 answer

How can I put the title and author closer together in PyLaTeX?

I'm using PyLaTeX as a means to generate pdfs (as part of a flask web app), and I can't get the title and author to be at a distance other than the the default one. My code as of now looks like this (this works as a means of collapsing the date…
Rusca8
  • 533
  • 4
  • 11
1
vote
1 answer

Plot multiple separate figures using matplotlib in pylatex

I am trying to plot multiple different plots in one pdf using pylatex and matplotlib. The code below can generate two plots just fine, however, the second plot contains the data from the first plot when I just want two separate plots i.e. (x,y) in…
Pavan Inguva
  • 65
  • 1
  • 7
1
vote
1 answer

Python: PyLaTeX hyperlink to a URL

I would like to add a text with a hyperlink to my document being generated via pyLaTeX. In LaTeX this would be performed by using: \href{http://www.sharelatex.com}{Something Linky} I have found the labelref documentation containing the Marker object…
Eric
  • 795
  • 5
  • 21
1
vote
0 answers

How can I draw a tree with TikZ using PyLatex?

I have a homework assignment where I need to generate a PDF file containing a tree image using Python 3 and LaTeX's tikz package. It'd be really helpful if someone has a simple sample code. I need to know how to create a child node. from pylatex…
1
vote
1 answer

How to add a reference to a figure in a cell of a latex table in pylatex

I am using pylatex, and I need to add a reference to a labeled figure in a cell of a latex table within the tabular environment using the "add_row" command. Which one is the correct syntax? It seems a simple string does not work. I tried adding the…
dsama
  • 33
  • 6