我有一个非常基本的问题,基本上是这个旧的。
怎样才能使章节或节标题中的小型大写字母变为粗体?
低于 MWE。
\RequirePackage{fix-cm}
\documentclass[10pt]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern} % To switch to Latin Modern
\rmfamily % To load Latin Modern Roman and enable the following NFSS declarations.
% Declare that Latin Modern Roman (lmr) should take
% its bold (b) and bold extended (bx) weight, and small capital (sc) shape,
% from the corresponding Computer Modern Roman (cmr) font, for the T1 font encoding.
\DeclareFontShape{T1}{lmr}{b}{sc}{<->ssub*cmr/bx/sc}{}
\DeclareFontShape{T1}{lmr}{bx}{sc}{<->ssub*cmr/bx/sc}{}
%
\usepackage{titlesec}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{-21\p@}%
{\parindent \z@ \raggedright \normalfont
\interlinepenalty\@M
\huge\bfseries\sc \thechapter.\quad #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\huge\bfseries\sc}
\title{Title}
\author{Author}
\begin{document}
\maketitle
\tableofcontents
\chapter{Chapter}
\section{Section}
\end{document}
具体来说,我目前正在使用上面链接中用户@Blaisorblade 提供的答案以及 titlesec,但实际上什么也没有发生:正如所注意到的,章节标题是小写字母,但不是粗体,目录条目也是如此。
欢迎任何反馈!
答案1
正如已经说过的在 Will 的回答中对于您链接的问题,您不应该使用\sc
,因为这个弃用的字体命令也会停用以前的\bfseries
。请\scshape
改用:
\RequirePackage{fix-cm}
\documentclass[10pt]{book}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}% Note: Not needed since LaTeX 2018/04/01.
\usepackage[T1]{fontenc}
\usepackage{lmodern} % To switch to Latin Modern
\rmfamily % To load Latin Modern Roman and enable the following NFSS declarations.
% Declare that Latin Modern Roman (lmr) should take
% its bold (b) and bold extended (bx) weight, and small capital (sc) shape,
% from the corresponding Computer Modern Roman (cmr) font, for the T1 font encoding.
\DeclareFontShape{T1}{lmr}{b}{sc}{<->ssub*cmr/bx/sc}{}
\DeclareFontShape{T1}{lmr}{bx}{sc}{<->ssub*cmr/bx/sc}{}
%
\usepackage{titlesec}% Note: Loaded but currently not used.
\makeatletter
\def\@makechapterhead#1{% Note: Instead of redefining \@makechapterhead, you could use the already loaded titlesec.
\vspace*{-21\p@}%
{\parindent \z@ \raggedright \normalfont
\interlinepenalty\@M
\huge\bfseries\scshape \thechapter.\quad #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\usepackage{tocloft}% Note: Instead of using tocloft, you could also redefine \@makeschapterhead similar to your redefinition of \@makechapterhead.
\renewcommand{\cfttoctitlefont}{\huge\bfseries\scshape}
\title{Title}
\author{Author}
\begin{document}
\maketitle
\tableofcontents
\chapter{Chapter}
\section{Section}
\end{document}