我正在写一份很长的信函文件,我想在其中添加一个摘要和几个章节。可以这样做吗?这是我的序言:
\documentclass[boldsubject,italicsignature,smartindent]{letteracdp}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{layaureo}
\usepackage{lipsum}
答案1
自从letteracdp
没有定义\chapter
,你可以从以下任一位置复制所需的定义book.cls
或者report.cls
几乎一字不差。因此,将以下内容添加到你的序言中:
\makeatletter
\newcounter{chapter}
\newcommand\chaptername{Chapter}
\newcommand\@chapapp{\chaptername}
\let\chaptermark\@gobble% Or define it otherwise
\newcommand\chapter{\clearpage
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@schapter#1{\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
\@makeschapterhead{#1}%
\@afterheading
\fi}
\def\@makeschapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
如果您\section
也想要(以及其他人),可以从上述类别中提取适当的内容。
这是一个完整的最小示例:
\documentclass{letteracdp}% ftp://tug.org/texlive/Contents/live/texmf-dist/tex/latex/cdpbundl/letteracdp.cls
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\makeatletter
\newcounter{chapter}
\newcommand\chaptername{Chapter}
\newcommand\@chapapp{\chaptername}
\let\chaptermark\@gobble% Or define it otherwise
\newcommand\chapter{\clearpage
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@schapter#1{\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
\@makeschapterhead{#1}%
\@afterheading
\fi}
\def\@makeschapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\lipsum[1]
\chapter{A chapter}
\lipsum[2]
\end{document}
答案2
这CDP 捆绑包,其中letteracdp
文档类只是组件之一(尽管是主要组件),还提供了articoletteracdp
文档类,它允许您使用一些分段命令,即\section
和\paragraph
。这是一个最小的例子:
\documentclass
[twoside,boldsubject,italicsignature,shortindent]
{articoletteracdp}
\usepackage[T1]{fontenc}
% The following is just to demonstrate that bookmarks also work correctly:
\usepackage[bookmarksnumbered]{hyperref}
\address{
Gustavo \textsc{Mezzetti}\\
L.S.U. <<A.~di~Savoia Duca d'Aosta>>\\
Via del Santo, 57\\
I--35123\quad Padova\quad Italy
}
\signature{Gustavo}
\place{Padova}
\begin{document}
\begin{letter}
[Chiunque sia interessato]
{A chiunque sia interessato\\(\emph{To whom it may concern})}
[Comandi di sezionamento.\\(\emph{Sectioning commands.})]
\opening{Cari tutti (\emph{dear all}),}
il resto di questa lettera \`{e} scritto solo in inglese. The rest of this
letter is written only in English. Directly after the \verb|\opening| command
you normally place a short preamble that does not logically belong to any
section, like this.
\tableofcontents
\listoffigures
% \listoftables also works
\section{The first section}
\label{S:First}
This is the first section.
\begin{figure}[htbp]
\centering
Put figure contents here.
\caption{A figure}
\label{fig:?}
\end{figure}
This is a reference to fig.~\ref{fig:?}.
\section{The second section}
\label{S:Second}
This section also contains paragraphs, the first one of which is
Paragraph~\ref{P:Foo}.
\paragraph{A nifty paragraph}
\label{P:Foo}
Notice that the period at the end of the paragraph title is inserted
automatically (but see Paragraph~\ref{P:Bar}).
\paragraph{Does this always happen?}
\label{P:Bar}
No, not always: if you already supply a punctuation mark at the end of title,
another one isn't inserted.
This paragraph still belongs to Section~\ref{S:Second}, of course.
\epilogue
The \verb|\epilogue| command introduces some text that does not belong
logically to the last section; it is best to use it even if you have no such
text, just before \verb|\closing|.
\closing*{Best regards.}
\end{letter}
\end{document}
结果如下:
当我编写包时,我认为章节和段落对于信件来说已经足够了:我永远不会想到有人想在信件中包含书籍风格的章节标题!请记住,文档类具有与之关联的特定文档布局,您不应该对此感到不安。文档类提供的分段命令articoletteracdp
经过精心设计,可以与类的总体设计完美契合letteracdp
。