titlesec コードを scrlayer-scrpage コードに変換する方法

titlesec コードを scrlayer-scrpage コードに変換する方法

私の LaTeX コードでは、KOMA スクリプト バンドルの実際のバージョンとそのドキュメントクラス scrbook を使用しています。この点で、パッケージ titlesec を使用するコードを、より KOMA スクリプトと互換性のある scrlayer-scrpage パッケージを使用するコードに変換する方法を知りたいです。以下の関連コードを見つけてください。どなたか助けていただけると大変ありがたいです。

\usepackage{titlesec}
%modify part-page-style
\titleformat{\part}[display]
    {\huge\filcenter\bfseries}
    {\Huge{\MakeUppercase{\partname} \thepart}}
    {5pt}
    {\titlerule[3pt] \vspace{10pt}}
    []
%modify chapter-page-style
\titleformat{\chapter}[display]
    {\LARGE\filcenter\bfseries}
    {\titlerule[3pt] \vspace{3pt} \titlerule[1pt] \vspace{5pt} \huge{\MakeUppercase{\chaptertitlename} \thechapter}}
    {0pt}
    {\titlerule[1pt] \vspace{10pt}}
    []
\titlespacing*{\chapter}{0pt}{0pt}{40pt}

答え1

ここで提案したいのはKOMAスクリプト バージョン 3.17(CTAN の現在のバージョン) またはそれ以降:

\documentclass{scrbook}[2015/04/23]
\usepackage{microtype}
% modify part
\setkomafont{part}{\normalfont\bfseries\huge}
\setkomafont{partnumber}{\normalfont\bfseries\Huge}
\RedeclareSectionCommand[innerskip=10pt]{part}
\renewcommand\partformat{%
  \strut\MakeUppercase{\lsstyle% Upper case sequences should be spaced
    \partname~\thepart}%
  \vspace{5pt}\hrule height 3pt%
}
% modify chapter
\KOMAoptions{chapterprefix}
\renewcommand\raggedchapter{\centering}
\setkomafont{chapter}{\normalfont\bfseries\LARGE}
\setkomafont{chapterprefix}{\huge}
\RedeclareSectionCommand[beforeskip=0pt,afterskip=40pt,innerskip=12pt]{chapter}
\renewcommand\chapterformat{%
  \hrule height 3pt\vspace{3pt}\hrule height 1pt\vspace{5pt}%
  \mbox{\strut\MakeUppercase{\lsstyle% Upper case sequences should be spaced
      \chapapp\nobreakspace\thechapter}}%
  \hrule height 1pt%
}

\usepackage{blindtext}% dummy text
\begin{document}
\tableofcontents
\part{Part title}
\blinddocument
\end{document}

ここに画像の説明を入力してください ここに画像の説明を入力してください


inner skipこのオプションはKOMA-Scriptバージョン3.17で導入されたことに注意してください。バージョン 3.15 または 3.16(MiKTeXおよびTeX Live 2014の現在のバージョン)

\renewcommand\partheadmidvskip{\vspace{10pt}}

そして

\renewcommand\chapterheadmidvskip{\vspace{12pt}}

代わりに。これはバージョン 3.17 以降でも機能します。

コード:

\documentclass{scrbook}[2015/01/01]
\usepackage{microtype}
% modify part
\setkomafont{part}{\normalfont\bfseries\huge}
\setkomafont{partnumber}{\normalfont\bfseries\Huge}
\renewcommand\partheadmidvskip{\vspace{10pt}}
\renewcommand\partformat{%
  \strut\MakeUppercase{\lsstyle% Upper case sequences should be spaced
    \partname~\thepart}%
  \vspace{5pt}\hrule height 3pt%
}
% modify chapter
\KOMAoptions{chapterprefix}
\renewcommand\raggedchapter{\centering}
\setkomafont{chapter}{\normalfont\bfseries\LARGE}
\setkomafont{chapterprefix}{\huge}
\RedeclareSectionCommand[beforeskip=0pt,afterskip=40pt]{chapter}
\renewcommand\chapterheadmidvskip{\vspace{12pt}}
\renewcommand\chapterformat{%
  \hrule height 3pt\vspace{3pt}\hrule height 1pt\vspace{5pt}%
  \mbox{\strut\MakeUppercase{\lsstyle% Upper case sequences should be spaced
      \chapapp\nobreakspace\thechapter}}%
  \hrule height 1pt%
}

\usepackage{blindtext}% dummy text
\begin{document}
\tableofcontents
\part{Part title}
\blinddocument
\end{document}


\documentclass{scrbook}
\usepackage{microtype}
% modify part
\setkomafont{part}{\normalfont\bfseries\huge}
\setkomafont{partnumber}{\normalfont\bfseries\Huge}
\renewcommand\partheadmidvskip{\vspace{10pt}}
\renewcommand\partformat{%
  \strut\MakeUppercase{\lsstyle% Upper case sequences should be spaced
    \partname~\thepart}%
  \vspace{5pt}\hrule height 3pt%
}
% modify chapter
\KOMAoptions{chapterprefix}
\renewcommand\raggedchapter{\centering}
\setkomafont{chapter}{\normalfont\bfseries\LARGE}
\setkomafont{chapterprefix}{\huge}
\RedeclareSectionCommand[beforeskip=0pt,afterskip=40pt]{chapter}
\renewcommand\chapterheadmidvskip{\vspace{12pt}}
\renewcommand\chapterformat{%
  \hrule height 3pt\vspace{3pt}\hrule height 1pt\vspace{5pt}%
  \mbox{\strut\MakeUppercase{\lsstyle% Upper case sequences should be spaced
      \chapapp\nobreakspace\thechapter}}%
  \hrule height 1pt%
}

\usepackage{blindtext}% dummy text
\begin{document}
\tableofcontents
\part{Part title}
\blinddocument
\end{document}

答え2

私の知る限り、KOMA スクリプト\RedeclareSectionCommandには と同様のインターフェースを提供する がありますtitlesec。マニュアルの第 21 章を参照してください。

関連情報