我正在写一本关于 Latex 的书,我发现书中的章节标题样式很有趣,但我找不到任何能提供我研究内容的软件包或代码。
编辑:这是我尝试的代码:
\documentclass[a4paper,12pt,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel} % If you write in French
\usepackage{lipsum}
\usepackage{times}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{amssymb,amsmath,bbm}
\usepackage{mathtools}
\usepackage[a4paper]{geometry}
\definecolor{MyGrey}{RGB}{160,160,160}
\newcommand{\HUGE}{\fontsize{40}{36}\selectfont}
%%% HEADERS and FOOTERS %%%
\renewcommand{\baselinestretch}{1.05}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[LE]{\textbf{\thepage} {\color{MyGrey}$\: \blacktriangleright \:$} \nouppercase{\leftmark}}
\fancyhead[RO]{\nouppercase{\rightmark} {\color{MyGrey}$\: \blacktriangleleft \:$} \textbf{\thepage}}
\setlength{\headheight}{20pt}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\emph{ #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection \emph{ #1}}{}}
\let\headruleORIG\headrule
\renewcommand{\headrule}{\color{black} \headruleORIG}
%\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{
\fancyhead{}
\fancyfoot[C]{\textbf{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\makeatletter
\def\@textbottom{\vskip \z@ \@plus 1pt}
\let\@texttop\relax
\makeatother
% % Clear Header Style on the Last Empty Odd pages
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
\hbox{}%
\thispagestyle{empty}% % Empty header styles
\newpage%
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
%%% CUSTOM CHAPTER FORMAT %%%
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont}
{\filcenter\large\MakeUppercase{\chaptertitlename}\\[4ex] \HUGE\thechapter}{4ex}
{\filcenter\Huge\uppercase}
\titlespacing*{\chapter}{0pt}{-50pt}{30pt}[0pt]
\begin{document}
\chapter[Introduction and overview of electrode processes]{Introduction\\and overview\\of electrode\\processes}
%
\section{Introduction}
Electrochemistry is the branch of chemistry concerned with the interrelation of electrical and chemical effects. A large part of this field deals with the study of chemical changes caused by the passage of an electric current and the production of electrical energy by chemical reactions. In fact, the field of electrochemistry encompasses a huge array of different phenomena (e.g., electrophoresis and corrosion), devices (electrochromic displays, electro analytical sensors, batteries, and fuel cells), and technologies (the electroplating of metals and the large-scale production of aluminum and chlorine). While the basic principles of electrochemistry discussed in this text apply to all of these, the main emphasis here is on the application of electrochemical methods to the study of chemical systems.
\lipsum[1-10]
\end{document}
我不知道如何在“CHAPTER”名称下方创建灰色三角形,以及如何增加“CHAPTER”一词字母之间的间距。我也想拥有相同的部分格式...
这是我的尝试:
所以,如果有人能帮助我,那就太好了!
答案1
这是根据您的示例构建的解决方案,使用 制作titlesec
。它还使用该microtype
包在“CHAPTER”的字母之间添加空格。
\documentclass[a4paper,12pt,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel} % If you write in French
\usepackage{lipsum}
\usepackage{times}
\usepackage{xcolor}
\usepackage{amsthm}
\usepackage{amssymb,amsmath,bbm}
\usepackage{mathtools}
\usepackage[a4paper]{geometry}
\usepackage[letterspace=200]{microtype}
\definecolor{MyGrey}{RGB}{160,160,160}
\definecolor{OtherGrey}{RGB}{200,200,200}
\newcommand{\greytriangleright}{{\color{MyGrey}$\blacktriangleright$}}
\newcommand{\greytriangleleft}{{\color{MyGrey}$\blacktriangleleft$}}
\newcommand{\greytriangledown}{{\color{OtherGrey}$\blacktriangledown$}}
\newcommand{\HUGE}{\fontsize{40}{36}\selectfont}
%%% HEADERS and FOOTERS %%%
\renewcommand{\baselinestretch}{1.05}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[LE]{\textbf{\thepage} \:\greytriangleright\: \nouppercase{\leftmark}}
\fancyhead[RO]{\nouppercase{\rightmark} \:\greytriangleleft\: \textbf{\thepage}}
\setlength{\headheight}{20pt}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\emph{ #1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection \emph{ #1}}{}}
\let\headruleORIG\headrule
\renewcommand{\headrule}{\color{black} \headruleORIG}
%\renewcommand{\headrulewidth}{1pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{
\fancyhead{}
\fancyfoot[C]{\textbf{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
%%% CUSTOM CHAPTER FORMAT %%%
\newlength{\trianglewidth}
\newlength{\triangleheight}
\settowidth{\trianglewidth}{\greytriangledown}
\settoheight{\triangleheight}{\greytriangledown}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont}
{\filcenter\resizebox{6\trianglewidth}{6\triangleheight}{\greytriangledown}\\[-6ex]%
\filcenter\MakeUppercase{\lsstyle\bfseries\chaptertitlename}\\[4ex]%
\HUGE\thechapter}
{4ex}
{\filcenter\Huge\scshape\uppercase}
\titlespacing*{\chapter}{0pt}{-50pt}{30pt}[0pt]
\titleformat{\section}{\large\uppercase}{\hspace{-.5em}\llap{\greytriangleright\enspace\thesection}}{.5em}{}
\begin{document}
\chapter[Introduction and overview of electrode processes]{Introduction\\and overview\\of electrode\\processes}
%
\section{Introduction}
Electrochemistry is the branch of chemistry concerned with the interrelation of electrical and chemical effects. A large part of this field deals with the study of chemical changes caused by the passage of an electric current and the production of electrical energy by chemical reactions. In fact, the field of electrochemistry encompasses a huge array of different phenomena (e.g., electrophoresis and corrosion), devices (electrochromic displays, electro analytical sensors, batteries, and fuel cells), and technologies (the electroplating of metals and the large-scale production of aluminum and chlorine). While the basic principles of electrochemistry discussed in this text apply to all of these, the main emphasis here is on the application of electrochemical methods to the study of chemical systems.
\lipsum[1-10]
\end{document}
答案2
看看memoir
,它处理了各种各样的章节样式,你可以调整它们,或者建立自己的样式。看看 Madsen 的“回忆录类的各种章节风格”作为示例(包含完整代码)。