1
0
Files
uw_tex_letterhead/new_tex_uwletter
Benjamin Mako Hill ce94879122 Add new_tex_uwletter script and update README
Add new_tex_uwletter script (moved from ~/bin) with bug fixes: set -e,
quoted variables, WORK_DIR instead of TMPDIR, existence check for
destination, and mktemp inside the conditional. Update README to fix
stale URLs, ShareLaTeX -> Overleaf, MacOSX -> macOS, typo in
Dasgupta's email, and add script usage section.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 10:56:16 -07:00

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Helper script to export LaTeX templates for new UW letters
# Copyright (c) 2009-2016 Benjamin Mako Hill <mako@atdot.cc>
# Released under the GPLv3 or later.
set -e
SOURCEDIR="$HOME/tex/uw_tex_letterhead"
CURDIR=$(pwd)
if [ -n "$1" ]
then
if [ -e "$1" ]; then
echo "error: '$1' already exists"
exit 1
fi
WORK_DIR=$(mktemp -d)
cd "$SOURCEDIR"
git archive --format=tar mako | tar x -C "$WORK_DIR"
cd "$CURDIR"
mv "$WORK_DIR" "$1"
cd "$1"
mv "washington_letterhead_letter-matrix-deptartment.tex" "$(basename "$1").tex"
# create a symlink farm for the fonts
rm -rf ./fonts/*
# first create the directories
for fontdir in "${SOURCEDIR}/fonts/"*; do
mkdir "./fonts/$(basename "${fontdir}")"
# then the files
for fontfile in "${fontdir}/"*; do
ln -s "${fontfile}" "./fonts/$(basename "${fontdir}")/$(basename "${fontfile}")"
done
done
else
echo "specify a directory where the template should go"
fi