From a5696db7113a3b1d7350775aecb280300a08031c Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Wed, 1 May 2024 14:34:22 +0200 Subject: Added a new model --- common/Makefile.common | 66 +++++++++++++++++++++++++++++++++ model_7/Makefile | 2 + model_7/example.rst | 39 +++++++++++++++++++ model_7/resources/00_colors.tex | 15 ++++++++ model_7/resources/00_length.tex | 2 + model_7/resources/00_preamble.tex | 25 +++++++++++++ model_7/resources/10_decoration.tex | 37 ++++++++++++++++++ model_7/resources/10_fonts.tex | 29 +++++++++++++++ model_7/resources/10_header_footer.tex | 23 ++++++++++++ model_7/resources/10_title_style.tex | 61 ++++++++++++++++++++++++++++++ model_7/resources/99_begin.tex | 7 ++++ model_7/resources/modules | 15 ++++++++ readme.rst | 8 ++++ snapshots/model7.png | Bin 0 -> 45049 bytes 14 files changed, 329 insertions(+) create mode 100644 common/Makefile.common create mode 100755 model_7/Makefile create mode 100644 model_7/example.rst create mode 100755 model_7/resources/00_colors.tex create mode 100755 model_7/resources/00_length.tex create mode 100755 model_7/resources/00_preamble.tex create mode 100644 model_7/resources/10_decoration.tex create mode 100755 model_7/resources/10_fonts.tex create mode 100644 model_7/resources/10_header_footer.tex create mode 100755 model_7/resources/10_title_style.tex create mode 100755 model_7/resources/99_begin.tex create mode 100755 model_7/resources/modules create mode 100644 snapshots/model7.png diff --git a/common/Makefile.common b/common/Makefile.common new file mode 100644 index 0000000..59a795c --- /dev/null +++ b/common/Makefile.common @@ -0,0 +1,66 @@ +TEX?=xelatex +SOURCE=. + +SRC =$(wildcard *.rst) +SVG =$(wildcard content/*.svg) + +PDFS = $(SRC:.rst=.pdf) +INCLUDED_PDF = $(SVG:.svg=.pdf) + +all: $(PDFS) + +BIBS =$(wildcard *.bib) + +DIR = $(sort $(shell find $(SOURCE) -name '*.rst' -print)) +SOURCES = $(sort $(wildcard resources/*.tex) ) + +null := +space := $(null) # +comma := , +TEX_STYLE := $(subst $(space),$(comma),$(strip $(SOURCES))) +TEX_BIBS := $(subst $(space),$(comma),$(strip $(BIBS))) + +PACK = $(shell sed -e 's/\#.*$$//' -e '/^$$/d' resources/modules) +PACKAGES := $(subst $(space),$(comma),$(strip $(PACK))) + +tmp: + mkdir tmp + +# Generate the latex file from rst +tmp/%.tex: %.rst $(INCLUDED_PDF) $(SOURCES)| tmp + $$(command -v rst2latex rst2latex.py | head -n 1) --no-section-subtitles --table-style=borderless --use-latex-citations --use-latex-docinfo --documentclass=extarticle --documentoption=12pt,A4,table --syntax-highlight=short --stylesheet=$(PACKAGES),$(TEX_STYLE) $< $@ + sed -i -e 's/continued on next page/suite sur la page suivante/;s|^%$$||' $@ + sed -i -e 's/admonition-/admonition/g' $@ + +# Generate each pdf with latex +tmp/%.pdf: tmp/%.tex $(BIBS) | tmp + $(TEX) -output-directory tmp $< + #bibtex tmp/$*.aux && $(TEX) -output-directory tmp $< || echo "no bib" + while grep 'Rerun to get ' tmp/$*.log ; do $(TEX) -output-directory tmp $< ; done + +# Put the pdf in the right place +%.pdf: tmp/%.pdf | tmp + cp $< $@ + pkill -HUP mupdf + +clean: + rm -r tmp + +# Generate the final PDF document +# Send a notification to mupdf in order to refresh the document +%.png: %.pdf + gs -dTextAlphaBits=4 -dFirstPage=1 -dLastPage=1 -dBATCH -dNOPAUSE -sDEVICE=png16m -r150 -dUseCropBox -sOutputFile=$@ $< + +# Watch mode, which regenerate the documents as soon there is a change in a +# file., +# requires inotifywait (package inotify-tools) +watch: + while true; do \ + $(MAKE) all; \ + inotifywait -qre close_write . ; \ + done + +# Format the pages in order to make them printable in a book +book: $(PDFS) + + pdfbook2 $< diff --git a/model_7/Makefile b/model_7/Makefile new file mode 100755 index 0000000..05631bf --- /dev/null +++ b/model_7/Makefile @@ -0,0 +1,2 @@ +include ../common/Makefile.common +TEX=lualatex diff --git a/model_7/example.rst b/model_7/example.rst new file mode 100644 index 0000000..5b8cf6c --- /dev/null +++ b/model_7/example.rst @@ -0,0 +1,39 @@ +.. -*- mode: rst -*- +.. -*- coding: utf-8 -*- + + +Main title +========== + +.. raw:: latex + + \setstretch{1.2} + \changefontsize{13pt} + +Title +----- + +.. raw:: latex + + \lipsum[1][1-5] + \begin{multicols}{2} + +1 +- + +.. raw:: latex + + \lipsum[1-9][5-15] + +2 +- + +.. raw:: latex + + \lipsum[2-3] + + +.. raw:: latex + + \end{multicols} + diff --git a/model_7/resources/00_colors.tex b/model_7/resources/00_colors.tex new file mode 100755 index 0000000..d34ba49 --- /dev/null +++ b/model_7/resources/00_colors.tex @@ -0,0 +1,15 @@ +\usepackage{xcolor} + +% Couleur utilisée pour le bandeau +% Ne pas définir la couleur de fond de page pour permettre l¿ajout +% des dessins +%\definecolor{backsidecolor}{RGB}{255,255,255} + +% Couleur utilisée pour les éléments du bandeau +%\definecolor{sidecolor}{RGB}{36,63,96} +%\definecolor{sidecolor}{RGB}{101,114,131} + +% Couleur utilisée pour le texte du bandeau +\definecolor{textsidecolor}{RGB}{0,0,0} + +\definecolor{altColor}{named}{lightgray} diff --git a/model_7/resources/00_length.tex b/model_7/resources/00_length.tex new file mode 100755 index 0000000..d5dc470 --- /dev/null +++ b/model_7/resources/00_length.tex @@ -0,0 +1,2 @@ +% Distance de la colonne +%\setlength{\columnsep}{0.25cm} diff --git a/model_7/resources/00_preamble.tex b/model_7/resources/00_preamble.tex new file mode 100755 index 0000000..30c4fd3 --- /dev/null +++ b/model_7/resources/00_preamble.tex @@ -0,0 +1,25 @@ +\usepackage[a4paper, landscape, top=1.0cm, left=1.5cm, right=1.5cm, bottom=2.0cm]{geometry} +%\pagestyle{empty} +%\pagenumbering{arabic} +\newcommand{\DUrolelatex}[1]{#1} + +\usepackage{tocloft} +\renewcommand{\cfttoctitlefont}{\normalfont\Large\bfseries}% Remove \bfseries from ToC title +\renewcommand{\cftsecfont}{\Garamond\selectfont\itshape}% Remove \bfseries from section titles in ToC +\renewcommand{\cftsecpagefont}{\Garamond\selectfont}% Remove \bfseries from section titles' page in ToC + +% Supprime l'indentation pour les listes de définitions +\newenvironment{DUfieldlist}% + {\description[align=left,labelwidth=1.0cm,leftmargin=.5cm]} + {\enddescription} + +\makeatletter +\newcommand{\ifdefinedcolor}[3]{% + \@ifundefinedcolor{#1}{#3}{#2} +} +\makeatother + +\input{../common/10_language.tex} +\input{../common/10_lists.tex} +\input{../common/10_nowidows.tex} + diff --git a/model_7/resources/10_decoration.tex b/model_7/resources/10_decoration.tex new file mode 100644 index 0000000..b394599 --- /dev/null +++ b/model_7/resources/10_decoration.tex @@ -0,0 +1,37 @@ +% Add a decoration in the corner of each page +% The image is selected using pdfornament, and is positionned using the margin +% of the pages. + +\usepackage{tikz} +\usepackage{eso-pic} +\usepackage{pgfornament} +\usepackage{tikzpagenodes} +\usepackage{ifthen} +\usetikzlibrary{positioning} + +% Apply a decoration over each page +% Arguments +% 1: the size of the decoration +% 2: the distance to the page (not the text margin but the page itself +% 3: the color +\newcommand{\pageornament}[3]{% + \begin{tikzpicture}[remember picture, overlay] + \node[yshift=-#2,xshift=-#2, anchor=north east] at (current page.north east){% + \pgfornament[color=#3,width=#1,symmetry=v]{41} + }; + \node[yshift=#2,xshift=-#2,anchor=south east] at (current page.south east){% + \pgfornament[color=#3,width=#1,symmetry=c]{61}}; + \node[yshift=-#2,xshift=#2,anchor=north west] at (current page.north west){% + + \pgfornament[color=#3,width=#1]{41} + }; + \node[yshift=#2,xshift=#2,anchor=south west] at (current page.south west){% + \pgfornament[color=#3,width=#1,symmetry=h]{61} + }; + \end{tikzpicture} +} + +\AddToShipoutPictureBG{% + \pageornament{1.75cm}{0.5cm}{altColor} +} + diff --git a/model_7/resources/10_fonts.tex b/model_7/resources/10_fonts.tex new file mode 100755 index 0000000..bc2e3be --- /dev/null +++ b/model_7/resources/10_fonts.tex @@ -0,0 +1,29 @@ +\usepackage{fontspec} +\setmainfont{Lato Light}[ + Ligatures={Required,Common,TeX}, + BoldFont={Lato Bold}, + ItalicFont={EB Garamond 12 Italic}, + ItalicFeatures={ + Ligatures={Required,Common,TeX,Rare}, + RawFeature={+dlig,+clig}} +] + +\newcommand{\DUtitletitle}[1]{% + {\begin{center}\textbf{\textsc{#1}}\end{center}} + } + +\setmonofont{Latin Modern Mono Light} + +\newfontfamily\Garamond{EB Garamond}[ + Mapping=tex-text, + Ligatures={Required,Common,TeX,Rare}, + RawFeature={+dlig,+clig} +] + +% Variante de la police avec les caractères en capitales modifiés +% Cette variante est utilisée pour les titres +\newfontfamily\GaramondSwsh{EB Garamond}[ + Mapping=tex-text, + Ligatures={Required,Common,TeX,Rare}, + RawFeature={+dlig,+swsh,+calt} +] diff --git a/model_7/resources/10_header_footer.tex b/model_7/resources/10_header_footer.tex new file mode 100644 index 0000000..e7d0534 --- /dev/null +++ b/model_7/resources/10_header_footer.tex @@ -0,0 +1,23 @@ +\usepackage{fancyhdr} + +\fancyhf{} +\pagestyle{empty} + +%%% En-tete +%%pages impaires +%\fancyhead[LO]{\thedate} +% +%%pages paires +%\fancyhead[RE]{\thedate} + + +\renewcommand{\headrule}{ +} +%%%Pieds de page +%pages impaires +%\fancyfoot[RO]{ +%{page \thepage}} % ici le num de page +\fancyfoot[LO]{\Garamond\selectfont Page \thepage} % ici l'auteur +%%pages paires +%\fancyfoot[LE]{page \thepage} % ici le num de page +\fancyfoot[RE]{\Garamond\selectfont Page \thepage} % ici l'auteur diff --git a/model_7/resources/10_title_style.tex b/model_7/resources/10_title_style.tex new file mode 100755 index 0000000..993b625 --- /dev/null +++ b/model_7/resources/10_title_style.tex @@ -0,0 +1,61 @@ +\usepackage[explicit]{titlesec} +\usepackage{pgfplots} +\pgfplotsset{compat=newest} + +\providecommand{\DUdocumentsubtitle}[1]{% + %\begin{nthcolumn}{1} + \color{black} + \em + \GaramondSwsh\selectfont + \Large + #1 + %\end{nthcolumn} +} + +\makeatletter + +\def\@maketitle{% + \vspace*{0.5cm} + \textcolor{altColor}{% + \Garamond\selectfont + \huge \@title + } + \vspace*{1.0cm} +} +\makeatother + +\newcommand\SecTitle[1]{% +\begin{tikzpicture} + + \node (A) at (0,0) + {\Large{\textit{#1 }}}; + \node (B) at (5,0) {}; + \node (C) at (-5,0) {}; + + % Change the color for the lines and apply the ornament + \draw [altColor, line width=0.2mm] (C) to (A.west); + \draw [altColor, line width=0.2mm] (A.east) to (B); +\end{tikzpicture}} + +% Titre de niveau 1 +% On affiche le Swash sur les initiales ici +\titleformat{\section} + {\centering} + {\thesection} + {} + {\SecTitle{\GaramondSwsh\selectfont{#1 }}} + +% Titre de niveau 2 +\titleformat{\subsection} + {\bf\centering} + {\thesubsection} + {} + {#1} + +% Titre de niveau 3 +\titleformat{\subsubsection} + {\bfseries\normalsize} + {\thesubsubsection} + {2em} + {} + {} diff --git a/model_7/resources/99_begin.tex b/model_7/resources/99_begin.tex new file mode 100755 index 0000000..5d9ca89 --- /dev/null +++ b/model_7/resources/99_begin.tex @@ -0,0 +1,7 @@ +\input{../common/90_ref.tex} + +%% On charge les colonnes dès le début du document. +%\AtBeginDocument{% +% \begin{paracol}{1} +%} + diff --git a/model_7/resources/modules b/model_7/resources/modules new file mode 100755 index 0000000..c7b9742 --- /dev/null +++ b/model_7/resources/modules @@ -0,0 +1,15 @@ +tikz +parskip # Ne pas indenter la premiere ligne d'un paragraphe +setspace + +# Polices mathematiques. +amsmath +amsfonts +amssymb + +DUsmallcaps +paracol +lipsum +DUcolumn +Ducenter +fontsize diff --git a/readme.rst b/readme.rst index 8629320..408a0a2 100755 --- a/readme.rst +++ b/readme.rst @@ -93,6 +93,14 @@ Une version inspirée par le fameux `moderncv`__ .. __: /latex_template.git/plain/model_6/example.pdf +Model 7 +------- + +Modèle utilisé pour un mariage + +.. image:: /latex_template.git/plain/snapshots/model7.png + :width: 400px + La syntaxe ========== diff --git a/snapshots/model7.png b/snapshots/model7.png new file mode 100644 index 0000000..887bdea Binary files /dev/null and b/snapshots/model7.png differ -- cgit v1.2.3