неожиданное поведение вмятины с latexindent

неожиданное поведение вмятины с latexindent

У меня есть следующий файл, который является частью одного из моих пользовательских классов:

% actual latexindent output:
\DeclareDocumentCommand {\chapterformat}  { } { \thechapter }
 \DeclareDocumentCommand {\sectionformat} { } {\thesection}
  \DeclareDocumentCommand \subsectionformat { } {\thesubsection}
    \DeclareDocumentCommand \subsubsectionformat {} {\thesubsubsection}
    \DeclareDocumentCommand \paragraphformat {} {\theparagraph}
    \DeclareDocumentCommand \subparagraphformat {} {\thesubparagraph}

Исходный код, который вы видите здесь, является точным выводом после запуска latexindent. Однако вместо этого я ожидал бы вывода вроде

% expected latexindent output:
\DeclareDocumentCommand {\chapterformat}  { } { \thechapter }
\DeclareDocumentCommand {\sectionformat} { } {\thesection}
\DeclareDocumentCommand \subsectionformat { } {\thesubsection}
\DeclareDocumentCommand \subsubsectionformat {} {\thesubsubsection}
\DeclareDocumentCommand \paragraphformat {} {\theparagraph}
\DeclareDocumentCommand \subparagraphformat {} {\thesubparagraph}

Очевидно, latexindentздесь применяются правила отступов для команд секционирования в соответствии с моей конфигурацией:

# from latexindentconfig.yaml
indentAfterHeadings:
    part:
       indentAfterThisHeading: 0
       level: 1
    chapter:
       indentAfterThisHeading: 1
       level: 2
    section:
       indentAfterThisHeading: 1
       level: 4
    subsection:
       indentAfterThisHeading: 1
       level: 8
    subsection*:
       indentAfterThisHeading: 0
       level: 9
    subsubsection:
       indentAfterThisHeading: 0
       level: 10
    paragraph:
       indentAfterThisHeading: 0
       level: 11
    subparagraph:
       indentAfterThisHeading: 0
       level: 12

Мне нравится делать отступы в разделах, но не в определениях, и у меня такое чувство, будто я никогда не просил latexindentделать отступы в своих определениях. Очевидно, что существует разрыв между моими ожиданиями и фактической функциональностью.

Теперь возникает вопрос: как мне сказать, latexindentчто не следует применять определения к командам секционирования?

решение1

У меня есть следующий файл, который является частью одного из моих пользовательских классов

Учитывая, что это часть файла класса, я бы рекомендовал отключить as indentAfterHeadingsв

latexindent.yaml

indentAfterHeadings:
    chapter:
       indentAfterThisHeading: 0
    section:
       indentAfterThisHeading: 0
    subsection:
       indentAfterThisHeading: 0

а затем беги

latexindent.pl -l myfile.tex

Если вы хотите назвать yamlфайл как-то иначе, скажем, marc.yamlтогда вы назовете

latexindent.pl -l marc.yaml myfile.tex

Связанный контент