github cmhughes/latexindent.pl V3.10

latest releases: V4.0, V3.24.7, V3.24.6...
4 years ago

enhancements

  • logFilePreferences updated with more options, particularly for when -tt switch active #276
  • spacesBeforeAmpersand enhanced with new option for leading blank column behaviour #275
  • fineTuning and noIndentBlock enhanced, demonstrated below #274
  • indentconfig.yaml enhanced with details at #263 and in documentation
  • removeWhiteSpace dos2unixlinebreaks: new switch, documented and details at #256

bug fix

  • #183, oneSetencePerLine, removeParagraphLineBreaks

demonstration 1: fineTuning trailing comments

starting with

some before text
 \href{Handbook%20for%30Spoken%40document.pdf}{my document}
some after text 

and using

modifyLineBreaks:
    textWrapOptions:
        columns: 80
        huge: overflow
        all: 1
        perCodeBlockBasis: 1
    removeParagraphLineBreaks:
        all: 1

fineTuning:
    trailingComments:
      notPreceededBy: '(?:(?<!Handbook)(?<!for)(?<!Spoken))'

then the output is (using -m switch):

some before text \href{Handbook%20for%30Spoken%40document.pdf}{my document} some after text

demonstration 2: noIndentBlock with begin and end

starting with

some before text
        this code
                won't
     be touched
                    by
             latexindent.pl!
some after text 

and using

noIndentBlock:
    demo:
        begin: 'some\hbefore'
        body: '.*?'
        end: 'some\hafter\htext'
        lookForThis: 1

gives the output

some before text
        this code
                won't
     be touched
                    by
             latexindent.pl!
some after text

Note that lookForThis is optional in the noIndentBlock field; default is 1.

demonstration 3: spacesBeforeAmpersand

Starting with

\begin{equation}
    \begin{aligned}
    & a = b, \\
    & c = d.
    \end{aligned}
\end{equation}

\begin{equation}
    \begin{aligned}
    a & = b, \\
    c & = d.
    \end{aligned}
\end{equation}

and using

defaultIndent: ' '

noAdditionalIndent:
  aligned: 1

lookForAlignDelims:
   aligned: 
      spacesBeforeAmpersand: 
        default: 2
        leadingBlankColumn: 0

then the result is

\begin{equation}
 \begin{aligned}
 & a = b, \\
 & c = d.
 \end{aligned}
\end{equation}

\begin{equation}
 \begin{aligned}
 a  & = b, \\
 c  & = d.
 \end{aligned}
\end{equation}

The fields default and leadingBlankColumn both take integer values that represent the spaces to be added before ampersands. They are both optional.

Don't miss a new latexindent.pl release

NewReleases is sending notifications on new releases.