From 4b03461d1f30f127a22cd1963e7f8c77560abc2b Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Fri, 28 Feb 2025 12:57:28 +0100
Subject: [PATCH 1/2] Add PDF export functionality and integrate courstex
 submodule

---
 .forgejo/workflows/serve.yaml | 4 ++++
 .gitmodules                   | 3 +++
 cours/SIN/01-capteurs.md      | 3 +++
 cours/SIN/02-signaux.md       | 3 +++
 cours/SIN/03-can.md           | 3 +++
 courstex                      | 1 +
 myst.yml                      | 4 +++-
 procédures/01-vr.md           | 3 +++
 procédures/02-laser.md        | 3 +++
 9 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 .gitmodules
 create mode 160000 courstex

diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml
index 5c43a11..d374f5b 100644
--- a/.forgejo/workflows/serve.yaml
+++ b/.forgejo/workflows/serve.yaml
@@ -12,6 +12,10 @@ jobs:
         run: /usr/bin/python -m venv .venv
       - name: Install dependencies
         run: ./.venv/bin/pip install -r requirements.txt
+      - name: Build PDF exports
+        run: |
+          . .venv/bin/activate
+          myst build --execute --pdf
       - name: Build static HTML
         run: |
           . .venv/bin/activate
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..95ac1a6
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "courstex"]
+	path = courstex
+	url = https://git.edgarpierre.fr/edpibu/courstex.git
diff --git a/cours/SIN/01-capteurs.md b/cours/SIN/01-capteurs.md
index fbffa9b..30ee8e0 100644
--- a/cours/SIN/01-capteurs.md
+++ b/cours/SIN/01-capteurs.md
@@ -1,6 +1,9 @@
 ---
 title: Les capteurs
 subject: Cours
+export:
+  - format: pdf
+    template: courstex
 ---
 
 # Définition
diff --git a/cours/SIN/02-signaux.md b/cours/SIN/02-signaux.md
index 49288b0..05095b8 100644
--- a/cours/SIN/02-signaux.md
+++ b/cours/SIN/02-signaux.md
@@ -1,6 +1,9 @@
 ---
 title: Les signaux
 subject: Cours
+export:
+  - format: pdf
+    template: courstex
 kernelspec:
   name: python3
   display_name: Python 3
diff --git a/cours/SIN/03-can.md b/cours/SIN/03-can.md
index ff412e3..e5226a2 100644
--- a/cours/SIN/03-can.md
+++ b/cours/SIN/03-can.md
@@ -1,6 +1,9 @@
 ---
 title: Le CAN
 subject: Cours
+export:
+  - format: pdf
+    template: courstex
 kernelspec:
   name: python3
   display_name: Python 3
diff --git a/courstex b/courstex
new file mode 160000
index 0000000..d040c12
--- /dev/null
+++ b/courstex
@@ -0,0 +1 @@
+Subproject commit d040c12b630182d5b127a9123a0cfa617d9a0016
diff --git a/myst.yml b/myst.yml
index 0a2d0db..c1554bb 100644
--- a/myst.yml
+++ b/myst.yml
@@ -16,7 +16,9 @@ project:
       country: France
       url: https://lyceedupaysdesoule.fr
   license: CC-BY-NC-SA-4.0
-  exclude: README.md
+  exclude:
+    - README.md
+    - courstex
   numbering:
     headings: true
   settings:
diff --git a/procédures/01-vr.md b/procédures/01-vr.md
index 1902ac3..9f135f3 100644
--- a/procédures/01-vr.md
+++ b/procédures/01-vr.md
@@ -6,6 +6,9 @@ abstract: |
   L'objectif de cette procédure est de visualiser un modèle 3D réalisé avec
   Solidworks en réalité augmentée avec l'application [Caddy](https://www.heycaddy.net/)
   sur Meta Quest 3.
+export:
+  - format: pdf
+    template: courstex
 ---
 
 # Export au format IGES
diff --git a/procédures/02-laser.md b/procédures/02-laser.md
index 59a87c1..274acc5 100644
--- a/procédures/02-laser.md
+++ b/procédures/02-laser.md
@@ -5,6 +5,9 @@ subtitle: Découper ou graver une pièce
 abstract: |
   L'objectif de cette procédure est de découper et graver une pièce dans une
   plaque à l'aide de la découpe laser JAMP78 JA50.
+export:
+  - format: pdf
+    template: courstex
 ---
 
 # Import dans RdCAM

From df56660eb0858d4d5a8a792cbc08a968fb93a340 Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Fri, 28 Feb 2025 13:18:21 +0100
Subject: [PATCH 2/2] Refactor figures in documentation to use consistent
 syntax and improve layout; update myst.yml to remove obsolete output
 settings.

---
 cours/SIN/01-capteurs.md | 23 +++++++----------------
 cours/SIN/03-can.md      | 25 +++++++++++--------------
 myst.yml                 |  4 ----
 3 files changed, 18 insertions(+), 34 deletions(-)

diff --git a/cours/SIN/01-capteurs.md b/cours/SIN/01-capteurs.md
index 30ee8e0..3e64d40 100644
--- a/cours/SIN/01-capteurs.md
+++ b/cours/SIN/01-capteurs.md
@@ -31,10 +31,9 @@ Ils génèrent donc un signal dit **binaire**.
 Un interrupteur (@inter) ou un détecteur de mouvement PIR (@pir) sont des capteurs
 tout ou rien.
 
-::::{figure}
-:label: fig:capteur-tor
 :::{figure} https://upload.wikimedia.org/wikipedia/commons/3/3a/Switches-electrical.agr.jpg 
 :label: inter
+:width: 50%
 
 Interrupteur[^inter].
 
@@ -44,6 +43,7 @@ Interrupteur[^inter].
 
 :::{figure} https://upload.wikimedia.org/wikipedia/commons/2/2e/Motion_detector.jpg
 :label: pir
+:width: 50%
 
 Détecteur de mouvement PIR[^pir].
 
@@ -51,9 +51,6 @@ Détecteur de mouvement PIR[^pir].
 Public domain, via Wikimedia Commons.
 :::
 
-Exemples de capteurs tout ou rien
-::::
-
 ## Les capteurs analogiques
 Le signal de sortie est en relation directe avec la grandeur d'entrée
 (généralement proportionnelle)
@@ -62,10 +59,9 @@ c'est un signal dit **analogique**.
 Une thermistance (@thermistance) ou une jauge de déformation (@jauge) sont des
 capteurs analogiques.
 
-::::{figure}
-:label: fig:capteur-analogique
 :::{figure} https://upload.wikimedia.org/wikipedia/commons/3/3b/NTC_bead.jpg
 :label: thermistance
+:width: 50%
 
 Thermistance : résistance variant selon la température[^thermistance].
 
@@ -76,6 +72,7 @@ via Wikimedia Commons.
 
 :::{figure} https://upload.wikimedia.org/wikipedia/commons/0/0a/Unmounted_strain_gauge.jpg
 :label: jauge
+:width: 50%
 
 Jauge de déformation : résistance variant selon son élongation[^jauge].
 
@@ -83,17 +80,13 @@ Jauge de déformation : résistance variant selon son élongation[^jauge].
 [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0), via Wikimedia Commons.
 :::
 
-Exemples de capteurs analogiques.
-::::
-
 ## Les capteurs numériques
 Un capteur numérique génère un signal de sortie ne pouvant prendre qu'un certain nombre de valeur distincte, c'est à dire un signal **numérique**.
 Une caméra (@camera) ou un codeur absolu (@codeur) sont des capteurs numériques.
 
-::::{figure}
-:label: fig:capteur-numerique
 :::{figure} https://upload.wikimedia.org/wikipedia/commons/0/02/S4000_Image_Sensor_%28Colorful%29.jpg
 :label: camera
+:width: 50%
 
 Caméra : pour chaque pixel, le signal peut prendre une valeur entière allant de 0 à 255[^camera].
 
@@ -101,12 +94,10 @@ Caméra : pour chaque pixel, le signal peut prendre une valeur entière allant d
 :::
 :::{figure} https://upload.wikimedia.org/wikipedia/commons/a/a8/Gray_code_rotary_encoder_13-track_opened.jpg
 :label: codeur
+:width: 50%
 
 Codeur absolu : le signal prend une valeur entière différente selon l'angle du disque[^codeur].
 
 [^codeur]: [Mike1024](https://commons.wikimedia.org/wiki/File:Gray_code_rotary_encoder_13-track_opened.jpg),
 Public domain, via Wikimedia Commons
-:::
-
-Exemples de capteurs numériques
-::::
\ No newline at end of file
+:::
\ No newline at end of file
diff --git a/cours/SIN/03-can.md b/cours/SIN/03-can.md
index e5226a2..0f13680 100644
--- a/cours/SIN/03-can.md
+++ b/cours/SIN/03-can.md
@@ -36,9 +36,9 @@ On donne en @fig:exemple-can l'exemple d'un CAN de tension de référence 5 V fo
 
 La **caractéristique** du CAN est la courbe représentant la valeur numérique en sortie en fonction de la valeur analogique en entrée (@fig:carac-can).
 
-````{figure}
+::::{figure}
 :label: fig:exemple-can
-```{code-cell} python
+:::{code-cell} python
 :tags: [remove-input]
 import matplotlib.pyplot as plt
 from matplotlib import ticker
@@ -97,14 +97,14 @@ arr2 = ax2.annotate("", xy=(0.5, 0), xytext=(0.5, 1), arrowprops=dict(arrowstyle
 ax2.annotate("$q$", (1, 0.5), xycoords=arr2, ha="left", va="center")
 
 arr3 = ax2.annotate("", xy=(1, 0), xytext=(1, 8), arrowprops=dict(arrowstyle="<->"))
-ax2.annotate("$V_{pe}$", (1, 0.5), xycoords=arr3, ha="left", va="center")
-```
+ax2.annotate("$V_{pe}$", (1, 0.5), xycoords=arr3, ha="left", va="center");
+:::
 Signal analogique et signal numérisé.
-````
+::::
 
-````{figure}
+::::{figure}
 :label: fig:carac-can
-```{code-cell} python
+:::{code-cell} python
 :tags: [remove-input]
 import matplotlib.pyplot as plt
 from matplotlib import ticker
@@ -119,15 +119,12 @@ fig, ax = plt.subplots()
 ax.stairs(s_n, s_a, color="C1", lw=3, baseline=None)
 
 ax.set(
-  xlim=(0, 5),
-  ylim=(-1, N),
   yticks=s_n,
   xlabel="Signal analogique (V)",
   ylabel="Signal numérique",
 )
 ax.set_xticks(s_a, [f"{v:.3f}" for v in s_a], rotation=45, ha="right", rotation_mode="anchor")
-ax.set_aspect(5/8, 'box')
-
+ax.set_aspect(5/8, "datalim")
 arr4 = ax.annotate(
     "", xy=(s_a[0], 0), xytext=(s_a[1], 0), arrowprops=dict(arrowstyle="<->")
 )
@@ -136,7 +133,7 @@ ax.annotate("$q$", (0.5, 1), xycoords=arr4, ha="center", va="bottom")
 arr5 = ax.annotate(
     "", xy=(s_a[0], 1.5), xytext=(s_a[-1], 1.5), arrowprops=dict(arrowstyle="<->")
 )
-ax.annotate("$V_{pe}$", (0.5, 1), xycoords=arr5, ha="center", va="bottom")
-```
+ax.annotate("$V_{pe}$", (0.5, 1), xycoords=arr5, ha="center", va="bottom");
+:::
 Caractéristique du CAN.
-````
\ No newline at end of file
+::::
\ No newline at end of file
diff --git a/myst.yml b/myst.yml
index c1554bb..fb39f1d 100644
--- a/myst.yml
+++ b/myst.yml
@@ -21,10 +21,6 @@ project:
     - courstex
   numbering:
     headings: true
-  settings:
-    output_stderr: remove-error
-    output_stdout: remove
-    output_matplotlib_strings: remove
 site:
   template: book-theme
   options: