diff --git a/config.toml b/config.toml index 20fb8886218559a6f86238c191411c105d9efba2..36ee7cd1886f02859b7bf3f254287e19fab4cf38 100644 --- a/config.toml +++ b/config.toml @@ -56,8 +56,8 @@ pygmentCodeFences = true [[menu.main]] - name = "Blog" - url = "" + name = "Articles" + url = "post/" weight = 1 [[menu.main]] @@ -79,13 +79,13 @@ pygmentCodeFences = true [[menu.main]] parent = "samples" name = "Mathématiques" - url = "post/2017-03-05-math-sample" + url = "post/maths" weight = 2 [[menu.main]] parent = "samples" name = "Programmation" - url = "post/2016-03-08-code-sample" + url = "post/code-source" weight = 3 [[menu.main]] diff --git a/content/post/2016-03-08-code-sample.md b/content/post/2016-03-08-code-sample.md deleted file mode 100644 index af4514aa472c2f85fa68bf40edbb0d46009e7dfa..0000000000000000000000000000000000000000 --- a/content/post/2016-03-08-code-sample.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Code Sample -subtitle: Using Hugo or Pygments -date: 2016-03-08 -tags: ["example", "code"] ---- - -The following are two code samples using syntax highlighting. - -<!--more--> - -The following is a code sample using triple backticks ( ``` ) code fencing provided in Hugo. This is client side highlighting and does not require any special installation. - -```javascript - var num1, num2, sum - num1 = prompt("Enter first number") - num2 = prompt("Enter second number") - sum = parseInt(num1) + parseInt(num2) // "+" means "add" - alert("Sum = " + sum) // "+" means combine into a string -``` - - -The following is a code sample using the "highlight" shortcode provided in Hugo. This is server side highlighting and requires Python and Pygments to be installed. - -{{< highlight javascript >}} - var num1, num2, sum - num1 = prompt("Enter first number") - num2 = prompt("Enter second number") - sum = parseInt(num1) + parseInt(num2) // "+" means "add" - alert("Sum = " + sum) // "+" means combine into a string -{{</ highlight >}} - - -And here is the same code with line numbers: - -{{< highlight javascript "linenos=inline">}} - var num1, num2, sum - num1 = prompt("Enter first number") - num2 = prompt("Enter second number") - sum = parseInt(num1) + parseInt(num2) // "+" means "add" - alert("Sum = " + sum) // "+" means combine into a string -{{</ highlight >}} diff --git a/content/post/2017-03-05-math-sample.md b/content/post/2017-03-05-math-sample.md deleted file mode 100644 index 31080210e36f7e55465a1be2838a7d84456a04cf..0000000000000000000000000000000000000000 --- a/content/post/2017-03-05-math-sample.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: Math Sample -subtitle: Using KaTeX -date: 2017-03-05 -tags: ["example", "math"] ---- - -KaTeX can be used to generate complex math formulas. It supports in-line math using the `\\( ... \\)` delimiters, like this: \\( E = mc^2 \\). By default, it does *not* support in-line delimiters `$...$` because those occur too commonly in typical webpages. It supports displayed math using the `$$` or `\\[...\\]` delimiters, like this: - -Formula 1: -$$ -\phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots -$$ - -Formula 2: (same formula, different delimiter) -\\[ -\phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots -\\] - -Additional details can be found on [GitHub](https://github.com/Khan/KaTeX) or on the [Wiki](http://tiddlywiki.com/plugins/tiddlywiki/katex/). -<!--more--> - -### Example 1 - -If the text between $$ contains newlines it will rendered in display mode: -``` -$$ -f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi -$$ -``` -$$ -f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi -$$ - - -### Example 2 -``` -$$ -\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } } -$$ -``` -$$ -\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } } -$$ - - -### Example 3 -``` -$$ -1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1. -$$ -``` -$$ -1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1. -$$ - -### Example 4 - -Remember, certain characters are rendered by markdown, so you may need to workaround those issues. You can find the complete list of KaTeX supported functions here: [https://khan.github.io/KaTeX/docs/supported.html](https://khan.github.io/KaTeX/docs/supported.html) - -For example, the `'` character can be replaced with `^\prime`: - -$$ -G^\prime = G - u -$$ - -The `"` character can be replaced with `^{\prime\prime}`: - -$$ -G^{\prime\prime} = G^\prime - v -$$ diff --git a/content/post/code-source.md b/content/post/code-source.md new file mode 100644 index 0000000000000000000000000000000000000000..bffa0d02d3ccf7df692f8a6cad73f15767e51dfd --- /dev/null +++ b/content/post/code-source.md @@ -0,0 +1,46 @@ +--- +title: Citer du code machine +subtitle: En utilisant Hugo ou Pygments +date: 2021-03-08 +tags: ["exemple", "code"] +--- + +Vous pouvez aussi citer du code machine, par exemple du [Python](https://fr.wikipedia.org/wiki/Python_(langage)) ou du [R](https://fr.wikipedia.org/wiki/R_(langage)). + +Ci-dessous, un extrait de code en langage R, cité en le délimitant avec ` ``` `. + +```r +mafonction <- function(arg1, arg2) { + # ... ici un peu de code ... + return(object) +} + +sommedescarres <- function(x) { + return(sum(x^2)) # Renvoie la somme des carrés des éléments de x +} +``` + +Ci-dessous, le même code, cité en utilisant le shortcode `highlight`. + +{{< highlight r >}} +mafonction <- function(arg1, arg2) { + # ... ici un peu de code ... + return(object) +} + +sommedescarres <- function(x) { + return(sum(x^2)) # Renvoie la somme des carrés des éléments de x +} +{{</ highlight >}} + + +Ci-dessous, la même chose avec des numéros de ligne, et en langage Python : + +{{< highlight python "linenos=inline">}} + def mafonction(arg1, arg2): + # ... ici un peu de code ... + return o + + def sommedescarres(x): + return sum(x^2) # Renvoie la somme des carrés des éléments de x +{{</ highlight >}} diff --git a/content/post/maths.md b/content/post/maths.md new file mode 100644 index 0000000000000000000000000000000000000000..e948c86dfd1dccc00182f352b26152169d3a374a --- /dev/null +++ b/content/post/maths.md @@ -0,0 +1,77 @@ +--- +title: Citer des formules mathématiques +subtitle: En utilisant KaTeX +date: 2021-03-05 +tags: ["exemple", "math"] +--- + +Des formules mathématiques complexes peuvent être affichées en utilisant le module KaTeX. +Vous pouvez insérer une formule directement dans le texte, en utilisant la syntaxe `\\( ... \\)`, comme ceci : \\( E = mc^2 \\). +Vous pouvez afficher des formules plus volumineuses en les encadrant de `$$` ou de `\\[...\\]`, comme ceci : + +Première méthode : +$$ +\phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots +$$ + +Seconde méthode : (même formule, syntaxe différente) +\\[ +\phi = \frac{(1+\sqrt{5})}{2} = 1.6180339887\cdots +\\] + +Pour en savoir plus, consultez [ce wiki](http://tiddlywiki.com/plugins/tiddlywiki/katex/), ou directement [le dépôt de KaTeX](https://github.com/Khan/KaTeX). + + +### Exemple 1 + +``` +$$ +f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi +$$ +``` +$$ +f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi +$$ + + +### Exemple 2 + +``` +$$ +\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } } +$$ +``` +$$ +\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } } +$$ + + +### Exemple 3 + +``` +$$ +1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1. +$$ +``` +$$ +1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1. +$$ + + +### Exemple 4 + +[Rappelez-vous]({{< ref "syntaxe-markdown.md" >}} "Article sur la syntaxe Markdown") que certains caractères ont une signification bien précise en Markdown. +En conséquence, il est nécessaire d'utiliser des alternatives. +Vous pouvez utilisr la syntaxe complète de KaTeX [sur cette page](https://khan.github.io/KaTeX/docs/supported.html). + +Par exemple, le caractère `'` peut être remplacé par `^\prime`: + +$$ +G^\prime = G - u +$$ + +Le caractère `"` peut être remplacé par `^{\prime\prime}`: + +$$ +G^{\prime\prime} = G^\prime - v +$$ diff --git a/content/post/syntaxe-markdown.md b/content/post/syntaxe-markdown.md index 8ef8cbf538ee06a599272efc11755380ff3f514e..6d668ad7e97e7857c3aafc95bc52735fa7857f4a 100644 --- a/content/post/syntaxe-markdown.md +++ b/content/post/syntaxe-markdown.md @@ -1,35 +1,28 @@ --- -title: Test markdown -subtitle: Each post also has a subtitle -date: 2015-02-20 -tags: ["example", "markdown"] +title: Langage Markdown +subtitle: Introduction à la syntaxe +date: 2021-02-20 +tags: ["exemple", "markdown"] --- -You can write regular [markdown](http://markdowntutorial.com/) here and Jekyll will automatically convert it to a nice webpage. I strongly encourage you to [take 5 minutes to learn how to write in markdown](http://markdowntutorial.com/) - it'll teach you how to transform regular text into bold/italics/headings/tables/etc. +Vous pouvez écrire directement du [Markdown](https://fr.wikipedia.org/wiki/Markdown), et il sera automatiquement converti en une page web. N'hésitez pas à [prendre 5 minutes pour apprendre la syntaxe du langage Markdown](http://markdowntutorial.com/fr/) ; cela vous apprendra comment mettre du texte *en italiques* ou **en gras**, comment définir des titres de différents niveaux, comment construire des tables, et ainsi de suite. -**Here is some bold text** +**Ceci est du texte en gras** -## Here is a secondary heading +## Voilà un titre secondaire -Here's a useless table: - -| Number | Next number | Previous number | -| :------ |:--- | :--- | -| Five | Six | Four | -| Ten | Eleven | Nine | -| Seven | Eight | Six | -| Two | Three | One | - +Que diriez vous d'une délicieuse crêpe ? -How about a yummy crepe? +<!-- ceci est un commentaire, pour préciser que c'est trop bon les crêpes ! -->  -Here's a code chunk with syntax highlighting: +Et pourquoi pas une table pour manger autour ? + +| Colonne | Autre colonne | Et une autre | +| :------ |:------------- | :----------- | +| Cinq | Six | Quatre | +| Dix | ʕᵔᴥᵔʔ | Neuf | +| Sept | Huit | ◖(。◕‿◕。)◗ ♪♫ | +| Deux | Trois | Deux mille vingt deux | -```javascript -var foo = function(x) { - return(x + 5); -} -foo(3) -```