Document by J. Ferrier, 28 03 2023, Toulon
Licence : Creative Commons C C BY 4.0
rév. 30.03.2023
Typst, une alternative moderne à LaTeX, est désormais disponible en open source.
Il existe sous forme de fichier binaire à télécharger, et à exécuter en ligne de commande.
Si vous préférez une expérience intégrée de type IDE avec autocomplétion et prévisualisation instantanée, vous pouvez également consulter l’application web de Typst, qui est actuellement en version bêta publique : https://typst.app/
exemple de fichier destination
Typst est un nouveau système de composition basé sur le balisage, conçu pour être aussi puissant que LaTeX, tout en étant beaucoup plus facile à apprendre et à utiliser.
Typst possède :
Un balisage intégré pour les tâches de formatage les plus courantes
Des fonctions flexibles pour tout le reste
Un système de script étroitement intégré
Composition mathématique, notes en bas de pages, gestion des bibliographies, etc.
Tables des Matières, des illustrations, des mots-clés : (fonction outline)
Des temps de compilation rapides, grâce à la compilation incrémentale
Des messages d’erreur conviviaux en cas de problème.
Voir un exemple de fichier source, et de fichier bibliographique, à la fin du document : Annexe 1
——–————————————————————————————–
Binaires exécutables à télécharger : https://github.com/typst/typst/releases
documentation : https://github.com/typst/typst/tree/main/docs
documentation + détaillée : https://typst.app/docs/ https://typst.app/docs/reference/
exemples et modèles : https://github.com/qjcg/awesome-typst
——–—————————————————————————————
Installation :
Le programme binaire est fourni dans le site github.com/typst Il fonctionne en ligne de commande (terminal, console).
Il est portable : on ne l’installe pas vraiment, on le copie dans un dossier quelconque.
Télécharger régulièrement la dernière version, pour laquelle la documentation s’actualise souvent : le projet est récent.
Utilisation :
créer un dossier spécial ;
y coller le programme typst (sous windows : typst.exe) ;
y coller un fichier source au format texte seul, d’extension .typ , par ex : f1.typ ;
y coller éventuellement des images, un fichier de biblio ;
compiler le fichier source, en tapant dans la console par ex : ./typst c f1.typ
( pour windows : .\typst c f1.typ )
. on obtient un nouveau fichier, par ex : f1.pdf
Pour les utilisateurs de windows n’ayant pas l’habitude de la ligne de commande en console, voir la fin du document : des explications à ce sujet. Voir Annexe 2
Le fichier source .typ et le fichier biblio .yml sont des fichiers au format texte pur : donc employer plutôt un éditeur de textes, comme Gedit sous linux, ou notepad++ sous windows.
La syntaxe peut causer beaucoup d’erreurs : en particulier concernant les parenthèses diverses, qu’il faut fermer dans un ordre précis. Pour les fichiers .yml, les tabulations (indentations) sont importantes (comme en Python). Un éditeur texte performant est donc très utile, pour bien visualiser ces problèmes.
——–————————————————————————————–
( typst testé et fonctionne sous win 8.0 (et Wine) , ubuntu 22 04 )
typst ne fonctionne pas sur ubuntu 20 04 erreur signalée : GLIBC_2.32’ not found
Avec synaptic, on voit sous ubuntu 20 04 : libc6 : v 2.31 )
——–—————————————————————————————
Annexe 1 : Exemple : un fichier source : f1.typ
Il aura besoin, dans le même dossier, de :
bib1.yml (voir + bas) ; boulon01.jpg (une image ordinaire) ; boulon001.jpg (une image + petite)
On le compilera, en ligne de commande, avec le programme typst dans le même dossier ./typst c f1.typ
( pour windows : .\typst c f1.typ
// ===================================
/* example : source to typst v eng 10
J. Ferrier,
28 03 2023, Toulon
Licence : Creative Commons C C BY 4.0
*/
// function windec : a keyword, for index
#let windec(word1) = {
box(
figure( // fake figure
circle(radius: 0pt, stroke: white), // invisible cercle
caption: word1,
kind: "indec",
supplement: [],
numbering: none,
)
)
}
// common CONFIG : #set
#set page(
paper: "a4",
margin: (x: 1.0cm, y: 1.0cm),
//numbering: "1 / 1"
numbering: "1"
)
// display numbers of pages :
#counter(page).update(1)
#set text(
font: "New Computer Modern",
size: 11pt
)
// style of numbering of headers :
#set heading(numbering: "1. 1.")
// style of numbering of enum : lists with numbers :
#set enum(numbering: "1 )")
// BODY TEXT :
#align(center)[
// header level 1 :
= Fibonacci sequence
]
The Fibonacci sequence is defined through the _recurrance relation_ : $F_n = F_(n-1) + F_(n-2)$
*separate formula* :
$ A_i = 1 / sqrt(-i) +
(1 + sqrt(3)) / 2 $
// paragraph break :
\
// sub header : level 2
== Définitions.
- The climate
- Temperature
- Precipitation
- The topography
- The geology
#line(length: 50%, stroke: 4pt + blue)
// tilted line :
#line(end: (20%, 5%))
// numerotation :
+ The climate
+ Temperature
+ Precipitation
+ The topography
+ The geology
// other sub header : level 2
== Illustrations.
#align(center)[
#image("boulon01.jpg", width: 40%)
_Very graceful bolt: part of the system MechaTix._
]
\ // : line break
// example of keyword, to index
Here is, in a paragraph, the word _
#windec("wasabi")
_, which is a keyword, and the paragraph continues ...
\
// foot notes :
Here is an ordinary text, but with a footnote : [1] .
The text continues. And here is a second [2] _footnote_ .
\
// foot notes : bottom :
#set text(size: 11pt)
#align(bottom)[
*Notes ...*
\
[1] _Foot Note 1_ Here We are ! Lorem ipsum dolor sit amet, consectetur adipiscing elit.
[2] And _Foot Note 2_ . Lorem ipsum dolor sit amet, consectetur adipiscing elit. That's all, Folks !
\
] // end align bottom
// end of page :
#pagebreak()
== Columns :
#box(height: 48pt,
columns(2, gutter: 30pt)[
#set par(justify: true)
This research was funded by the
National Academy of Sciences.
NAoS provided support for field
tests and interviews.
// end of column :
#colbreak()
In recent years, deep learning has
increasingly been used to solve a
variety of problems, with a
grant of up to USD 40.000 for a
period of 6 months.
]
)
\
// table :
#table(
columns: (20%, auto, auto),
inset: 10pt,
align: horizon,
[], [*Area*], [*Parameters*],
image("boulon001.jpg"),
$ pi h (D^2 - d^2) / 4 $,
[
$h$: height \
$D$: outer radius \
$d$: inner radius
],
image("boulon001.jpg"),
$ sqrt(2) / 12 a^3 $,
[$a$: edge length]
)
\
// example of keyword, to index
Here is, in a paragraph, the word _
#windec("zardoz")
_, which is an other keyword, and the paragraph continues !
\
// rectangles :
#align(center)[
// Without content.
#rect(width: 35%, height: 30pt, stroke: 3pt + red)
// With content ; green ink
#rect(stroke: 2pt + green)[
Rect automat. sized \
to fit the content.
] // end rect
] // end align
// other header, level 1 :
// blue ink :
#set text(blue)
= Citations to Biblio :
// black ink :
#set text(black)
We think about that book : @harry93.
Here is another book : @donne82
// E N D of body text :
#set text(size: 14pt)
#align(center)[
#rect(stroke: 2pt + blue)[
*--- E N D ---*
] // end rect
] // end center
// break page :
#pagebreak()
// table of contents :
#outline(
title: [Table of contents],
)
\
// index :
// table figures : special : indec
#outline(
title: [List of keywords],
target: figure.where(kind: "indec"),
)
\
// BIBLIO :
// biblio : format .yml :
#bibliography("bib1.yml")
// biblio : another possible format : for latex : .bib :
//#bibliography("bibtx.bib")
// END of file
Autre exemple : un fichier bibliographique : bib1.yml (appelé par le fichier précédent)
// ========================
---
# essai : bibliography for typst
# J. Ferrier, 28 03 2023, Toulon ; Licence : Creative Commons C C BY 4.0
# like python : dictionnairy of dictionnairies
#
harry93 :
type: Book
author: Abbot Anna
title: Goal is fun !
date: 1972
location: 6 rue Irule
editor: Aaba
volume: 1
url: https://github.com/typst/typstc/issues/3
donne82 :
type: Book
author: Bozot Bea
title: Arriere Gauche
date: 1971
location: 7 ch Epars
editor: ["Stringer, Gary A.", "Pebworth, Ted-Larry"]
volume: 6
camus20 :
type: Book
author: Camus Chris
title: Arriere Droit
date: 2020-06-26
location: 8 av Miellies
decker21 :
type: Book
author: Decker Diana
title: Arriere central
date: 2021-06-21
location: 9 rue Volpaies
...
# END of file
Annexe 2 : explications sur la console Windows.
Il faut ouvrir une console, puis y taper des commandes “en lignes de commandes”.
Pour ouvrir une console dans un dossier spécifique :
aller dans le dossier, par l’explorateur de fichiers ;
menu : Fichier ; Ouvrir Invite Commande ; Ouvrir Invite Commande
image : ouvrir console
taper la commande dans la console : .\typst c f1.typ
image : ecrire dans la console
L’éditeur NotePad ++ est utile pour repérer les parenthèses, et indentations :
image : notepad ++