Gradle infrastructure to build LaTeX lectures

Nigel Stanger authored on 20 Nov 2022
01_lecture Reimplemented plugin in Java (closes #1) 1 year ago
buildSrc Reimplemented plugin in Java (closes #1) 1 year ago
.gitignore Added more example files 2 years ago
README.md Added plugin update instructions 1 year ago
build.gradle Reimplemented plugin in Java (closes #1) 1 year ago
lecturedates.tex Added example files 2 years ago
paper_init.tex Added example files 2 years ago
settings.gradle Reimplemented plugin in Java (closes #1) 1 year 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. Clone this repo somewhere.
  2. Create a top level lectures directory.
  3. If you’re using Git, copy .gitignore into lectures.
  4. Copy build.gradle, settings.gradle, and buildSrc into lectures.
  5. Copy 01_lecture to lectures and rename it to something that makes sense. The prefix numbering is important. Gradle uses it to figure out the lecture number (but you can override this manually per lecture). You can duplicate and rename this folder for each new lecture you need (e.g., 01_foo, 02_bar, …).
  6. Edit lectures/settings.gradle and make sure there is an include line for each individual lecture. Remember to update if you change things later, otherwise things will probably not build.
  7. Edit each lecture’s build.gradle to configure targets and images. The individual lecture folders must not have a settings.gradle file, it will break things.
  8. Add the various content files as outlined below.

Updating the plugin

  1. git pull in the plugin repository.
  2. Copy the new buildSrc directory to your lectures directory.
  3. Check whether any lecture build scripts need to be updated.

Typical lecture directory tree

The way Nigel does things 😁.

lectures
    01_foo/
        build.gradle
        doc_init.tex
        images/
            ...
        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
    02_bar/
        ...
    03_baz etc...
    .gitignore
    build.gradle
    lecturedates.tex
    paper_init_tex
    settings.gradle

Typical gradle tasks

As applicable depending on which document targets are enabled. This list is not comprehensive, run 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. [final]
  • handout - Build handout document. [preview]
  • handout.numbered - Build numbered version of handout document. [final]
  • images - Generate all images from their sources (e.g., PlantUML).
  • notes - Build notes document. [preview]
  • notes.numbered - Build numbered version of notes document. [final]
  • numbered - Create numbered versions of all documents. [final]
  • slides - Build slides document. [preview]
  • slides.numbered - Build numbered version of slides document. [final]

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

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

Housekeeping tasks

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