Linux command
latexindent 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Format LaTeX file
latexindent [document.tex]
Format and save in place
latexindent -w [document.tex]
Format with local settings
latexindent -l [document.tex]
Specify output file
latexindent [input.tex] -o [output.tex]
Silence output
latexindent -s [document.tex]
Send backup and log files to a different directory
latexindent -c [path/to/cruft/dir/] [document.tex]
Overwrite only if content changed
latexindent -wd [document.tex]
说明
latexindent formats LaTeX source code with consistent indentation. It handles environments, commands, and special constructs intelligently. The tool is configured through YAML files, allowing customization of indent size, environments, and special cases.
参数
- -w, --overwrite
- Overwrite original file (backup is created first).
- -wd, --overwriteIfDifferent
- Overwrite original file only if the indented text differs.
- -o _file_
- Output to specific file.
- -l _file_
- Use local settings YAML file (default: localSettings.yaml).
- -s, --silent
- Silent mode; suppress terminal output.
- -c _dir_
- Send backup files and indent.log to the specified directory instead of the current directory.
- -m, --modifylinebreaks
- Modify line breaks according to settings.
- -g _file_
- Specify log file location.
- --replacement
- Enable replacement mode for string/regex substitutions.
- -y _yaml_
- Provide YAML settings inline (e.g., -y="defaultIndent: ' '").
FAQ
What is the latexindent command used for?
latexindent formats LaTeX source code with consistent indentation. It handles environments, commands, and special constructs intelligently. The tool is configured through YAML files, allowing customization of indent size, environments, and special cases.
How do I run a basic latexindent example?
Run `latexindent [document.tex]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -w, --overwrite do in latexindent?
Overwrite original file (backup is created first).