# Run in PowerShell after installing a TeX distribution with the required packages. param([ValidateSet('review','early','final')][string]$Mode = 'review') $ErrorActionPreference = 'Stop' Set-StrictMode -Version Latest $Job = switch ($Mode) { 'review' { 'review' } 'early' { 'main-biblatex' } 'final' { 'final-preview' } } Get-Command lualatex -ErrorAction Stop | Out-Null Get-Command biber -ErrorAction Stop | Out-Null Push-Location $PSScriptRoot try { & lualatex -interaction=nonstopmode -halt-on-error "$Job.tex" if ($LASTEXITCODE -ne 0) { throw 'Initial LuaLaTeX pass failed.' } & biber $Job if ($LASTEXITCODE -ne 0) { throw 'Bibliography processing failed.' } 1..3 | ForEach-Object { & lualatex -interaction=nonstopmode -halt-on-error "$Job.tex" if ($LASTEXITCODE -ne 0) { throw 'Final LuaLaTeX pass failed.' } } Write-Output "Created $Job.pdf" } finally { Pop-Location }