这个问题是建立解决方案在这里找到。我正在尝试更改章节名称的颜色(改为青色)和字体大小(20pt 和粗体)。我尝试更改以下行:
\titleformat{\chapter}[display] {\normalfont\huge\bfseries}{}{0pt}{\Huge#1}[\leavevmode\thispagestyle{fancy}] \titlespacing*{\chapter} {0pt}{20pt}{40pt}
但这并没有什么效果。
你能帮我更改章节名称的字体吗?
以下是代码:
\documentclass[11pt,a4paper]{book}
\usepackage{calc}
\usepackage[left=1.5cm, right=1.5cm, bindingoffset=1.5cm, headheight=120pt, top={120pt+10mm}]{geometry}
\usepackage{fancyhdr}
\usepackage[explicit,calcwidth]{titlesec}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage{fourier}
\usepackage{xcolor}
\definecolor{gmitblue}{RGB}{93,138,168}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{line}{RGB}{70,160,216}
\usetikzlibrary{calc}
\renewcommand{\headrulewidth}{0pt}
\newcommand\hdheight{1in}
\newcommand\ftheight{.5in}
\newcommand\SectionFont{\usefont{T1}{qhv}{b}{n}\selectfont}
\titleformat{\section}
{\normalfont\SectionFont\color{myblueii}}
{\tikz[baseline=(a.base), overlay]{
\node[fill=mybluei, anchor=south west, outer sep=0, draw=none, inner sep=.5mm,
text=white,font=\Large, text width=1.5cm, align=center, minimum height=8.5mm,
label={[text=myblueii]right:#1}
] (a) {\thesection};
\foreach \x in {.25,.5,.75}{%
\draw[mybluei, ultra thick] (a) ($(a.south west)!\x!(a.north west)$) --++ (-4,0);
}
\draw[myblueii, ultra thick] ($(a.south east)!.25!(a.north east)$) --++ (\textwidth-1.6cm,0);
}
}
{1em}
{}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[O]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-\hdheight)$);
\draw[line] ([yshift=-\hdheight]current page.north west) -- ([yshift=-\hdheight]current page.north east);
\ifnum\value{chapter}=0
\node[anchor=south west, text width=11.5cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] at ($(current page.north west)+(.5\hdheight,-\hdheight)$) {\raggedleft\rightmark};
\else
\node[anchor=south west, text width=2cm, text=white, font=\fontsize{2cm}{1.5cm}\selectfont\bfseries] (oddpagenum) at ($(current page.north west)+(.5\hdheight,-\hdheight)$) {\thechapter};
\node[anchor=south west, text width=11.5cm, text=white, font=\fontsize{.5cm}{1.5cm}\selectfont\bfseries] (chapter) at (oddpagenum.south east) {\quad TOPIC TO BE DISCUSSED};
\fi
\node[anchor=north east, inner xsep=5mm] at (current page.north east) {\includegraphics[height=120pt]{example-image-a}};
\end{tikzpicture}%
}
\fancyhead[E]{%
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.north west) rectangle ($(current page.north east)+(0,-\hdheight)$);
\draw[line] ([yshift=-\hdheight]current page.north west) -- ([yshift=-\hdheight]current page.north east);
\node[anchor=south east, text width=7cm, text=white, font=\fontsize{.7cm}{1.5cm}\selectfont\bfseries] (evenpagenum) at ($(current page.north east)+(-.5\hdheight,-\hdheight)$) {\raggedleft\rightmark};
\node[anchor=north west, inner xsep=5mm] at (current page.north west) {\includegraphics[height=120pt]{example-image-b}};
\end{tikzpicture}%
}
\fancyfoot[CE]{
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
\node[anchor=south west, text=white, font=\Large\bfseries, minimum size=.5in] at (current page.south west) {\thepage};
\node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
\node[anchor=south east, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south east) {\today};
\end{tikzpicture}%
}
\fancyfoot[CO]{
\begin{tikzpicture}[overlay, remember picture]%
\fill[gmitblue] (current page.south west) rectangle ($(current page.south east)+(0,.5in)$);
\node[anchor=south west, text=white, font=\large, minimum size=.5in, inner xsep=5mm] at (current page.south west) {\today};
\node[anchor=south, text=white, font=\large, minimum size=.5in] at (current page.south) {\leftmark};
\node[anchor=south east, text=white, font=\Large\bfseries, minimum size=.5in] at (current page.south east) {\thepage};
\end{tikzpicture}%
}
\title{A reasonably long title}
\date{\today}
\author{The author}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge#1}
\titlespacing*{\chapter} {0pt}{20pt}{40pt}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{}{0pt}{\Huge#1}[\leavevmode\thispagestyle{fancy}]
\titlespacing*{\chapter} {0pt}{20pt}{40pt}
\begin{document}
\maketitle
\tableofcontents
\listoffigures
\chapter{Problem 1}
\section{Problem 1}
\lipsum[1]
\section{Solution 1}
\lipsum
\lipsum
\chapter{Problem 2}
\section{Problem 2}
\lipsum[1]
\section{Solution 2}
\lipsum[1-5]
\appendix
\chapter{Appendix A}
\lipsum[1-5]
\end{document}
答案1
在11pt
文档类别选项下book
,\huge
定义为
\newcommand\huge{\@setfontsize\huge\@xxpt{25}}
将字体大小设置为\@xxpt
,或20.47pt
;参见点(pt)字体大小是\Large
多少?
此外,由于您使用的explicit
是titlesec
,字体的放置和颜色相关的变化最好与论点一起#1
作为以下的一部分\titleformat
:
\titleformat{\chapter}[display]
{}{}{0pt}{\normalfont\color{cyan}\huge\bfseries#1}[\leavevmode\thispagestyle{fancy}]