From fd67f410b29933b2b1d9861af0c9ce12dd297ba9 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Fri, 16 Aug 2019 10:35:52 +0200 Subject: Provide new example --- example_1/Makefile | 46 +++++++++++++++++++++++++++++++++++++ example_1/example.rst | 41 +++++++++++++++++++++++++++++++++ example_1/resources/00_preamble.tex | 33 ++++++++++++++++++++++++++ example_1/resources/10_language.tex | 8 +++++++ example_1/resources/99_sidebar.tex | 33 ++++++++++++++++++++++++++ example_1/resources/modules | 7 ++++++ 6 files changed, 168 insertions(+) create mode 100755 example_1/Makefile create mode 100755 example_1/example.rst create mode 100755 example_1/resources/00_preamble.tex create mode 100755 example_1/resources/10_language.tex create mode 100755 example_1/resources/99_sidebar.tex create mode 100755 example_1/resources/modules (limited to 'example_1') diff --git a/example_1/Makefile b/example_1/Makefile new file mode 100755 index 0000000..99eb4e8 --- /dev/null +++ b/example_1/Makefile @@ -0,0 +1,46 @@ +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=article --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 $< $@ + +clean: + rm -r tmp diff --git a/example_1/example.rst b/example_1/example.rst new file mode 100755 index 0000000..a8173bd --- /dev/null +++ b/example_1/example.rst @@ -0,0 +1,41 @@ +.. -*- mode: rst -*- +.. -*- coding: utf-8 -*- + + +.. role:: latex(raw) + :format: latex + +.. default-role:: latex + + +.. raw:: latex + + % Création d'un nouvel environnement pour créer une boite colorée + \NewEnviron{DUCLASScolorbox}[1]{ + \fcolorbox{#1}{#1}{\BODY} + } + + \setstretch{2.4} + +Titre +===== + + +`\switchcolumn` + +.. container:: colorbox-olive textcolor-white hbox-10cm centering + + `\lipsum[3][1-2]` + +.. container:: colorbox-purple textcolor-white hbox-15cm centering + + `\lipsum[3][3-5]` + +`\switchcolumn` + + +Section +------- + +`\lipsum[1]` + diff --git a/example_1/resources/00_preamble.tex b/example_1/resources/00_preamble.tex new file mode 100755 index 0000000..3aa9b50 --- /dev/null +++ b/example_1/resources/00_preamble.tex @@ -0,0 +1,33 @@ +\usepackage{calc} + +\usepackage[a4paper, top=0.5cm, bottom=0.5cm, outer=0.5cm, inner=0.5cm]{geometry} +\pagestyle{empty} +\pagenumbering{gobble} + +\usepackage{fontspec} +%\defaultfontfeatures{Ligatures={Common, Required, Contextual}} +\setmainfont{DejaVu Sans Bold} + +\newcommand{\DUtitletitle}[1]{% + {\begin{center}\textbf{\textsc{#1}}\end{center}} + } + +% Change the font for bold text +\let\bf\textbf +\renewcommand{\textbf}[1]{{\LibertineFont\selectfont\bf{#1}}} + +\setmonofont{Latin Modern Mono Light} + + +\newcommand{\DUrolelatex}[1]{#1} + +% 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 diff --git a/example_1/resources/10_language.tex b/example_1/resources/10_language.tex new file mode 100755 index 0000000..7cc0990 --- /dev/null +++ b/example_1/resources/10_language.tex @@ -0,0 +1,8 @@ +\RequirePackage[french]{babel} + +%\frenchbsetup{ItemLabeli=\color{fondetsection}\ding{251}} + +\selectlanguage{french} +\frenchspacing +\FrenchFootnotes + diff --git a/example_1/resources/99_sidebar.tex b/example_1/resources/99_sidebar.tex new file mode 100755 index 0000000..2b41d2a --- /dev/null +++ b/example_1/resources/99_sidebar.tex @@ -0,0 +1,33 @@ +\newlength{\notesep} + +\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]} +\let\endchangemargin=\endlist + +% Une commande dédiée pour les notes de marge +\setlength{\columnsep}{0.25cm} +\columnratio{0.75} + +\ifdefinedcolor{backsidecolor}{% + \backgroundcolor{c[0]}{backsidecolor} +}{} + +\newcommand{\DUsidebar}[1]{% + \switchcolumn[0] + \begin{changemargin}{0.7cm}{0.7cm} + %\LibertineFont\selectfont + \ifdefinedcolor{textsidecolor}{\color{textsidecolor}}{} + #1 + \end{changemargin} + \vspace{\notesep} + \switchcolumn + \ifdefinedcolor{textsidecolor}{\color{black}}{} +} + +\AtBeginDocument{% + \begin{paracol}{2} +} +\AtEndDocument{% + % Make the column go to the bottom + %\flushpage + \end{paracol} +} diff --git a/example_1/resources/modules b/example_1/resources/modules new file mode 100755 index 0000000..ae8cc26 --- /dev/null +++ b/example_1/resources/modules @@ -0,0 +1,7 @@ +tikz +parskip # Ne pas indenter la premiere ligne d'un paragraphe +setspace + +DUclasses +paracol +lipsum -- cgit v1.2.3