Add run.sh script for creating new papers

This commit is contained in:
2026-04-15 19:34:22 -04:00
parent 76b8619bd3
commit c233616b9a
Executable
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
init_paper() {
local raw="${1:-.}"
local name
name="$(printf '%s' "$raw" | tr '[:upper:]' '[:lower:]' | tr -d '\\' | tr '[:space:]' '_')"
local dest="$SCRIPT_DIR/$name"
mkdir -p "$dest"
cp "$SCRIPT_DIR/ams-latex-template/doc/amsart-template.tex" "$dest/paper.tex"
sed -i '' "s|\\\\title{}|\\\\title{$raw}|" "$dest/paper.tex"
sed -i '' "s|\\\\author{}|\\\\author{Eric Bauerfeld}|" "$dest/paper.tex"
sed -i '' '/^% author two information$/,/^\\thanks{}$/d' "$dest/paper.tex"
echo "Initialized paper.tex in $dest"
}
case "${1:-}" in
init_paper)
shift
init_paper "$@"
;;
*)
echo "Usage: $0 {init_paper} [dest_dir]" >&2
exit 1
;;
esac