Docs, labs
This commit is contained in:
		
							parent
							
								
									bb187cd223
								
							
						
					
					
						commit
						0831465257
					
				
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							| @ -1,3 +1,21 @@ | |||||||
| # Y-Sec Typst Template - Midterm/Exam | # Y-Sec Typst Templates | ||||||
| 
 | 
 | ||||||
| Check out [demo.typ](demo.typ) for details. | ## Installation | ||||||
|  | 
 | ||||||
|  | ### Typst | ||||||
|  | Avec cargo: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | cargo install typst-cli | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Y-Sec Templates | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | git clone <https://url.of/repo.git> ~/.local/share/typst/packages/y-sec | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ## Templates: | ||||||
|  | 
 | ||||||
|  |   - [Test écrit](exam) ([exemple](exam/demo.typ), [pdf](exam/demo.pdf)) | ||||||
|  |   - [Laboratoire](lab) | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								exam/demo.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								exam/demo.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										26
									
								
								lab/demo.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								lab/demo.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | #import "lab.typ" : laboratoire, question, operation | ||||||
|  | #show: doc => laboratoire( | ||||||
|  |   title: "Some random lab", | ||||||
|  |   course: "XYZ", | ||||||
|  |   doc | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | = Section | ||||||
|  | 
 | ||||||
|  | #operation[Commencez ici] | ||||||
|  | 
 | ||||||
|  | bla bla | ||||||
|  | 
 | ||||||
|  | == Sous-section | ||||||
|  | 
 | ||||||
|  | bli bli | ||||||
|  | 
 | ||||||
|  | #operation[ Une manipulation à effectuer ] | ||||||
|  | 
 | ||||||
|  | #question[ Quelle est la réponse ? ][asd] | ||||||
|  | 
 | ||||||
|  | = Autre sous-section | ||||||
|  | 
 | ||||||
|  | blu blu | ||||||
|  | 
 | ||||||
|  | #question[xxxx][yyyyyy] | ||||||
							
								
								
									
										77
									
								
								lab/lib.typ
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								lab/lib.typ
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,77 @@ | |||||||
|  | 
 | ||||||
|  | #show heading: h => {  | ||||||
|  |   let fresh = counter(heading).get();  | ||||||
|  |   counter("manipulation").update(fresh) | ||||||
|  |   counter("question").update(fresh) | ||||||
|  |   h | ||||||
|  |  } | ||||||
|  | 
 | ||||||
|  | #let context_step(key) = context { | ||||||
|  |   let lvl = query(selector(heading).before(here())).at(-1).level+1; | ||||||
|  |   counter(key).step(level: lvl) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #let laboratoire(course: "Course Name", title: "Course title", doc) = { | ||||||
|  |   set page( | ||||||
|  |     header: [#course - Labo X - #title], | ||||||
|  |     footer: [], | ||||||
|  |     numbering: "1 / 1" | ||||||
|  |   ); | ||||||
|  |   doc | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #set heading(numbering: "1.1") | ||||||
|  | 
 | ||||||
|  | #let pretty_block(color, title, x) = {  | ||||||
|  | 
 | ||||||
|  |   let edge = color; | ||||||
|  | 
 | ||||||
|  |   block(radius: (top: 3pt),  | ||||||
|  |         inset: 4pt,  | ||||||
|  |         stroke: 1pt + edge,  | ||||||
|  |         fill: color.lighten(50%), | ||||||
|  |         width: 100%, | ||||||
|  |         below: 0pt, | ||||||
|  |         text(weight: "bold", title)) | ||||||
|  |          | ||||||
|  |   block(radius: (bottom: 3pt),  | ||||||
|  |         inset: 7pt, | ||||||
|  |         stroke: 1pt + edge, | ||||||
|  |         fill: color.lighten(80%), | ||||||
|  |         width: 100%, | ||||||
|  |         x) | ||||||
|  |    | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #let operation(x) = {  | ||||||
|  |   context_step("manipulation") | ||||||
|  |   pretty_block(rgb("#9f82ff"), "Manipulation " + context counter("manipulation").display(), x) | ||||||
|  | } | ||||||
|  | #let question(q,a) = { | ||||||
|  |   context_step("question") | ||||||
|  |   pretty_block(green, "Question " + context counter("question").display("1.1"), q) | ||||||
|  |   pretty_block(red, "Réponse " + context counter("question").display("1.1"), a) | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #show: laboratoire | ||||||
|  | 
 | ||||||
|  | = Section | ||||||
|  | 
 | ||||||
|  | #operation[Commencez ici] | ||||||
|  | 
 | ||||||
|  | bla bla | ||||||
|  | 
 | ||||||
|  | == Sous-section | ||||||
|  | 
 | ||||||
|  | bli bli | ||||||
|  | 
 | ||||||
|  | #operation[ Une manipulation à effectuer ] | ||||||
|  | 
 | ||||||
|  | #question[ Quelle est la réponse ? ][asd] | ||||||
|  | 
 | ||||||
|  | = Autre sous-section | ||||||
|  | 
 | ||||||
|  | blu blu | ||||||
|  | 
 | ||||||
|  | #question[xxxx][yyyyyy] | ||||||
							
								
								
									
										7
									
								
								lab/typst.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								lab/typst.toml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | [package] | ||||||
|  | name = "lab" | ||||||
|  | version = "0.1.0" | ||||||
|  | entrypoint = "lib.typ" | ||||||
|  | authors = ["Maxime Augier <max@xolus.net>"] | ||||||
|  | license = "MIT" | ||||||
|  | description = "Enoncé de laboratoire" | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user