From f4cabbf11a4e6588f2de296422a82d3eded177a3 Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Thu, 27 Feb 2025 18:38:15 +0100
Subject: [PATCH 1/7] Update myst.yml to modify output settings for error
 handling and Matplotlib string removal

---
 myst.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/myst.yml b/myst.yml
index dbca803..0a2d0db 100644
--- a/myst.yml
+++ b/myst.yml
@@ -19,6 +19,10 @@ project:
   exclude: README.md
   numbering:
     headings: true
+  settings:
+    output_stderr: remove-error
+    output_stdout: remove
+    output_matplotlib_strings: remove
 site:
   template: book-theme
   options:

From 0240949bc6cf8467cc2ae8b5b31b85c7a05c99fa Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Fri, 28 Feb 2025 11:34:46 +0100
Subject: [PATCH 2/7] Update README.md to fix Forgejo Actions badge link

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index cda87c9..68aaebf 100644
--- a/README.md
+++ b/README.md
@@ -3,4 +3,4 @@
 <https://cours.edgarpierre.fr>
 
 [![Made with MyST](https://img.shields.io/badge/made%20with-myst-orange)](https://myst.tools)
-[![Forgejo Actions](https://img.shields.io/badge/serve.yaml-success-brightgreen)](https://git.edgarpierre.fr/edpibu/cours4.0/actions?workflow=serve.yaml)
\ No newline at end of file
+[![Forgejo Actions](https://git.edgarpierre.fr/edpibu/cours4.0/badges/workflows/serve.yaml/badge.svg)](https://git.edgarpierre.fr/edpibu/cours4.0/actions?workflow=serve.yaml)
\ No newline at end of file

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 3/7] 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 4/7] 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:

From 976e5db7ed2e90ffbbd8917270e653de1e4c0b76 Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Fri, 28 Feb 2025 13:21:14 +0100
Subject: [PATCH 5/7] Enable submodule checkout in Forgejo workflow
 configuration

---
 .forgejo/workflows/serve.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml
index d374f5b..288d8c8 100644
--- a/.forgejo/workflows/serve.yaml
+++ b/.forgejo/workflows/serve.yaml
@@ -8,6 +8,8 @@ jobs:
     steps:
       - name: Checkout repository
         uses: actions/checkout@v4
+        with:
+          submodules: "true"
       - name: Initialize virtual environment
         run: /usr/bin/python -m venv .venv
       - name: Install dependencies

From 9e02248a5a4e0ae844a14873eb4d3ec70e1a0160 Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Fri, 28 Feb 2025 13:29:43 +0100
Subject: [PATCH 6/7] Add execution step to Forgejo workflow for MyST build

---
 .forgejo/workflows/serve.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml
index 288d8c8..0f39f6f 100644
--- a/.forgejo/workflows/serve.yaml
+++ b/.forgejo/workflows/serve.yaml
@@ -14,6 +14,10 @@ jobs:
         run: /usr/bin/python -m venv .venv
       - name: Install dependencies
         run: ./.venv/bin/pip install -r requirements.txt
+      - name: Execute code
+        run: |
+          . .venv/bin/activate
+          myst build --execute
       - name: Build PDF exports
         run: |
           . .venv/bin/activate

From ce388b112663484d5a84678caed92d73935f01e2 Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Thu, 6 Mar 2025 09:45:18 +0100
Subject: [PATCH 7/7] Add course material on numeral systems with definitions
 and conversion methods

---
 cours/SIN/04-numeration.md | 111 +++++++++++++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 cours/SIN/04-numeration.md

diff --git a/cours/SIN/04-numeration.md b/cours/SIN/04-numeration.md
new file mode 100644
index 0000000..45672de
--- /dev/null
+++ b/cours/SIN/04-numeration.md
@@ -0,0 +1,111 @@
+---
+title: Systèmes de numération
+subject: Cours
+export:
+  - format: pdf
+    template: courstex
+---
+
+# Définition
+
+:::{prf:definition} Système de numération
+:nonumber: true
+Un système de numération est un ensemble de règles qui régissent une, voire plusieurs numérations données. De façon plus explicite, c'est un ensemble de règles d'utilisation des signes, des mots ou des gestes permettant d'écrire, d'énoncer ou de mimer les nombres.
+
+Source : Article _[Système de numération](https://fr.wikipedia.org/wiki/Syst%C3%A8me_de_num%C3%A9ration)_ de [Wikipédia en français](https://fr.wikipedia.org/) ([auteurs](https://fr.wikipedia.org/w/index.php?title=Syst%C3%A8me_de_num%C3%A9ration&action=history))
+:::
+
+# Systèmes de numération usuels
+
+## Le système décimal (base 10)
+
+Le système décimal est celui que l'on utilise au quotidien, qui utilise 10 symboles (0 à 9). La valeur des nombres s'obtient ainsi (@tab:num-10) :
+
+:::{math}
+1789=1 \times 10^3 + 7 \times 10^2 + 8 \times 10^1 + 9 \times 10^0
+:::
+
+:::{csv-table} Système décimal
+:label: tab:num-10
+10³,10²,10¹,10⁰
+1000, 100, 10, 1
+1,7,8,9
+:::
+
+## Le système binaire (base 2)
+
+Le système binaire est celui utilisé par systèmes électroniques. Il utilise 2 symboles (0 et 1). Chaque chiffre est appelé un bit. Un nombre à 8 bits est appelé octet (ou byte en anglais). La valeur des nombres s'obtient ainsi (@tab:num-2) :
+
+:::{math}
+1011_2=1 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 1 \times 2^0
+:::
+
+:::{csv-table} Système binaire
+:label: tab:num-2
+2³,2²,2¹,2⁰
+8, 4, 2,1
+1,0,1,1
+:::
+
+### Conversion binaire vers décimal
+
+Pour convertir un nombre binaire en nombre décimal, utiliser la méthode ci-dessus : chaque bit, lui associer sa valeur, puis faire la somme des bits à 1.
+
+::::{hint} Exemple : Convertir $1101_2$ en décimal.
+
+- On associe à chaque bit sa valeur :
+:::{math}
+\begin{matrix}
+2³ & 2² & 2¹ & 2⁰ \\
+1 & 1 & 0 & 1
+\end{matrix}
+:::
+- On additione la valeur des bits à 1 :
+:::{math}
+N = 8+4+1 = 13_{10}
+:::
+::::
+
+### Conversion décimal vers binaire
+
+La méthode infaillible pour convertir un nombre décimal en nombre binaire est de poser la division par 2, puis réitérer avec le quotient obtenu jusqu'à obtenir 0, puis lire le reste des divisions en sens inverse.
+
+::::{hint} Exemple : Convertir $25_{10}$ en binaire.
+
+- On pose la division :
+    - $25\div 2=12\text{, reste }1$
+    - $12\div 2=6\text{, reste }0$
+    - $6\div 2=3\text{, reste }0$
+    - $3\div 2=1\text{, reste }1$
+    - $1\div 2=0\text{, reste }1$
+- On lit le reste des divisions dans l'ordre inverse : $25_{10}=11001_{2}$.
+::::
+
+## Le système hexadécimal (base 16)
+
+Le système hexadécimal est souvent utiliser pour retranscrire des nombres binaires car la conversion entre les deux systèmes est simple. Il utilise 16 symboles (0 à 9 puis A à F ; A=10, B=11, C=12, D=13, E=14 et F=15). La valeur des chiffres s'obtient ainsi (@tab:num-16) :
+
+:::{math}
+6FD_{16}=6\times 16²+15\times 16¹+13\times 16⁰
+:::
+
+:::{csv-table} Système hexadécimal
+:label: tab:num-16
+16²,16¹,16⁰
+256,16,1
+6,F,D
+:::
+
+### Conversion entre binaire et hexadécimal
+
+Pour convertir un nombre binaire en hexadécimal, on peut regrouper les bits en paquets de 4, puis convertir chaque groupe de 4 bits en un chiffre hexadécimal.
+
+:::{hint} Exemple : Convertir $0110\,1111\,1101_2$ en hexadécimal.
+
+- On groupe en paquets de 4 bits : $0110_2$, $1111_2$, $1101_2$.
+- On convertit chaque paquet en un chiffre hexadécimal :
+    - $0110_2=6_{10}=6_{16}$
+    - $1111_2=15_{10}=F_{16}$
+    - $1101_2=13_{10}=D_{16}$
+- On obtient donc : $0110\,1111\,1101_2=6FD_{16}$.
+:::
\ No newline at end of file