cmhughes / latexindent.pl

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.
GNU General Public License v3.0
884 stars 84 forks source link

[help] How can I set 4 space indent? #325

Closed avatar-lavventura closed 2 years ago

avatar-lavventura commented 2 years ago

I have applied following config file: https://github.com/cmhughes/latexindent.pl/issues/324#issuecomment-1012800645

> specialBeginEnd:
>     If:
>         begin: '\\If'
>         middle: '\\ElsIf'
>         end: '\\EndIf'
>         lookForThis: 1
>     specialBeforeCommand: 1

which converts

\documentclass{article}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\begin{document}
\begin{algorithm}
\caption{Main D Algorithm}\label{alg:cap}
\begin{algorithmic}[1]
    \For{a for statement}
    \If{some coding}
    \State do something
    \ElsIf{another condition}
    \For{some condition}
    \If{another statement}
    \State do something
    \EndIf
    \EndFor
    \ElsIf{problem is here}
    \State whatever
    \EndIf
    \EndFor
\end{algorithmic}
\end{algorithm}
\end{document}

into , indents are TAB:

\documentclass{article}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\begin{document}
\begin{algorithm}
    \caption{Main D Algorithm}\label{alg:cap}
    \begin{algorithmic}[1]
        \For{a for statement}
        \If{some coding}
            \State do something
        \ElsIf{another condition}
            \For{some condition}
            \If{another statement}
                \State do something
            \EndIf
            \EndFor
        \ElsIf{problem is here}
            \State whatever
        \EndIf
        \EndFor
    \end{algorithmic}
\end{algorithm}
\end{document}

Here would it be possible to apply 4 space instead of TAB(^I) ?

cmhughes commented 2 years ago

See https://latexindentpl.readthedocs.io/en/latest/sec-default-user-local.html#indentation-and-horizontal-space

On Fri, 14 Jan 2022, 10:01 Alper Alimoglu, @.***> wrote:

I have applied following config file: #324 (comment) https://github.com/cmhughes/latexindent.pl/issues/324#issuecomment-1012800645

specialBeginEnd: If: begin: '\If' middle: '\ElsIf' end: '\EndIf' lookForThis: 1 specialBeforeCommand: 1

which converts it into:

\documentclass{article} \usepackage{algorithm} \usepackage[noend]{algpseudocode} \begin{document} \begin{algorithm} \caption{Main D Algorithm}\label{alg:cap} \begin{algorithmic}[1] \For{a for statement} \If{some coding} \State do something \ElsIf{another condition} \For{some condition} \If{another statement} \State do something \EndIf \EndFor \ElsIf{problem is here} \State whatever \EndIf \EndFor \end{algorithmic} \end{algorithm} \end{document}

Here would it be possible to apply 4 space instead of TAB(^I) ?

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYCUXRXZO2SXY2TJZWDUV7X7PANCNFSM5L6LR25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

cmhughes commented 2 years ago

Please use the issue template in the future :)

On Fri, 14 Jan 2022, 10:15 Alper Alimoglu, @.***> wrote:

Closed #325 https://github.com/cmhughes/latexindent.pl/issues/325.

— Reply to this email directly, view it on GitHub https://github.com/cmhughes/latexindent.pl/issues/325#event-5893796638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQ7CYBFEDOEVXPNLESNJETUV7ZU3ANCNFSM5L6LR25A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

avatar-lavventura commented 2 years ago

@cmhughes sure I get excited :-) I was looking for what latexindent does over months.