章节样式

章节样式

我正在写一篇论文,想让新章节的开始页面看起来比现在更漂亮。

我喜欢此页面上的示例:我如何创建这样的章节标题?

但是,由于摘要是在序言中定义的,因此摘要在每一章中都是一样的。显然,不同的章节需要不同的摘要,我不知道如何纠正这个问题?

其次,由于某种原因,本序言的内容改变了我文档其余部分的字体样式,而我希望我所写的大部分内容(章节标题和摘要之外)保留 LaTeX 使用的标准字体。

谢谢你的帮助。

答案1

这是我在上述页面中之前的解决方案的改进解决方案。现在您必须\chapterabstract[some text]在每个chapter命令之前声明一个以获取摘要:

\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{cabin}
\usepackage[nomarginpar]{geometry}
\usepackage{microtype}
\usepackage{lettrine}
\renewcommand{\LettrineFontHook}{\color{TFFrameColor}}
\renewcommand\LettrineTextFont{\color{TFFrameColor}\scshape}

\usepackage[x11names]{xcolor}
\newcommand*\ftsize[1]{\fontsize{#1pt}{\numexpr 1.2*#1\relax pt}\selectfont}
\usepackage{colortbl}
\usepackage{framed}
\colorlet{TFFrameColor}{DodgerBlue3}
\renewenvironment{leftbar}{%
\def\FrameCommand{{\color{TFFrameColor}\vrule width 3pt} \hspace{12pt}}%
\MakeFramed {\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}
\usepackage[explicit,newlinetospace, clearempty]{titlesec}%
\usepackage{xparse}
\DeclareDocumentCommand{\chapterabstract}{o}{\IfNoValueTF{#1}{\relax}{\def\chapterabstracttext{\textit{Chapter abstract: }#1}}}%

\chapterabstract[ In former days -- that is to say, once upon a time, there lived in the Land of Gramblamble, Seven Families. They lived by the side of the great Lake Pipple-popple (one of the Seven Families, indeed, lived in the Lake), and on the outskirts of the City of Tosh, which, excepting when it was quite dark, they could see plainly. The names of all these places you have probably heard of, and you have only not to look in your Geography books to find out all about them.]

\titleformat{\chapter}[hang]{\usefont{T1}{phv}{m}{n}}{%
\parbox[t]{\dimexpr0.12\linewidth-20pt\relax}{\fontsize{48}{48}\selectfont\raisebox{-1.25\height}{\color{TFFrameColor}\thechapter}}}
{1em}%
{\begin{minipage}[t]{0.9\linewidth}\begin{leftbar}{\bfseries\fontsize{24}{30}\selectfont\color{TFFrameColor}
\rule{0pt}{2ex}\strut#1\hfil\vskip2ex\break}\chapterabstracttext\rule[-1.5ex]{0pt}{1.5ex}\end{leftbar}\end{minipage}
\gdef\chapterabstracttext{}}
\titlespacing{\chapter}{0pt}{2\baselineskip}{6\baselineskip}

\begin{document}%


\chapter {Introductory}%

\lettrine[lines = 2,loversize =0.1]{I}{n} former days -- that is to say, once upon a time, there lived in the Land of Gramblamble, Seven Families. They lived by the side of the great Lake Pipple-popple (one of the Seven Families, indeed, lived in the Lake), and on the outskirts of the City of Tosh, which, excepting when it was quite dark, they could see plainly. The names of all these places you have probably heard of, and you have only not to look in your Geography books to find out all about them.

Now the Seven Families who lived on the borders of the great Lake Pipple-popple, were as follows in the next Chapter.

%%%%
%
\chapterabstract[%
  There was a Family of Two old Parrots and Seven young Parrots.\endgraf
  There was a Family of Two old Storks and Seven young Storks.\endgraf
  There was a Family of Two old Geese, and Seven young Geese.\endgraf
  There was a Family of Two old Owls, and Seven young Owls.\endgraf
  There was a Family of Two Old Guinea Pigs and Seven young Guinea Pigs.\endgraf
  There was a Family of Two old Cats and Seven young Cats.\endgraf
  And there was a Family of Two old Fishes and Seven young Fishes.
]

\chapter{The Seven Families}

\lettrine{O}{ne} day all the Seven Fathers and the Seven Mothers of the Seven Families agreed that they would send their children out to see the world.

So they called them all together, and gave them each eight shillings and some good advice, some chocolate drops, and a small green morocco pocket-book to set down their expenses in.

They then particularly entreated them not to quarrel, and all the parents sent off their children with a parting injunction.

\chapter{The Habits of the\\ Seven Families}

\lettrine{T}{he} Parrots lived upon the Soffsky-Poffsky trees, -- which were beautiful to behold, and covered with blue leaves, -- and they fed upon fruit, artichokes, and striped beetles.

The Storks walked in and out of the Lake Pipple-popple, and ate frogs for breakfast and buttered toast for tea, but on account of the extreme length of their legs, they could not sit down, and so they walked about continually.

\end{document} 

在此处输入图片描述 在此处输入图片描述

在此处输入图片描述

相关内容