18
0

Consolidate document creation scripts and fix bugs

Replace the individual new_knitr_document, new_tex_assignment, and
new_tex_letter scripts with a single new_tex_document script that takes
a document type as its first argument. Fix bugs present in all scripts:
unquoted variables, TMPDIR name collision, missing existence checks, and
mktemp running unconditionally. Add cdsc_tex_aliases.sh for backwards
compatibility with old script names. Add rename_tex_to_dirname script
(moved from ~/bin). Update README and wiki page to reflect new setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-29 10:31:08 -07:00
parent 86fbf0f0a6
commit 3b444f70fc
8 changed files with 296 additions and 100 deletions

122
README
View File

@@ -1,50 +1,130 @@
================================
=== LaTeX Custom Scripts ======
=== CDSC LaTeX Templates =======
================================
Copyright (c) 2009-2025 Benjamin Mako Hill <mako@atdot.cc> / <makohill@uw.edu>
Copyright (c) 2009-2026 Benjamin Mako Hill <mako@atdot.cc> / <makohill@uw.edu>
This repository contains LaTeX configuration files that I use to format
my papers. They are all released under the GNU GPL version 3 or later.
This repository contains LaTeX configuration files and templates used to
format papers, assignments, and letters. All files are released under the
GNU GPL version 3 or later.
The latest version can be found in git at:
https://gitea.communitydata.science/collective/cdsc_tex
As scripts and configuration files, I do not "release" these files. You
can always check out the latest version with Git with the following
command:
You can check out the latest version with:
git clone https://gitea.communitydata.science/collective/cdsc_tex.git
Bug reports, comments, questions, and patches can all be directed to:
Bug reports, comments, questions, and patches can be directed to:
Benjamin Mako Hill <makohill@uw.edu> [work]
Benjamin Mako Hill <mako@atdot.cc> [personal]
To submit a patch, clone the repository, make your changes, and use
git format-patch to generate patch files to send by email:
git format-patch origin/master
git send-email *.patch
================================
=== Dependencies ===============
================================
If you are running Debian or Ubuntu, you will first need to install the
following packages:
On Debian or Ubuntu, install the following packages:
* rubber
* latexmk
* texlive-latex-recommended
* texlive-fonts-extra
* texlive-fonts-recommended
* texlive-bibtex-extra
* texlive-bibtex-extra
You can do so with the following command:
apt-get install rubber texlive-latex-recommended \
apt install latexmk texlive-latex-recommended \
texlive-fonts-extra texlive-fonts-recommended \
texlive-bibtex-extra
texlive-bibtex-extra
I don't know the details of setting up these LaTeX files to work with on
systems other than Debian or Ubuntu but imagine it will involve
installing a full TeX Live distribution.
On other systems, installing a full TeX Live distribution should provide
everything needed.
In my templates, I make extensive use of the following Garamond font:
The templates make extensive use of the URW Garamond font, available from
CTAN: https://ctan.org/pkg/urw-garamond
http://www.ctan.org/tex-archive/fonts/urw/garamond/
================================
=== Branches ===================
================================
This repository has two main branches:
master Standard LaTeX templates (paper, assignment, letter)
knitr Knitr/R template for reproducible research documents
================================
=== Scripts ====================
================================
new_tex_document
----------------
Creates a new document directory from a template. Takes a document type
and destination directory as arguments:
new_tex_document <type> <directory>
Available types:
paper LaTeX paper template (master branch)
assignment LaTeX assignment template (master branch)
knitr Knitr/R paper template (knitr branch)
letter LaTeX letter template (master branch)
Example:
new_tex_document paper my-new-paper
This creates my-new-paper/ populated with the template files, with the
main source file renamed to my-new-paper.tex (or .Rtex for knitr).
rename_tex_to_dirname
---------------------
Renames the single .tex file in the current directory to match the
directory name. Useful for cleaning up a template that was set up
manually:
cd my-paper && rename_tex_to_dirname
================================
=== Shell Aliases ==============
================================
The file cdsc_tex_aliases.sh provides aliases for the old individual
script names, for convenience or backwards compatibility. Add the
following to your .bashrc or .zshrc:
[[ -f ~/tex/cdsc_tex/cdsc_tex_aliases.sh ]] && \
source ~/tex/cdsc_tex/cdsc_tex_aliases.sh
This defines the following aliases (only if new_tex_document is in PATH):
new_tex_assignment → new_tex_document assignment
new_knitr_document → new_tex_document knitr
new_tex_letter → new_tex_document letter
================================
=== Migration ==================
================================
The individual scripts new_knitr_document, new_tex_assignment, and
new_tex_letter have been consolidated into new_tex_document. The old
scripts remain in the repository but are superseded.
To migrate, replace calls to the old scripts with new_tex_document:
Old: new_knitr_document mydir
New: new_tex_document knitr mydir
Old: new_tex_assignment mydir
New: new_tex_document assignment mydir
Old: new_tex_letter mydir
New: new_tex_document letter mydir
Alternatively, source cdsc_tex_aliases.sh (see above) to keep using the
old names without changing your workflow.