Migrate LaTeX to XeTeX

This commit is contained in:
Alexandre Iooss 2020-09-06 15:30:12 +02:00
parent ae028b7d06
commit dcdd8e56e8
16 changed files with 17 additions and 38 deletions

View File

@ -18,8 +18,7 @@ py37-django22:
python3-django-extensions python3-django-filters python3-django-polymorphic python3-django-extensions python3-django-filters python3-django-polymorphic
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil
python3-babel python3-lockfile python3-pip python3-phonenumbers python3-babel python3-lockfile python3-pip python3-phonenumbers
python3-bs4 python3-setuptools tox python3-bs4 python3-setuptools tox texlive-xetex
texlive-latex-base texlive-latex-recommended texlive-lang-french lmodern texlive-fonts-recommended
script: tox -e py37-django22 script: tox -e py37-django22
# Ubuntu 20.04 # Ubuntu 20.04
@ -36,8 +35,7 @@ py38-django22:
python3-django-extensions python3-django-filters python3-django-polymorphic python3-django-extensions python3-django-filters python3-django-polymorphic
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil
python3-babel python3-lockfile python3-pip python3-phonenumbers python3-babel python3-lockfile python3-pip python3-phonenumbers
python3-bs4 python3-setuptools tox python3-bs4 python3-setuptools tox texlive-xetex
texlive-latex-base texlive-latex-recommended texlive-lang-french lmodern texlive-fonts-recommended
script: tox -e py38-django22 script: tox -e py38-django22
linters: linters:

View File

@ -12,8 +12,7 @@ RUN apt-get update && \
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \ python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \
python3-bs4 python3-setuptools \ python3-bs4 python3-setuptools \
uwsgi uwsgi-plugin-python3 \ uwsgi uwsgi-plugin-python3 \
texlive-latex-base texlive-latex-recommended texlive-lang-french lmodern texlive-fonts-recommended \ texlive-xetex gettext libjs-bootstrap4 fonts-font-awesome && \
gettext libjs-bootstrap4 fonts-font-awesome && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Instal PyPI requirements # Instal PyPI requirements

View File

@ -23,8 +23,7 @@ Bien que cela permette de créer une instance sur toutes les distributions,
$ sudo apt update $ sudo apt update
$ sudo apt install --no-install-recommends -y \ $ sudo apt install --no-install-recommends -y \
ipython3 python3-setuptools python3-venv python3-dev \ ipython3 python3-setuptools python3-venv python3-dev \
texlive-latex-base texlive-lang-french lmodern texlive-fonts-recommended \ texlive-xetex gettext libjs-bootstrap4 fonts-font-awesome git
gettext libjs-bootstrap4 fonts-font-awesome git
``` ```
2. **Clonage du dépot** là où vous voulez : 2. **Clonage du dépot** là où vous voulez :
@ -98,8 +97,7 @@ Sinon vous pouvez suivre les étapes décrites ci-dessous.
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \ python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \
python3-bs4 python3-setuptools \ python3-bs4 python3-setuptools \
uwsgi uwsgi-plugin-python3 \ uwsgi uwsgi-plugin-python3 \
texlive-latex-base texlive-lang-french lmodern texlive-fonts-recommended \ texlive-xetex gettext libjs-bootstrap4 fonts-font-awesome \
gettext libjs-bootstrap4 fonts-font-awesome \
nginx python3-venv git acl nginx python3-venv git acl
``` ```

View File

@ -38,10 +38,7 @@
- python3-venv - python3-venv
# LaTeX (PDF generation) # LaTeX (PDF generation)
- texlive-fonts-recommended - texlive-xetex
- texlive-lang-french
- texlive-latex-base
- texlive-latex-recommended
# WSGI server # WSGI server
- uwsgi - uwsgi

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -1,22 +1,14 @@
{% load escape_tex %} {% load escape_tex %}
\documentclass[a4paper,11pt]{article}
\nonstopmode \usepackage{fontspec}
\documentclass[11pt]{article} \usepackage{geometry}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
%\usepackage{bera}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{fancyhdr} \usepackage{fancyhdr}
\usepackage{fp} \usepackage{fp}
\usepackage{transparent}
\usepackage{eso-pic} \usepackage{eso-pic}
\usepackage{ifthen} \usepackage{ifthen}
\DeclareUnicodeCharacter{00B0}{$^\circ$}
\def\TVA{0} % Taux de la TVA \def\TVA{0} % Taux de la TVA
\def\TotalHT{0} \def\TotalHT{0}
@ -60,7 +52,8 @@
\parbox[b][\paperheight]{\paperwidth}{% \parbox[b][\paperheight]{\paperwidth}{%
\vfill \vfill
\centering \centering
{\transparent{0.1}\includegraphics[width=\textwidth]{../../apps/treasury/static/img/{{ obj.bde }}}}% %FIXME remove ".png" on obj.bde
%\includegraphics[width=\textwidth]{../../apps/treasury/static/img/{{ obj.bde }}_bg.jpg};
\vfill \vfill
} }
} }

View File

@ -1,6 +1,5 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from unittest import skip
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@ -143,7 +142,6 @@ class TestInvoices(TestCase):
self.assertRedirects(response, reverse("treasury:invoice_list"), 302, 200) self.assertRedirects(response, reverse("treasury:invoice_list"), 302, 200)
self.assertFalse(Invoice.objects.filter(pk=self.invoice.id).exists()) self.assertFalse(Invoice.objects.filter(pk=self.invoice.id).exists())
@skip("LaTeX is buggy in the CI")
def test_invoice_render_pdf(self): def test_invoice_render_pdf(self):
""" """
Generate the PDF file of an invoice. Generate the PDF file of an invoice.

View File

@ -209,7 +209,7 @@ class InvoiceRenderView(LoginRequiredMixin, View):
# The file has to be rendered twice # The file has to be rendered twice
for ignored in range(2): for ignored in range(2):
error = subprocess.Popen( error = subprocess.Popen(
["pdflatex", "-interaction=nonstopmode", "invoice-{}.tex".format(pk)], ["xelatex", "-interaction=nonstopmode", "invoice-{}.tex".format(pk)],
cwd=tmp_dir, cwd=tmp_dir,
stdin=open(os.devnull, "r"), stdin=open(os.devnull, "r"),
stderr=open(os.devnull, "wb"), stderr=open(os.devnull, "wb"),

View File

@ -1,15 +1,11 @@
\documentclass[landscape,10pt]{article} \documentclass[a4paper,landscape,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{fontspec}
\usepackage[margin=1.5cm]{geometry} \usepackage[margin=1.5cm]{geometry}
\usepackage{lmodern}
\begin{document} \begin{document}
\begin{center} \begin{center}
\huge{Liste des inscrits \og {{ wei.name }} \fg{}} \huge{Liste des inscrits « {{ wei.name }} »}
{% if bus %} {% if bus %}
\LARGE{Bus {{ bus.name|safe }}} \LARGE{Bus {{ bus.name|safe }}}

View File

@ -690,7 +690,7 @@ class TestWEIRegistration(TestCase):
""" """
with open("/dev/null", "wb") as devnull: with open("/dev/null", "wb") as devnull:
return subprocess.call( return subprocess.call(
["which", "pdflatex"], ["which", "xelatex"],
stdout=devnull, stdout=devnull,
stderr=devnull, stderr=devnull,
) == 0 ) == 0

View File

@ -1103,7 +1103,7 @@ class MemberListRenderView(LoginRequiredMixin, View):
with open(os.devnull, "wb") as devnull: with open(os.devnull, "wb") as devnull:
error = subprocess.Popen( error = subprocess.Popen(
["pdflatex", "-interaction=nonstopmode", "{}/wei-list.tex".format(tmp_dir)], ["xelatex", "-interaction=nonstopmode", "{}/wei-list.tex".format(tmp_dir)],
cwd=tmp_dir, cwd=tmp_dir,
stderr=devnull, stderr=devnull,
stdout=devnull, stdout=devnull,