Put each sentence on its own line, improve some

This commit is contained in:
Midgard 2020-06-09 11:34:51 +02:00
parent dc7706105c
commit 1045870497
Signed by untrusted user who does not match committer: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -4,16 +4,17 @@ published: 2020-06-02
--- ---
Text-based slides are boring and not effective. While preparing a presentation for my intermediary Text-based slides are boring and not effective.
thesis' defence, I wanted to create something that would support my story better. I wanted to use While preparing a presentation for my intermediary thesis' defence, I wanted to create something that would support my story better.
graphics instead of words so the language centres of my dear audience's brains could focus on my I wanted to use graphics instead of words so the language centres of my dear audience's brains could focus on my speech rather than reading.
speech rather than reading. Rather than importing slide-sized graphics in a GUI, I thought Rather than importing slide-sized graphics in a GUI, I thought a makefile would be a nice way to do the trick.
a makefile would be a nice way to do the trick.
Makefiles these days are commonly used as a shell script with multiple entry points. You give it a Makefiles these days are commonly used as a shell script with multiple entry points.
filename, and it will build that file if its dependencies have been changed. Traditionally But it's more than that!
makefiles are used for C programs, but there's no reason you can't use them for any build you want. You give it a filename, and it will build that file if its dependencies have been changed.
Even this website is updated with a makefile! Want to join me and write one together? Traditionally makefiles are used for C programs, but there's no reason you can't use them for any build you want.
Even this website is built by a makefile!
Want to join me and write one together?
## Writing the makefile ## Writing the makefile
Putting the name of our output file in variables will make it easier to change it later. Putting the name of our output file in variables will make it easier to change it later.
@ -21,17 +22,19 @@ Putting the name of our output file in variables will make it easier to change i
OUTPUT = slides.pdf OUTPUT = slides.pdf
``` ```
We'll make a list of SVGs in the current directory, and convert it into a list of PDFs targets. We'll make a list of SVGs in the current directory, and convert it into a list of PDF targets.
Sorting is necessary to be able to place your slides like you want. The `$(:=)` construct is used Sorting is necessary to be able to place your slides in the order you want.
to go from `%.svg` to `build/%.pdf`. The `$(:=)` construct is used to go from `%.svg` to `build/%.pdf`.
```makefile ```makefile
SLIDES ::= $(sort $(wildcard *.svg)) SLIDES ::= $(sort $(wildcard *.svg))
SLIDES_PDF ::= $(SLIDES:%.svg=build/%.pdf) SLIDES_PDF ::= $(SLIDES:%.svg=build/%.pdf)
``` ```
I love this next rule. It teaches make that it should use Inkscape if it needs to create a PDF. I love this next rule.
It teaches make that it should use Inkscape if it needs to create a PDF.
`$@` refers to the target (`build/….pdf`), and `$<` refers to the first dependency (`….svg`). `$@` refers to the target (`build/….pdf`), and `$<` refers to the first dependency (`….svg`).
Inkscape's `-A filename` option exports to PDF without opening the GUI. Inkscape's `-A filename` option exports to PDF without opening the GUI.
**TODO: isn't there a way to automatically depend on all parent directories?** **TODO: isn't there a way to automatically depend on all parent directories?**
```makefile ```makefile
build/%.pdf: %.svg build build/%.pdf: %.svg build
@ -40,10 +43,10 @@ build/%.pdf: %.svg build
Now we tell make that the final output can be created from the individual slides. Now we tell make that the final output can be created from the individual slides.
Make will recursively make sure that all dependencies are up to date. Because we add the SVG source Make will recursively make sure that all dependencies are up to date.
file as a dependency, it will know that the individual PDF files have to be rebuilt if their source Because we add the SVG source file as a dependency, it will know that the individual PDF files have to be rebuilt if their source was changed.
was changed. And if any slide was changed, the end result will be updated too. But if there was no And if any slide was changed, the end result will be updated too.
change, it won't. Nothing is rebuilt unnecessarily! But if there was no change, it won't; nothing is rebuilt unnecessarily!
**TODO: DRY** **TODO: DRY**
**TODO: Do we need to fix sh's space disease here?** **TODO: Do we need to fix sh's space disease here?**
@ -52,15 +55,16 @@ $(OUTPUT): $(SLIDES_PDF)
pdfjoin $(SLIDES_PDF) -o "$@" pdfjoin $(SLIDES_PDF) -o "$@"
``` ```
If you look at the `build/%.pdf` rule, you see that it depends on `build`. With this simple, final If you look at the `build/%.pdf` rule, you see that it depends on `build`.
rule, make will know how to create this directory. With this simple, final rule, make will know how to create this directory.
```makefile ```makefile
build: build:
mkdir -p "$@" mkdir -p "$@"
``` ```
It is common to create a `clean` to clean up. Since `clean` is not a file, we have to mark the It is common to create a `clean` to clean up.
target as "phony". Since `clean` is not a file, we have to mark the target as "phony".
Failing to do so would result in **TODO how to finish this sentence?**
```makefile ```makefile
.PHONY: clean .PHONY: clean
@ -70,13 +74,14 @@ clean:
This concludes the Makefile portion of this post. This concludes the Makefile portion of this post.
**TODO: write about first rule being the default** **TODO: write about first rule being the default**
**TODO: split into 2 posts?** **TODO: split into 2 posts?**
## Creating and presenting slides
Create one SVG per slide, you can do that in Inkscape. Set the document size to something with the
desired aspect ratio. In my experience this is 16:9 for newer projectors and 4:3 for older models.
To use the resulting slide deck during your presentation, I can recommend ## Creating and presenting slides
[pdfpc](https://pdfpc.github.io/). But any old PDF viewer that has a fullscreen mode will work, of Create one SVG per slide, you can do that in Inkscape.
course. Set the document size to something with the desired aspect ratio.
In my experience this is 16:9 for newer projectors and 4:3 for older models.
To use the resulting slide deck during your presentation, I can recommend [pdfpc](https://pdfpc.github.io/).
But any old PDF viewer that has a fullscreen mode will work, of course.