如何改变标题的样式?

如何改变标题的样式?

如何在顶部页眉(当前章节页面或部分所在的位置)下方设置水平线?最后但并非最不重要的是,在偶数页的页眉中,

  1. 章节标题

但我希望它有

第 1 章 章节标题

这可能吗?

我的代码如下:

\documentclass[a4paper,twoside,12pt,chapterprefix=false,listof=totoc,bibliography=totoc]{scrbook}

    \usepackage[english]{babel}
    \usepackage{blindtext}
    \usepackage{amsmath,amssymb,amsthm}
    \usepackage{longtable}
    \usepackage[font={small,sl},hang,labelfont=bf]{caption}
    \usepackage{booktabs}

    \ifpdfoutput{%
        \usepackage{graphicx}
        \usepackage[]{pdfpages}
    }{%
        \usepackage{graphicx}
    }
    \usepackage{rotating}

    \usepackage{scrlayer-scrpage}
    \KOMAoptions{headinclude}

    % **** Defining chapter style start ****

    \usepackage[T1]{fontenc}
    \usepackage{xcolor}
    \usepackage{charter}

    \definecolor{mybluei}{RGB}{28,138,207}
    \definecolor{myblueii}{RGB}{131,197,231}

    \addtokomafont{disposition}{\usefont{T1}{qhv}{b}{n}\selectfont\color{myblueii}}

    \addtokomafont{chapter}{\fontsize{30pt}{30pt}\selectfont}
    \newkomafont{chapternumber}{\fontsize{50}{120}\selectfont\color{white}}
    \newkomafont{chaptername}{\itshape\rmfamily\small\color{white}}
    \addtokomafont{chapterentry}{\normalcolor}% entrys in tableofcontents not blue

    \addtokomafont{section}{\fontsize{14pt}{14pt}\selectfont}
    \newkomafont{sectionnumber}{\fontsize{18pt}{18pt}\selectfont\rmfamily\color{white}}

    \addtokomafont{subsection}{\fontsize{12pt}{12pt}\selectfont}
    \newkomafont{subsectionnumber}{\fontsize{16pt}{16pt}\selectfont\rmfamily\color{white}}

    \setcounter{secnumdepth}{\subsectionnumdepth}% subsubsection and lower unnumbered

    \renewcommand\chapterformat{%
      \raisebox{-6pt}{\colorbox{mybluei}{%
          \parbox[b][60pt]{45pt}{\centering%
            {\usekomafont{chaptername}{\chaptername}}%
            \vfill{\usekomafont{chapternumber}{\thechapter\autodot}}%
            \vspace{6pt}%
          }}}\enskip}

    \renewcommand\sectionformat{%
      \setlength\fboxsep{5pt}%
      \colorbox{mybluei}{%
          \parbox{40pt}{\centering\usekomafont{sectionnumber}{\thesection\autodot}}}%
        \quad%
      }

    \renewcommand\subsectionformat{%
      \setlength\fboxsep{5pt}%
      \colorbox{mybluei}{%
        \parbox{60pt}{\centering\usekomafont{subsectionnumber}{\thesubsection\autodot}}}%
    \quad%
    }

    \makeatletter
    \renewcommand\sectionlinesformat[4]{%
      \@hangfrom{\hspace*{#2}#3}{#4}%
      \ifstr{#1}{section}{%
        \par\nobreak\vspace*{-\parskip}% <- changed
        \ifstr{#3}{}{%
          \rule[\dp\strutbox]{\textwidth}{1pt}}{%
          \hspace*{50pt}\rule[\dp\strutbox]{\dimexpr\textwidth-50pt}{1pt}}%
      }{}%
      \ifstr{#1}{subsection}{%
        \par\nobreak\vspace*{-\parskip}% <- changed
        \ifstr{#3}{}{%
          \rule[\dp\strutbox]{\textwidth}{1pt}}{%
          \hspace*{70pt}\rule[\dp\strutbox]{\dimexpr\textwidth-70pt}{1pt}}%
      }{}%
    }
    \makeatother

    % **** Defining chapter style end ****

    \usepackage{times}
    \usepackage{helvet}
    \usepackage[T1]{fontenc}

    \ifpdfoutput{%
        \usepackage[pdftex,
            bookmarks,
            bookmarksopen=true,
            bookmarksnumbered=true,
            pdfauthor={Rafael Wampfler},
            pdftitle={Engagement Detector: Modelling engagement dynamics in virtual environments},
            pdfsubject={The report of the master thesis about the modelling engagement dynamics in virtual environments.},
            pdfkeywords={machine learning, engagement dynamics, classification, virtual environments, calcularis, learning, minecraft},
            colorlinks=false,
            linkcolor=black,
            citecolor=black,
            filecolor=black,
            urlcolor=black,
            anchorcolor=black,
            menucolor=black,
            breaklinks=true,
            pageanchor=true,
            plainpages=false,
            linkbordercolor=red,
            citebordercolor=red,
            urlbordercolor=red,
            pdfpagelabels=true]{hyperref}
    }{}

    \ifpdfoutput{%
        \pdfcompresslevel=9
        \DeclareGraphicsExtensions{.pdf,.png}
    }{}

    \bibliographystyle{alpha}

    \topmargin -0.5in
    \textheight 9.3in
    \textwidth 6.3in
    \oddsidemargin 0.18in
    \evensidemargin -0.22in
    \parskip 0.1in
    \parindent 0in

    \renewcommand{\arraystretch}{1.5}
    \renewcommand{\baselinestretch}{1}

    \begin{document}

    \hypersetup{pageanchor=false}

    \hypersetup{pageanchor=true}
    \pagenumbering{roman}
    \setcounter{page}{1}

    %\include{abstract}

    %\include{acknowledgment}

    \tableofcontents

    \listoffigures

    \listoftables

    \pagenumbering{arabic}

    % ---- MAIN PART ----

      \chapter{Chapter Title}
      \section{Section Title}
      \blindtext
      \addsec{Unnumbered Section Title}
      \blindtext
      \subsection{Subsection Title}
      \blindtext
      \subsubsection{Subsubsection Title}
      \blindtext
      \blinddocument

    % ---- END MAIN PART ----

    \appendix
    \clearpage

    %\include{appendix}

    \clearpage
    \renewcommand*{\chapterpagestyle}{empty}

    \bibliography{references}

    \end{document}

答案1

要使用页面样式在页面页眉下方获得分隔线,scrheadings请使用选项headsepline

\usepackage[headsepline]{scrlayer-scrpage}

如果章节前缀应该位于页眉中章节标题前应该有一个前缀行,您可以使用选项chapterprefix或以下别名之一twolinechapterchapterwithprefixchapterwithprefixline

据我所知,您不希望章节标题有两行,而前缀在第一行。那么您必须更改页眉中章节号的外观,重新定义\chaptermarkformat

\renewcommand*\chaptermarkformat{\chapapp\ \thechapter\autodot\enskip}

在此处输入图片描述

\documentclass[12pt]{scrbook}

\usepackage[english]{babel}
\usepackage{blindtext}% dummy text

\usepackage[headsepline]{scrlayer-scrpage}
\renewcommand*\chaptermarkformat{\chapapp\ \thechapter\autodot\enskip}

\begin{document}
\blinddocument
\blinddocument
\end{document}

相关内容