Cómo convertir código titlesec a código scrlayer-scrpage

Cómo convertir código titlesec a código scrlayer-scrpage

En mi código LaTeX utilizo la versión real del paquete KOMA-script y su scrbook de clase de documento. En este sentido, me pregunto cómo convertir código que usa el paquete titlesec a código que debería usar el paquete scrlayer-scrpage, más compatible con KOMA-script. Por favor, encuentre el código relevante a continuación. ¡Estaría muy agradecido si alguien pudiera ayudarme!

\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}

Respuesta1

He aquí una sugerencia que necesitaKOMA-Script versión 3.17(la versión actual en CTAN) o más reciente:

\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}

ingrese la descripción de la imagen aquí ingrese la descripción de la imagen aquí


Tenga en cuenta que la inner skipopción se introdujo en la versión 3.17 de KOMA-Script. Entonces conversión 3.15 o 3.16(versión actual en MiKTeX y TeX Live 2014) tienes que usar

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

y

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

en cambio. Esto también funciona con la versión 3.17 o posterior.

Código:

\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}

Respuesta2

AFAIK, KOMA-script tiene un \RedeclareSectionCommandque proporciona una interfaz similar a titlesec. Consultar el manual, capítulo 21.

información relacionada