Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to to compile .tex file? #362

Open
catauggie opened this issue Dec 23, 2022 · 2 comments
Open

How to to compile .tex file? #362

catauggie opened this issue Dec 23, 2022 · 2 comments

Comments

@catauggie
Copy link

Try to launch basic simple example from Jupyter Notebook:

from pylatex import Document, Section, Subsection, Command
from pylatex.utils import italic, NoEscape
import pdflatex
  
doc = Document('test_limit')
doc.append('a dog')
doc.generate_pdf()
but get an error:

Usage

latexmk [options] [filename]

latexmk: error: no such option: --pdf
CalledProcessError: Command '['latexmk', '--pdf', '--interaction=nonstopmode', 'C:\Users\ivan\test_limit.tex']' returned non-zero exit status 2.

how could it be solved?

@g-r-a-e-m-e
Copy link

Hello! A bit delayed, but I just tested the following and it appears to work. Hope this helps!

Steps taken

  1. From command line
$ cd <directory-path>
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install pylatex
$ pip install pdflatex
$ nano test.py
  1. Python script for test.py
from pylatex import Document, Section, Subsection, Command
from pylatex.utils import italic, NoEscape
from pdflatex import PDFLaTeX 
  
doc = Document('test_limit')
doc.append('a dog')
doc.generate_pdf('my-pdf')
  1. Write out and exit nano
  2. From command line
$ python3 test.py

It should write out the following .pdf to <directory-path>

my-pdf.pdf

@chantran22
Copy link

chantran22 commented Oct 31, 2023

I did installing pdflatex but it still get error when running code
image

how to solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants