Skip to content

Instantly share code, notes, and snippets.

@takazawa
Created May 30, 2023 06:05
Show Gist options
  • Save takazawa/10fb384dae9134988b9e85b13030d8a1 to your computer and use it in GitHub Desktop.
Save takazawa/10fb384dae9134988b9e85b13030d8a1 to your computer and use it in GitHub Desktop.
A bash script to apply latexindent recursively to all .tex files in the current directory and its subdirectories.
#!/bin/bash
# Usage:
# 1. Save this script as 'latexindent_recursive.sh'.
# 2. Make the script executable with the command 'chmod +x latexindent_recursive.sh'.
# 3. Run the script in the directory where you want to apply latexindent to .tex files with the command './latexindent_recursive.sh'.
# Note: latexindent must be installed and in your PATH for this script to work.
# This script finds all .tex files in the current directory and its subdirectories.
find . -name '*.tex' -type f -print0 | while IFS= read -r -d '' file; do
# Applies latexindent to each file.
latexindent -w -s "${file}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment