Files
vpn-dns-gateway/manual/TINYTEX_WINDOWS_SETUP.md
T
vsun1 f3a80a284f
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
Patch Jenkins and verify cloud CI host maintenance
2026-11-26 23:23:44 -05:00

301 lines
13 KiB
Markdown

# TinyTeX setup for Windows and Claude
For Billy and the Claude assistant helping him set up local LaTeX. Prepared
November 26, 2026 for the SSW 590 Group 1 project.
TinyTeX supplies the compiler and package manager. An editor such as VS Code is
optional. The steps below install or reuse one working toolchain, then build the
group manual with its existing PowerShell helper. R, RStudio and Docker are not
needed for this workflow. See the [TinyTeX project](https://github.com/rstudio/tinytex)
and [official installation options](https://github.com/rstudio/tinytex-releases#installation).
## Prompt to give Claude
> Set up local LaTeX on my Windows computer using this file. First read the
> repository's AGENTS.md and any applicable local instructions, inspect the
> existing compiler installations, and reuse working TinyTeX before installing
> anything. Use paths belonging to my computer, not Vincent's paths. If installation
> is needed, use the official TinyTeX installer in a fresh temporary directory.
> Install only the packages the project needs, build the complete group manual,
> inspect its log, and open the PDF for visual review. Preserve source files,
> existing installations, environment settings and unrelated work. Do not commit,
> push, change cloud services or request credentials. Record assistance if the
> repository requires it, preserving prior entries. Finish by reporting the
> actual tool paths, versions, build result, PDF location and any unresolved errors.
Claude should execute the steps it can perform through its available tools,
explain any required manual step, and distinguish completed checks from commands
that have only been suggested. These instructions target Windows; use the
project's platform-specific build procedure if the actual computer uses another OS.
## 1 Locate the checkout and existing tools
Open an ordinary PowerShell window. Administrator access should not be the
starting point. Locate the actual group repository; its folder may still be
named `vpn-dns-gateway`. Confirm it contains:
```text
AGENTS.md
manual/latex/devopsAssignment.tex
manual/latex/makefilePowerShell.ps1
```
From that repository root, inspect status and available tools:
```powershell
git status --short --branch
Get-Command pdflatex,bibtex,makeindex,tlmgr -All -ErrorAction SilentlyContinue |
Select-Object Name,Source
```
Inspect the tool locations named in the local instructions, and these common
TinyTeX locations under the current user's profile:
```powershell
$tinyCandidates = @(
(Join-Path $env:APPDATA 'TinyTeX'),
(Join-Path $env:LOCALAPPDATA 'Programs\TinyTeX'),
(Join-Path $env:USERPROFILE 'Documents\Projects\Tools\LaTeX\TinyTeX')
)
$tinyCandidates | Where-Object { Test-Path -LiteralPath $_ }
```
Use an existing working TinyTeX root if found. Confirm it contains `bin\windows`
and that its executables run. If only a working MiKTeX installation exists, keep
it intact; the group's preference for TinyTeX does not justify deleting it or
automatically installing another distribution. Resolve the tool choice using
the computer's actual setup and repository instructions.
## 2 Install TinyTeX only when needed
Skip this section when working TinyTeX already exists. For a fresh installation,
the example below selects `%LOCALAPPDATA%\Programs\TinyTeX`. Another short,
user-writable location is valid. `TINYTEX_DIR` is the **parent** directory: the
installer appends `TinyTeX` itself.
The current [official installer](https://github.com/rstudio/tinytex/blob/main/tools/install-bin-windows.ps1)
removes an existing TinyTeX at its target and at `%APPDATA%\TinyTeX`. The checks
below prevent those replacements. An isolated temporary directory also confines
the installer's temporary-file cleanup. Do not rerun the installer as a routine
response to a missing package.
```powershell
$tinyParent = Join-Path $env:LOCALAPPDATA 'Programs'
$tinyRoot = Join-Path $tinyParent 'TinyTeX'
$oldDefaultRoot = Join-Path $env:APPDATA 'TinyTeX'
if ((Test-Path -LiteralPath $tinyRoot) -or
(Test-Path -LiteralPath $oldDefaultRoot)) {
throw 'Existing TinyTeX found. Inspect and reuse it instead of reinstalling.'
}
$tinySetupWork = Join-Path ([IO.Path]::GetTempPath()) (
'ssw590-tinytex-setup-' + [guid]::NewGuid().ToString('N')
)
New-Item -ItemType Directory -Path $tinySetupWork | Out-Null
New-Item -ItemType Directory -Force -Path $tinyParent | Out-Null
$tinyInstaller = Join-Path $tinySetupWork 'install-bin-windows.bat'
Invoke-WebRequest -Uri 'https://tinytex.yihui.org/install-bin-windows.bat' `
-OutFile $tinyInstaller
$savedTinyTemp = $env:TEMP
$savedTinyTmp = $env:TMP
$savedTinyDir = $env:TINYTEX_DIR
$savedTinyBundle = $env:TINYTEX_INSTALLER
$savedTinyVersion = $env:TINYTEX_VERSION
try {
$env:TEMP = $tinySetupWork
$env:TMP = $tinySetupWork
$env:TINYTEX_DIR = $tinyParent
$env:TINYTEX_INSTALLER = 'TinyTeX-1'
$env:TINYTEX_VERSION = $null
& $tinyInstaller
if ($LASTEXITCODE -ne 0) { throw 'TinyTeX installer failed; inspect its output.' }
} finally {
$env:TEMP = $savedTinyTemp
$env:TMP = $savedTinyTmp
$env:TINYTEX_DIR = $savedTinyDir
$env:TINYTEX_INSTALLER = $savedTinyBundle
$env:TINYTEX_VERSION = $savedTinyVersion
}
if (-not (Test-Path -LiteralPath (Join-Path $tinyRoot 'bin\windows\pdflatex.exe'))) {
throw 'Compiler not found at the selected installation root.'
}
```
Use the official installer as supplied. If an institutional policy blocks it,
use the approved installation route rather than bypassing that policy. If the
download URL is unavailable, consult the official TinyTeX repositories above;
do not substitute an installer from an unrelated download site.
## 3 Select one compiler consistently
Set `$tinyRoot` to the installation actually found or installed. The following
example matches the fresh installation in section 2:
```powershell
$tinyRoot = Join-Path $env:LOCALAPPDATA 'Programs\TinyTeX'
$tinyBin = Join-Path $tinyRoot 'bin\windows'
if (-not (Test-Path -LiteralPath $tinyBin)) { throw 'Check the TinyTeX root.' }
$env:DEVOPS_LATEX_BIN = $tinyBin
$env:PATH = "$tinyBin;$env:PATH"
Get-Command pdflatex,bibtex,makeindex,tlmgr |
Select-Object Name,Source
pdflatex --version
bibtex --version
tlmgr --gui-lang en --version
```
The four commands should resolve to the same TinyTeX installation. The PATH
assignment above affects only this PowerShell process. `DEVOPS_LATEX_BIN` tells
the repository helper which installation to prefer, including when another
distribution is already on PATH.
For user-level PATH registration, TeX Live also provides:
```powershell
tlmgr --gui-lang en path --windowsmode=user add
```
Open a new terminal after persistent PATH registration. Restart the editor or
Claude application if its terminal still inherits the old environment. Keep
using `DEVOPS_LATEX_BIN` for the repository build; avoid rewriting the whole
Windows PATH. See the [TeX Live manager documentation source](https://github.com/TeX-Live/texlive-source/blob/trunk/texk/texlive/linked_scripts/texlive/tlmgr.pl).
`makeindex` does not support `--version` in the verified Windows toolchain;
its banner and successful glossary/index steps in the build log establish
which indexer ran. Do not treat an unsupported version flag as a broken install.
## 4 Install the group manual packages
With the selected TinyTeX commands active, install this starting set:
```powershell
tlmgr --gui-lang en install tools ltablex glossaries booktabs enumitem listings tcolorbox
tlmgr --gui-lang en install upquote float lm fancyhdr amsmath hyperref xcolor
tlmgr --gui-lang en install fancyvrb minted pgf makeindex
```
Check each command's exit status. Dependencies are resolved by `tlmgr`; additional
packages can be installed from the actual missing-file error. The explicit
language option also avoids registry-based locale detection problems encountered
in restricted Windows environments.
The manual uses `minted` for highlighted code. Current TeX Live can supply its
`latexminted` helper with the package; the existing group toolchain does. Check:
```powershell
Get-Command latexminted,pygmentize,python,py -ErrorAction SilentlyContinue |
Select-Object Name,Source
if (Get-Command latexminted -ErrorAction SilentlyContinue) {
latexminted --version
}
```
If `latexminted` works, do not install another Python environment just for this
build. If the build actually reports a missing modern helper, inspect the
installed `minted` version and repair its installation through the same TinyTeX
manager. An older `minted` setup may instead require `pygmentize`; when that is
the reported failure and Python 3 is already installed, install Pygments into
that chosen interpreter and ensure its Scripts directory is on the process PATH:
```powershell
py -3 -m pip install --user Pygments
py -3 -m pygments -V
```
Do not run that fallback blindly if `py` is unavailable. Follow the
[minted maintainer's instructions](https://github.com/gpoore/minted) for the
installed version. The existing project build already supplies `-shell-escape`
for its trusted source; preserve the build helper rather than editing source
chapters to hide a tool failure.
## 5 Build and inspect the complete manual
From the actual group repository root, with `DEVOPS_LATEX_BIN` still set:
```powershell
if (-not (Test-Path -LiteralPath 'manual/latex/devopsAssignment.tex')) {
throw 'Change to the group repository root first.'
}
& ./manual/latex/makefilePowerShell.ps1 -Action pdf
```
The helper changes to the directory containing the main `.tex` file, runs the
initial compiler pass, BibTeX when configured, glossary/acronym/index generation,
and the final passes needed to settle references. The expected output is:
```text
manual/2026F-SSW-590-DevOps-Group-1.pdf
```
Check the final log, then open that PDF and inspect its title, contents, diagrams,
tables and any affected pages. A single successful `pdflatex` pass is insufficient
for this project.
```powershell
Select-String -LiteralPath 'manual/latex/devopsAssignment.log' `
-Pattern '(^!|LaTeX Error|undefined|Rerun to|not found|Overfull)'
git status --short
git check-ignore 'manual/2026F-SSW-590-DevOps-Group-1.pdf'
```
Resolve errors and undefined references/citations. Review layout warnings in
context; distinguish pre-existing warnings from new defects. Confirm the PDF
is the current build and remains ignored by Git. Local compilation does not
replace the course's separate automated-build evidence.
For another LaTeX project, find its real main file and verified build script.
Use its configured BibTeX or Biber backend and required glossary/index steps;
do not apply the group manual's filenames to an unrelated document.
## 6 Troubleshoot the specific failure
| Symptom | Action |
| --- | --- |
| A TeX command is missing | Verify `bin\windows`, process PATH and `DEVOPS_LATEX_BIN`; reopen the terminal if needed. |
| TinyTeX and MiKTeX tools are mixed | Select TinyTeX explicitly and inspect every resolved command path again. |
| `File example.sty not found` | Run `tlmgr --gui-lang en search --global --file '/example.sty'`, identify the owning package, then `tlmgr --gui-lang en install PACKAGE`. Replace the example names. |
| `cornell.cls` is missing | Confirm the repository has its supplied class and that the build runs from `manual/latex`; do not replace the course class. |
| The agent gets Access denied but the user's terminal works | Correct the agent's access to the selected tool directory or use an approved existing installation. Do not assume TinyTeX is broken. |
| A restricted sandbox cannot resolve a long tool path | Use an unused temporary drive mapping as shown below, then remove it. |
| The PowerShell build script is blocked | Check `Get-ExecutionPolicy -List`. Follow managed policy. On a personal PC, a process-scoped `RemoteSigned` policy may be used for the reviewed script; do not change machine-wide policy as a routine setup step. |
| TeX Live reports a local/remote year mismatch | Do not force a cross-year package update. Follow the current official TinyTeX maintenance procedure and preserve the existing installation before planning a replacement. |
For the long-path case only, first check `Get-PSDrive T` and `subst` to ensure
`T:` is unused. Substitute the actual TinyTeX root in `$tinyRoot`:
```powershell
subst T: "$tinyRoot"
if ($LASTEXITCODE -ne 0) { throw 'Drive mapping failed; do not continue.' }
$savedLatexBin = $env:DEVOPS_LATEX_BIN
$savedLatexPath = $env:PATH
try {
$env:DEVOPS_LATEX_BIN = 'T:\bin\windows'
& ./manual/latex/makefilePowerShell.ps1 -Action pdf
} finally {
$env:DEVOPS_LATEX_BIN = $savedLatexBin
$env:PATH = $savedLatexPath
subst T: /d
}
```
## 7 Finish and report the result
Keep the completed PDF, source files, installation and useful diagnostic logs.
After visual verification, the project's helper can remove its compiler
intermediates while retaining the final PDF:
```powershell
& ./manual/latex/makefilePowerShell.ps1 -Action clean
```
Remove only the fresh `ssw590-tinytex-setup-...` directory created for this setup,
after resolving and checking its exact path and confirming installation succeeded.
Do not delete the installed TinyTeX root or other temporary directories.
Claude's final report should identify the selected compiler root and versions,
package/helper changes, exact build command and result, PDF location, visual
review result, unresolved warnings, and any files cleaned up. Report a blocked
step honestly; a guide or a successful setup on Vincent's computer is not proof
that installation or compilation succeeded on Billy's computer.