
私のカスタム クラスの 1 つに含まれる次のファイルがあります。
% 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
私のカスタムクラスの一部である次のファイルがあります
これはクラスファイルの一部なので、indentAfterHeadings
次のようにオフにすることをお勧めします。
ラテックスインデント.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