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

Replace pdflatex with LuaLatex and latexmk #911

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ virtual env, in order to keep the old one working).
If you want PDF export, you can use :
- xhtml2pdf (default)
- weasyprint (easy to install on Linux ; harder on Windows)
- you can also use the binary "pdflatex" (Ubuntu package 'texlive-latex-base').
- you can also use the binary "latexmk" with "lualatex" (Ubuntu packages 'latexmk' and 'texlive-latex-base').

Installation with 'pip':
- You should probably use "virtualenv".
Expand Down
7 changes: 4 additions & 3 deletions creme/billing/exporters/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ def generate_pdf(self, *, content, dir_path, basename):
# NB: return code seems always 1 even when there is no error...
subprocess.call(
[
'pdflatex',
'-interaction=batchmode',
'-output-directory', dir_path,
'latexmk',
'-lualatex',
'-quiet',
'-cd',
latex_file_path,
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
\documentclass[french,11pt]{article}
\usepackage[french]{babel}
\usepackage[french]{layout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\usepackage{units}
\usepackage{bera}
Expand Down
12 changes: 6 additions & 6 deletions creme/billing/tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
)
from .fake_exporters import OnlyInvoiceExportEngine

pdflatex_not_installed = which('pdflatex') is None
latex_not_installed = which('lualatex') is None or which('latexmk') is None

try:
import weasyprint # NOQA
Expand Down Expand Up @@ -360,7 +360,7 @@ def test_flavour(self):
self.assertEqual('it_IT', flavour4.language)
self.assertEqual('theme/with/odd/name', flavour4.theme)

@skipIf(pdflatex_not_installed, '"pdflatex" is not installed.')
@skipIf(latex_not_installed, '"lualatex" and "latexmk" is not installed.')
@override_settings(BILLING_EXPORTERS=['creme.billing.exporters.latex.LatexExportEngine'])
def test_exporter_latex(self):
engine1 = LatexExportEngine(Quote)
Expand Down Expand Up @@ -885,7 +885,7 @@ def test_export_error04(self):

@skipIfCustomInvoice
@skipIfCustomProductLine
@skipIf(pdflatex_not_installed, '"pdflatex" is not installed.')
@skipIf(latex_not_installed, '"lualatex" and "latexmk" is not installed.')
@override_settings(BILLING_EXPORTERS=['creme.billing.exporters.latex.LatexExportEngine'])
def test_export_invoice_latex(self):
user = self.login_as_root_and_get()
Expand Down Expand Up @@ -1322,7 +1322,7 @@ def test_export_invoice_xls02(self):

@skipIfCustomQuote
@skipIfCustomServiceLine
@skipIf(pdflatex_not_installed, '"pdflatex" is not installed.')
@skipIf(latex_not_installed, '"lualatex" and "latexmk" is not installed.')
@override_settings(BILLING_EXPORTERS=['creme.billing.exporters.latex.LatexExportEngine'])
def test_export_quote_latex(self):
user = self.login_as_root_and_get()
Expand Down Expand Up @@ -1524,7 +1524,7 @@ def test_export_credentials(self):

self.assertGET403(self._build_export_url(invoice))

@skipIf(pdflatex_not_installed, '"pdflatex" is not installed.')
@skipIf(latex_not_installed, '"lualatex" and "latexmk" is not installed.')
@override_settings(BILLING_EXPORTERS=['creme.billing.exporters.latex.LatexExportEngine'])
@skipIfCustomInvoice
def test_export_latex_credentials01(self):
Expand All @@ -1550,7 +1550,7 @@ def test_export_latex_credentials01(self):
).update(engine_id=LatexExportEngine.id)
self.assertGET403(self._build_export_url(invoice))

@skipIf(pdflatex_not_installed, '"pdflatex" is not installed.')
@skipIf(latex_not_installed, '"lualatex" and "latexmk" is not installed.')
@override_settings(BILLING_EXPORTERS=['creme.billing.exporters.latex.LatexExportEngine'])
@skipIfCustomInvoice
def test_export_latex_credentials02(self):
Expand Down
2 changes: 1 addition & 1 deletion creme/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@
'creme.billing.exporters.xls.XLSExportEngine',
'creme.billing.exporters.xhtml2pdf.Xhtml2pdfExportEngine',

# You needed to install LateX on the server (the command "pdflatex" is run).
# You needed to install LateX on the server (the command "latexmk" and "lualatex" is run).
# Some extra packages may be needed to render correctly the themes
# (see FLAVOURS_INFO in 'creme/billing/exporters/latex.py')
# 'creme.billing.exporters.latex.LatexExportEngine',
Expand Down