Doom in LaTeX (+Bash)
This article is a part of my full LaTeX guide here article Here some captions of the game: How did i create the game ? First, the architecture. We have a bash loop script ( loop.sh) that waits for inputs. When it receives input, it updates a state.tex variables. This file is in fact an \input{...} of the main LaTeX file main.tex. We won't focus on the bash file, but here is its code: Copy #!/bin/bash # --- INPUT SETUP --- exec 3</dev/tty stty -icanon -echo trap "stty sane" EXIT # --- STATE --- step=0 scaleval=0.5 shoot=0 demon=0 gameover=0 lst="0,1,2" score=0 # --- SCALE PER STEP --- update_scale() { case $step in 0) scaleval=0.5 ;; 1) scaleval=0.9 ;; 2) scaleval=1.4 ;; esac } # --- DEMON SPAWN --- spawn_demon() {…
latexTraversing a Tree in pure LaTeX
This article is a part of my full LaTeX guide here article At the end of the article, you'll be able to traverse a tree in pure TeX. First, remember the basics. Copy \def\a{Rémi} \def\b{Julien} Then, use it as: Copy Bonjour \a\ et \b. Bonjour \a{} et \b. Each one outputs the same result. "Bonjour Rémi et Julien." And yess, that is strange that we can call the variable like a comand with empty {}. Speaking of commands, they are in fact, like said before, fancy variables with fancy logic. Copy \newcommand{\hello}[3]{Hello #1, #2 et #3} Used like: Copy \hello{Rémi}{Julien}{Lucas} Output: "Hello Rémi, Julien et Lucas" This stays pure expansions... Now most confusing part of LaTeX. How to reassign a value to a variable ? Maybe, you think this is…
latexDissecting LaTeX: Revenge, Four Years Later
When I was a chemist, I wrote my internship report in LaTeX. It was at first a pain in the ass: --> weird syntax with no apparent coherence Especially for drawing objects, graphs, shapes... (cf: PGFPlot, TikZ) Then I moved on and never returned to LaTeX because I did not need it. But I remember the painful hours spent trying to render a good TikZ graphic, and I do not want those hours to be wasted. So 4 years later I returned to LaTeX to learn it, for real. I wanted to build a really coherent mental model by learning all its invariants. And I can say it has been a great success, I even built a mini Doom in LaTeX --> Go to section This is not only an…