diff --git a/latex/fmt/format.sh b/latex/fmt/format.sh index 01d4f11..378e501 100755 --- a/latex/fmt/format.sh +++ b/latex/fmt/format.sh @@ -1,25 +1,32 @@ #!/bin/sh if [ ! "$1" == "" ]; then - cp .latexindent.yaml "$1/" || true - cp latexindent.yaml "$1/" || true + cp .latexindent.yaml "$1/" || true + cp latexindent.yaml "$1/" || true cd $1 fi echo "Formatting directory $(pwd)" +if [ -f .latexindent.yaml ]; then + echo "latexindent config found" +elif [ -f latexindent.yaml ]; then + echo "latexindent config found" +else + echo "No latexindent config found. Using defaults" +fi files=$(find . -type f | grep "\.tex") idx=1 total=$(echo "$files" | wc -l) for file in $files; do - echo "Processing file $idx / $total" + echo "Processing file $idx / $total" latexindent -s -w -l $file - idx=$((idx + 1)) + idx=$((idx + 1)) done echo "Cleaning up..." backups=$(find . -type f | grep "\.bak") for backup in $backups; do - rm $backup + rm $backup done