Skip to content
Perl script to add indentation (leading horizontal space) to LaTeX files. It can modify line breaks before, during and after code blocks; it can perform text wrapping and paragraph line break removal. It can also perform string-based and regex-based substitutions/replacements. The script is customisable through its YAML interface.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
LatexIndent Version 3.7 Jul 13, 2019
documentation Update readthedocs.yaml Jul 16, 2019
path-helper-files install LatexIndent/*.pm in system PATH Feb 19, 2017
test-cases -y switch, tweak to the splitting at : following #167 Jul 12, 2019
.appveyor.yml Implementation of AppVeyor ci Jan 27, 2018
.gitignore V3.4.3: Jun 8, 2018
.travis.yml Travis CI: including perl versions 5.28 and 5.30 in the testing May 24, 2019
LICENSE.txt Create LICENSE.txt Jun 19, 2017
defaultSettings.yaml Version 3.7 Jul 13, 2019 Version 3.7 Jul 13, 2019 Update readthedocs.yaml Jul 16, 2019
readthedocs.yaml Update readthedocs.yaml Jul 16, 2019

Build Status Build status Documentation Status

latexindent logo is a perl script to indent (add horizontal leading space to) code within environments, commands, after headings and within special code blocks.

It has the ability to align delimiters in environments and commands, and can modify line breaks.

version, version 3.7, 2019-07-13


Chris Hughes (cmhughes)

build status

I use both travis-ci (Linux) and AppVeyor (Windows) as continuous integration services to test for a small selection of test cases for every commit (I use git to track changes in the many test cases listed in the test-cases directory); you can see which versions of perl are tested by travis-ci within .travis.yml.

Build Status Build status


For complete details, please see:

Windows executable

latexindent.exe is available at and is created using

  perl -u -o latexindent.exe

using the Par::Packer perl module. is located in the helper-scripts directory.


You'll need

in the same directory. Windows users might prefer to get


and latexindent.exe is available at

perl modules

You'll need a few readily-available perl modules. Full details are given within the Appendix of the documentation; you might also like to see .travis.yml for Linux/MacOS users, and .appveyor.yml for Strawberry perl users.


A nice way to test the script is to navigate to the test-cases directory, and then run the command (on Linux/Mac -- sorry, a Windows test-case version is not available):



This script may not work for your style of formatting; I highly recommend comparing the outputfile.tex to make sure that nothing has been changed (or removed) in a way that will damage your file.

I recommend using each of the following:

  • a visual check, at the very least, make sure that each file has the same number of lines
  • a check using latexdiff inputfile.tex outputfile.tex
  • git status myfile.tex

feature requests

I'm happy to review feature requests, but I make no promises as to if they will be implemented; if they can be implemented, I make no promises as to how long it will take to implement them, and in which order I do so -- some features are more difficult than others! Feel free to post on the issues page of this repository.

development model

I follow the development model given here: which means that always has (at least) two branches:


The master branch always contains the released version and develop contains the development version. When developing a new feature or bug fix, I typically use:

    git checkout develop
    git checkout -b feature/name-of-feature

and then I merge it into the develop branch using

    git checkout develop
    git merge feature/name-of-feature --no-ff

perl version

I develop on Ubuntu Linux, using perlbrew; I currently develop on perl version v5.26.0

related projects

You might like to checkout the following related projects on github.

arara: GitHub stars

atom-beautify: GitHub stars


I find that the following quotes resonate with me with regards to my approach to

  • I want people to use Perl. I want to be a positive ingredient of the world and make my American history. So, whatever it takes to give away my software and get it used, that's great. Larry Wall
  • A common, brute-force approach to parsing documents where newlines are not significant is to read ... the entire file as one string ... and then extract tokens one by one, Christiansen & Torkington, Perl Cookbook, Section 6.16
  • Once you understand the power that regular expressions provide, the small amount of work spent learning them will feel trivial indeed Friedl, Mastering Regular Expressions, end of Chapter 1.
  • a problem speaks to them, and they have to solve it...and it becomes a hobby. But they keep coming back to it every now and then. They keep tinkering. It will never be finished...that's the point of a hobby, Westwood to Reacher in 'Make Me', Lee Child
  • Do the best you can until you know better. Then when you know better, do better. Maya Angelou
You can’t perform that action at this time.