我怎样才能将所有\addchap{ }
(章节)的字体更改为“Times”字体及其大小(最好\large
和大胆的)?
图表列表、表格列表和目录也应具有如上所述的相同结构。
这是我的代码示例。(如果您需要更多代码,请告诉我,我可能遗漏了一些东西)。
\documentclass[12pt,chapterprefix]{scrreprt} % for bigger size of text
\usepackage{times}
\usepackage[english]{babel}
\renewcaptionname{english}{\listfigurename}{Figures}
\renewcaptionname{english}{\listtablename}{Tables}
\begin{center}
\listoftables
\end{center}
\begin{center}
\listoffigures
\end{center}
\renewcommand{\figurename}{Figure}
\renewcommand{\listtablename}{Tables}
\usepackage{titlesec}
\titleformat{\section}[block]{ \Large \filcenter}{}{1em}{}%\sffamily
\titleformat{\subsection}[hang]{\filright \itshape }{}{1em}{}
%\titleformat{\chapter}[hang]{\filright \bfseries }{}{1em}{} <- if that code is used, yes the size changes, but my "Chapter [Number]" (see picture) disappears on the page itself but not in the toc.
\begin{center}
\tableofcontents\thispagestyle{empty}
\end{center
%chapter in toc and on page (numbering)
\renewcommand*{\raggedchapter}{\centering}
\renewcommand*{\chaptermarkformat}{\chapappifchapterprefix{\nobreakspace}\thechapter\autodot:\enskip}
\let\originaladdchaptertocentry\addchaptertocentry
\renewcommand*{\addchaptertocentry}[2]{%
\IfArgIsEmpty{#1}
{\originaladdchaptertocentry{#1}{#2}}
{\originaladdchaptertocentry{\chapappifchapterprefix{\nobreakspace}#1\autodot}{#2}}%
}
\RedeclareSectionCommand[
tocentrynumberformat={\def\autodot{:}},
tocdynnumwidth
]{chapter}
\begin{document}
\addchap{Introduction}\setcounter{page}{1} % unnumbered chapter
答案1
由于您使用 KOMA Script 文档类,请参阅 KOMA Script 手册中的“表 3.2:可以更改字体样式的元素”(可在此处找到:https://komascript.de/~mkohm/scrguien.pdf)。
(请注意,该times
包是过时的,我在这个答案中将其更改为newtxtext
,您也可以考虑使用 Stix Two Text。)
您不需要titlesec
您想要的东西,而是添加\setkomafont{chapter}{\rmfamily \large}
到您的序言中:
\documentclass{scrreprt}
\usepackage{newtxtext}
\setkomafont{chapter}{\rmfamily \large}
\usepackage{blindtext}%just to add a sample document
\begin{document}
\blinddocument
\end{document}
如果你想要全部文档标题(章节、节、小节……等)使用衬线字体作为正文,然后您可以使用sfdefaults=false
带有 documentclass 的选项(感谢 Sam Carter 指出此类选项的更改名称):
\documentclass[sfdefaults=false]{scrreprt}
\usepackage{newtxtext}
\addtokomafont{chapter}{\large}
\usepackage{blindtext}%just to add a sample document
\begin{document}
\blinddocument
\end{document}
这两者也将改变表格列表和图表列表标题(它们也是章节)。
(另请注意,更改章节的默认行为将使您重新定义节、小节等,否则它们看起来很奇怪。您确定要更改默认设置吗?)
答案2
这个问题太长了,无法添加更多评论。
警告: 不要将该包titlesec
与 KOMA-Script 类一起使用。
似乎只有章节标题才应该加粗。然后你可以使用
\addtokomafont{disposition}{\mdseries}
请注意,disposition
所有标题元素均使用字体元素,例如chapter
,section
等subsection
。
更改标题元素的字体(如chapter
或已在示例中使用的section) you can use either
\setkomafont and
\addtokomafont or you can add option
font \RedeclareSectionCommand`。to
\RedeclareSectionCommand[
font=\bfseries\large,% does the same as \setkomafont{chapter}{\bfseries\large}
tocentrynumberformat={\def\autodot{:}},
tocdynnumwidth
]{chapter}
您还可以添加选项来更改章节标题前后的垂直空间。请阅读文档以获取更多信息。
章节和小节的设置:
% section
\RedeclareSectionCommand[font=\sffamily\Large]{section}% does the same as \setkomafont{section}{\sffamily\Large}
% subsection
\RedeclareSectionCommand[
%indent=1em,% <- add this if the subsections should be indented
font=\itshape% changes the font, does the same as \setkomafont{subsection}{\itshape}
]{subsection}
要使section
标题居中,但不使标题居中subsection
,subsubsection
请使用
\let\originalsectionlinesformat\sectionlinesformat
\renewcommand\sectionlinesformat[4]{%
\Ifstr{#1}{section}
{\centering #3#4}% centers section headings
{\originalsectionlinesformat{#1}{#2}{#3}{#4}}% original definition for other section levels
}
如果只对章节(和部分)进行编号,请添加
\setcounter{secnumdepth}{\chapternumdepth}
回到序言。
在环境中不要使用\tableofcontents
、\listoffigures
和。它们的标题自动居中。如果 ToC、LoF 和 LoT 中的页面应使用页面样式,请使用\listoftables
center
\renewcommand\raggedchapter{\centering}
empty
% use page style empty in in ToC, LoF and LoT
\AfterTOCHead{\thispagestyle{empty}\pagestyle{empty}}
\AfterStartingTOC{\clearpage}
删除\renewcommand{\figurename}{Figure}
和\renewcommand{\listtablename}{Tables}
。如果你真的想重新定义\figurename
使用
\renewcaptionname{english}{\figurename}{Figure}% Figure is default?
\listtablename
已被 重新定义\renewcaptionname
。
例子:
\documentclass[
12pt,
chapterprefix,
sfdefaults=false% no sans serif headings etc., needs version 3.39 or newer
]{scrreprt} % for bigger size of text
%\providecommand*\Ifstr{\ifstr}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif
\usepackage{blindtext}% only for dummy text
\usepackage{newtxtext}% <- changed
\usepackage[english]{babel}
\setcounter{secnumdepth}{\chapternumdepth}% only parts and chapters should be numbered
\addtokomafont{disposition}{\mdseries}% headings of section, subsection etc. should not be bold
%chapter in toc and on page (numbering)
\RedeclareSectionCommand[
font=\bfseries\large,% does the same as \setkomafont{chapter}{\bfseries\large}
tocentrynumberformat={\def\autodot{:}},
tocdynnumwidth
]{chapter}
\renewcommand\raggedchapter{\centering}% center chapter headings
\renewcommand*{\chaptermarkformat}{\chapappifchapterprefix{\nobreakspace}\thechapter\autodot:\enskip}
\let\originaladdchaptertocentry\addchaptertocentry
\renewcommand*{\addchaptertocentry}[2]{%
\IfArgIsEmpty{#1}
{\originaladdchaptertocentry{#1}{#2}}
{\originaladdchaptertocentry{\chapappifchapterprefix{\nobreakspace}#1\autodot}{#2}}%
}
% section
\RedeclareSectionCommand[font=\sffamily\Large]{section}% does the same as \setkomafont{section}{\sffamily\Large}
% subsection
\RedeclareSectionCommand[
%indent=1em,% <- add this if the subsections should be indented
font=\itshape% changes the font, does the same as \setkomafont{subsection}{\itshape}
]{subsection}
% format headings with style=section, eg. section, subsection and subsubsection
\let\originalsectionlinesformat\sectionlinesformat
\renewcommand\sectionlinesformat[4]{%
\Ifstr{#1}{section}
{\centering #3#4}% centers section headings
{\originalsectionlinesformat{#1}{#2}{#3}{#4}}% original definition for other section levels
}
% use page style empty in in ToC, LoF and LoT
\AfterTOCHead{\thispagestyle{empty}\pagestyle{empty}}
\AfterStartingTOC{\clearpage}
% rename LoF and LoT
\renewcaptionname{english}{\listfigurename}{Figures}
\renewcaptionname{english}{\listtablename}{Tables}
\begin{document}
\pagenumbering{roman}
\tableofcontents
\listoftables
\listoffigures
\cleardoubleoddpage% <- changed
\pagenumbering{arabic}
\addchap{Introduction}
\Blindtext
\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument
\end{document}
运行三次即可获得