Files
math-research/run.sh
T

29 lines
749 B
Bash
Executable File

#!/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