Gradle infrastructure to build LaTeX lectures

Nigel Stanger authored on 18 Mar 2022
01_lecture Added more example files 2 years ago
.gitignore Added more example files 2 years ago
README.md Added more stuff 2 years ago
build.gradle.kts Fixed typo 2 years ago
lecture.gradle.kts Initial files 2 years ago
lecturedates.tex Added example files 2 years ago
paper_init.tex Added example files 2 years ago
settings.gradle.kts Initial files 2 years ago
README.md

Gradle build infrastructure for lectures

Gradle infrastructure to build Information Science lectures based on Nigel’s LaTeX lecture classes.

Features:

  • multiple configurable document targets: slides, handout, notes, examples
  • dynamic targets for building PDF images from PlantUML, SVG, R
  • builds separate working preview and final published PDFs with lecture numbers (the latter include the lecture number in the file name)
  • uses XeLaTeX via latexmk

This repository serves as both the canonical source for the Gradle files and as an example of how to set things up.

Setting up a new set of lectures

  1. Create a top level lectures directory.
  2. If you’re using Git, copy .gitignore into lectures.
  3. Create a sub-directory for each lecture, e.g., 01_foo, 02_bar, …. The prefix numbering is important. Gradle uses it to figure out the lecture number.
  4. Copy build.gradle.kts and settings.gradle.kts into lectures.
  5. Create an empty settings.gradle.kts in 01_foo, 02_bar, etc.
  6. Copy lecture.gradle.kts into 01_foo, 02_bar, etc.
  7. Edit each lecture.gradle.kts to configure targets and images.
  8. Add the various content files as outlined below.

Typical lecture directory tree

The way Nigel does things 😁.

lectures
    01_foo/
        build.gradle.kts -> ../build.gradle.kts
        doc_init.tex
        images/
            ...
        lecture.gradle.kts
        lecture_content.tex
        lecture_handout.tex
        lecture_slides.tex
        lecturedates.tex -> ../lecturedates.tex
        paper_init.tex -> ../paper_init.tex
        pdfs/
            lecture_01_handout.pdf
            lecture_01_slides.pdf
        settings.gradle.kts
    02_bar/
        ...
    03_baz etc...
    .gitignore
    build.gradle.kts
    lecturedates.tex
    paper_init_tex
    settings.gradle.kts

Typical gradle tasks

As applicable depending on which document targets are enabled. This list is not comprehensive, see gradle tasks --all for a complete list.

Build tasks

  • docs - Build all documents. [preview]
  • examples - Build examples document. [preview]
  • examples.numbered - Build numbered version of examples document.
  • handout - Build handout document. [preview]
  • handout.numbered - Build numbered version of handout document.
  • images - Generate images.
  • notes - Build notes document. [preview]
  • notes.numbered - Build numbered version of notes document.
  • numbered - Create numbered versions of all documents.
  • slides - Build slides document. [preview]
  • slides.numbered - Build numbered version of slides document.

A dynamic task is created for each generated image, e.g.:

  • images.image1.pdf - Generate image1.pdf from image1.svg.

Housekeeping tasks

  • debug - Print debugging information.
  • clean - Clean up intermediate files.
  • deepClean - Remove all files not in Git. [`git clean -fXd`]