TeX - LaTeX Asked by maryam on July 7, 2021
I’m using scrreprt
for my class notes and changed the page layout to my likings. However firstly I would like to change the font of my page header to mdseries
to match the chapter prefix.
I’m also using the option headsepline
, but want to remove the line between "Chapter prefix" and "Chapter name".
Any help would be appreciated.
M W E:
documentclass[
numbers=endperiod,
toc=chapterentrydotfill,
DIV=12
]
{scrreprt}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{csquotes}
usepackage{lmodern}
usepackage{microtype}
usepackage[
automark,
autooneside=false,
headsepline=true
]
{scrlayer-scrpage}
pagestyle{scrheadings}
cohead{Ifthispageodd{rightmark}{leftmark}}
cfoot*{pagemark}
usepackage{textcomp}
letraggedchaptercentering
setkomafont{chapterprefix}{normalsizemdseries}
KOMAoption{chapterprefix}{true}
renewcommand{chapterheadmidvskip}{%
parnobreakvskip -.1cm {rule{textwidth}{.5pt}}par%
}
RedeclareSectionCommand[beforeskip=0pt,afterskip=15pt]{chapter}
usepackage{xpatch}
tracingpatches
xpatchcmd{@@makeschapterhead}{%for the unnumbered
usekomafont{chapter}{#1}par
}{%
usekomafont{chapter}{MakeUppercase{#1}}par
}{}{}
xpatchcmd{@@makechapterhead}{%for numbered
usekomafont{chapter}{#1}par
}{%
usekomafont{chapter}{MakeUppercase{#1}}par
}{}{}
renewcommand*{chapterformat}{%
mbox{hugeMakeUppercase{chapappifchapterprefix{nobreakspace}}thechapterautodot
IfUsePrefixLine{}{enskip}}%
}
renewcommand{abstract}[1]{%
textbf{Abstract.} #1par%
}
usepackage{lipsum}
begin{document}
tableofcontents
thispagestyle{empty}
setcounter{page}{0}
chapter{The Chapter Numbered One}
abstract{lipsum[3]}
section{The Section Which Comes First}
lipsum
subsection{First Subsection}
lipsum
end{document}
If there should be no line between chapter prefix and chapter name, remove the redefinition of chapterheadmidvskip
. (Off topic: chapterheadmidvskip
should not be used to insert such a line.) The vertical space between chapter prefix and chapter name can be adjusted by option innerskip
, eg.:
RedeclareSectionCommand[beforeskip=0pt,afterskip=15pt,innerskip=7.5pt]{chapter}
If chapter prefix and chapter name should be uppercase, redefine chapterlineswithprefixformat
:
renewcommand*{chapterlineswithprefixformat}[3]{%
Ifstr{#1}{chapter}
{MakeUppercase{#2#3}}
{#2#3}%
}
If chapter prefix should be huge
use
setkomafont{chapterprefix}{mdserieshuge}
If the page header should be upshape use either addtokomafont{pagehead}{upshape}
or addtokomafont{pageheadfoot}{upshape}
.
documentclass[
numbers=endperiod,
toc=chapterentrydotfill,
DIV=12
]{scrreprt}
usepackage{lipsum}% only for dummy text
usepackage[T1]{fontenc}
%usepackage[utf8]{inputenc}% only needed with outdated TeX distributions
usepackage{csquotes}
usepackage{lmodern}
usepackage{microtype}
usepackage{textcomp}
usepackage[
automark,
autooneside=false,
headsepline=true
]{scrlayer-scrpage}% sets page style scrheadinges automatically
clearpairofpagestyles
chead{ifoddvalue{page}rightmarkelseleftmarkfi}
cfoot*{pagemark}
addtokomafont{pageheadfoot}{upshape}
letraggedchaptercentering
setkomafont{chapterprefix}{mdserieshuge}
KOMAoption{chapterprefix}{true}
RedeclareSectionCommand[beforeskip=0pt,afterskip=15pt,innerskip=7.5pt]{chapter}
renewcommand*{chapterlineswithprefixformat}[3]{%
Ifstr{#1}{chapter}
{MakeUppercase{#2#3}}
{#2#3}%
}
renewcommand{abstract}[1]{%
textbf{Abstract.} #1par%
}
BeforeStartingTOC[toc]{thispagestyle{empty}pagestyle{empty}}
AfterStartingTOC[toc]{clearpage}
begin{document}
pagenumbering{roman}
tableofcontents
cleardoubleoddpage
pagenumbering{arabic}
chapter{The Chapter Numbered One}
abstract{lipsum[3]}
section{The Section Which Comes First}
lipsum
subsection{First Subsection}
lipsum
end{document}
Correct answer by esdd on July 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP