I'm using ptop to autoformat my code but it behaves strangely. Let's take this ptop-formatted code:
n := 2;
if n < 0 then
WriteLn('negative')
else if n > 0 then
WriteLn('positive')
else
WriteLn('zero');
Line 5 is indented too much. The problem is that it is aligned to "if", similarly to line 3, but it should be aligned to "else if".
For ptop, you can generate its config file with "ptop -g local.cfg". Then, you can tweak it and use the tweaked version: "ptop -c local.cfg in.pas out.pas". However, I couldn't figure out how to tweak it.