This question already has an answer here:

I would like to know of a quick way to auto align LaTeX code where appropriate, similar to the ctrl + i keyboard shortcut used in MATLAB after highlighting a bunch of code that isn't aligned correctly.

marked as duplicate by Troy, TeXnician, user31729, Stefan Pinnow, user36296 Dec 10 '17 at 21:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Does such a feature exist in TeXstudio? If not, it will be difficult to give it a shortcut. I never heard of this and am using the script latexindent with arara. – LaRiFaRi Aug 31 '16 at 13:49
  • @LaRiFaRi : I am not sure. I did some searching but couldn't find a shortcut for TeXstudio. Sometimes copying and pasting code from one document to another causes a lot of additional spacing before lines. So, I guess it would be beneficial to many if they did implement some sort of option to auto-indent code with TeXstudio, if such a feature didn't exist. – Gale Aug 31 '16 at 15:28
  • Indents are evil. – ajeh Aug 31 '16 at 17:17
  • 4
    There is a command line utility for this: ctan.org/pkg/latexindent – Tim Hoffmann Sep 1 '16 at 16:10

Browse other questions tagged or ask your own question.