From 779c0b6c1739ed39e47a58b16f33ef6058323252 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Tue, 1 Sep 2020 18:45:21 +0200 Subject: Update --- Makefile | 45 +++++++++++++++++++++++++++++++++++++-------- chapters/c.rst | 6 +++++- notes_arduino.rst | 6 +++--- resources/preamble.tex | 40 +++++++++++++++++++++------------------- 4 files changed, 66 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index f202323..4fc9dfb 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ TEX=xelatex -SOURCE=. +SOURCE=chapters SRC =$(wildcard *.rst) SVG =$(wildcard content/*.svg) @@ -12,7 +12,7 @@ all: $(PDFS) BIBS =$(wildcard *.bib) -DIR = $(sort $(shell find $(SOURCE) -name '*.rst' -print)) +CHAPTERS = $(sort $(shell find $(SOURCE) -name '*.rst' -print)) SOURCES = $(sort $(wildcard resources/*.tex)) null := @@ -35,18 +35,36 @@ content/%.pdf: content/%.svg dot2tex --autosize --figonly -o $@ $< # Generate the latex file from rst -tmp/%.tex: %.rst $(INCLUDED_TEX) $(SOURCES)| tmp - $$(command -v rst2latex rst2latex.py | head -n 1) --no-section-subtitles --no-section-numbering --table-style=borderless --use-latex-citations --use-latex-docinfo --documentclass=article --documentoption=12pt,A4,table --syntax-highlight=short --stylesheet=$(PACKAGES),$(TEX_STYLE) $< $@ +tmp/%.tex: %.rst $(INCLUDED_TEX) $(SOURCES) $(CHAPTERS)| tmp + $$(command -v rst2latex rst2latex.py | head -n 1) \ + --no-section-subtitles \ + --no-section-numbering \ + --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/{c}{\\hfill ... continued on next page/{r}{... suite sur la page suivante/;s|^%$$||' $@ - sed -i -e 's/\endfirsthead/\endfirsthead\\tableHeaderStyle/g' $@ + #sed -i -e 's/\endfirsthead/\endfirsthead\\tableHeaderStyle/g' $@ sed -i -e 's/longtable\*/mytable/g' $@ - sed -i -e 's/p{[0-9]\.[0-9]*\\DUtablewidth}/X/g' $@ + #sed -i -e 's/p{[0-9]\.[0-9]*\\DUtablewidth}/X/g' $@ # Generate each pdf with latex tmp/%.pdf: tmp/%.tex $(BIBS) | tmp - $(TEX) -output-directory tmp $< + # Delete the previous index file if present + test -f "tmp/$*.ind" && rm "tmp/$*.ind" || true + # First run + $(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 + # Generate the index page + if [ -s "tmp/$*.idx" ]; then \ + makeindex "tmp/$*"; \ + $(TEX) -output-directory tmp "$<"; \ + fi + while grep 'Rerun to get ' "tmp/$*.log" ; do $(TEX) -output-directory tmp "$<" ; done # Put the pdf in the right place %.pdf: tmp/%.pdf | tmp @@ -54,3 +72,14 @@ tmp/%.pdf: tmp/%.tex $(BIBS) | tmp clean: rm -r tmp + +%.css: %.sass + sassc $< $@ + +%.html: %.rst %.css + $$(command -v rst2html rst2html.py | head -n 1) --stylesheet notes_arduino.css $< $@ + +weasyprint.pdf: notes_arduino.html + weasyprint notes_arduino.html -s notes_arduino.css weasyprint.pdf + + diff --git a/chapters/c.rst b/chapters/c.rst index 2948db4..bb6160c 100644 --- a/chapters/c.rst +++ b/chapters/c.rst @@ -4,7 +4,11 @@ .. role:: raw-latex(raw) :format: latex -La carte Arduino se programme en langage C. +La carte Arduino se programme en langage C++. Il s'agit d'un langage proche du +matériel, permettant de gérer finement les ressources mémoires ou la +performance du programme. Il s'agit aussi d'un langage complexe, avec +énormément de subtilité et pour lequel il existe des livres entiers dédiés à +son apprentissage. Les types ========= diff --git a/notes_arduino.rst b/notes_arduino.rst index 68d1cf6..6c08dcd 100644 --- a/notes_arduino.rst +++ b/notes_arduino.rst @@ -48,9 +48,9 @@ L'alimentation du système .. include:: chapters/alimentation.rst -============ -Le langage C -============ +============== +Le langage C++ +============== .. include:: chapters/c.rst diff --git a/resources/preamble.tex b/resources/preamble.tex index b524b89..52a6adc 100644 --- a/resources/preamble.tex +++ b/resources/preamble.tex @@ -26,26 +26,28 @@ } \usepackage{longtable} -\usepackage{tabu} -% alternate rowcolors for all long-tables +%\usepackage{tabu} +%% alternate rowcolors for all long-tables \newenvironment{mytable}[2][c]% -{\longtabu to \linewidth [#1]{#2}\tableHeaderStyle}% -{\endlongtabu} - - -% This red commes from a triad on the blue -\colorlet{tableHeader}{redColor} -\definecolor{tableLineOne}{RGB}{245, 245, 245} -\definecolor{tableLineTwo}{RGB}{224, 224, 224} - -\newcommand{\tableHeaderStyle}{ - \rowfont{\leavevmode\color{white}\bfseries} - \rowcolor{tableHeader} -} - -\taburowcolors[2] 2{tableLineOne .. tableLineTwo} -\tabulinesep = ^4mm_3mm -\everyrow{\tabucline[.4mm white]{}} +{\longtable[#1]{#2}}% +{\endlongtable} +% +% +%% This red commes from a triad on the blue +%\colorlet{tableHeader}{redColor} +%\definecolor{tableLineOne}{RGB}{245, 245, 245} +%\definecolor{tableLineTwo}{RGB}{224, 224, 224} +% +%\newcommand{\tableHeaderStyle}{ +% \rowfont{\leavevmode\color{black}\bfseries} +% \rowcolor{tableHeader} +%} +% +%\taburowcolors[2] 2{tableLineOne .. tableLineTwo} +%\tabulinesep = ^4mm_3mm +%\everyrow{\tabucline[.4mm white]{}} \usepackage{etoolbox} \patchcmd{\quote}{\rightmargin}{\leftmargin 0em \rightmargin}{}{} + +\makeindex -- cgit v1.2.3