我正在努力开发能够反映公司当前需求的自定义报告类。目标是鼓励人们使用 LaTeX 作为报告技术内容的主要工具。我想尽可能降低入门门槛。这就是为什么处理所有格式的类似乎是个好主意。我快完成了,但需要您的支持来解决与每个附录的自定义封面相关的问题。使用当前代码我实现了以下目标:
我知道这看起来很像主文档的封面但是......无论如何。
我的课:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myreport}[2018/08/29 My report LaTeX class]
\DeclareOption{twocolumn}{\OptionNotUsed}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions\relax
\LoadClass[onecolumn, 10pt]{report}
\RequirePackage[a4paper, left=2.5cm,right=2.5cm,top=2cm,bottom=3.5cm]{geometry}
\RequirePackage[toc, title]{appendix}
\RequirePackage{xpatch}
\RequirePackage{etoc}
\RequirePackage{lastpage}
\RequirePackage{fancyhdr}
\RequirePackage{xcolor}
%*********************************************************
% CUSTOM COLORS
%*********************************************************
\definecolor{MyBlue}{RGB}{0,65,101}
%*********************************************************
% SECTION REDEFINITION
%*********************************************************
\renewcommand\chapter{\@startsection {chapter}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries\color{MyBlue}}}
\renewcommand\section{\@startsection {section}{2}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\large\bfseries\color{MyBlue}}}
\renewcommand\subsection{\@startsection{subsection}{3}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries\color{MyBlue}}}
\renewcommand\subsubsection{\@startsection{subsubsection}{4}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\bfseries\color{MyBlue}}}
\renewcommand\paragraph{\@startsection{paragraph}{5}{\z@}%
{3.25ex \@plus1ex \@minus.2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{6}{\parindent}%
{3.25ex \@plus1ex \@minus .2ex}%
{-1em}%
{\normalfont\normalsize\bfseries}}
%*********************************************************
% COUNTERS FOR FIGURES AND TABLES INCLUDE SECTION NUMBER
%*********************************************************
\setcounter{secnumdepth}{4} %depth for numbering
\counterwithin{figure}{chapter}
\counterwithin{table}{chapter}
%*********************************************************
% CUSTOM APPENDIX
%*********************************************************
\renewcommand\appendixname{Appendix}
\renewcommand\appendixtocname{Appendices}
\renewcommand\appendixpagename{Appendix}
%redefinition of appendices environment from 'appendix' package
%this set up ToC depth
\let\oldappendices\appendices
\def\appendices{\oldappendices\etocdepthtag.toc{mtappendix}\etocsettagdepth{mtchapter}{none}\etocsettagdepth{mtappendix}{subsection}}
%*********************************************************
% TITLE PAGE
%*********************************************************
\renewcommand*{\maketitle}{%
\thispagestyle{empty}
\begin{center}
\bfseries
\huge Main Title Of The Document
\vskip.5in
\LARGE Task title
\vskip.2in
\vskip.2in
\LARGE Rev no
\vspace{10cm}
\end{center}
\newpage
}
%*********************************************************
% HEADER AND FOOTER STYLE
%*********************************************************
\pagestyle{fancy}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt} % no line in header area
\fancyfoot{} % clear all footer fields
\renewcommand{\footrule}{{\color{MyBlue}\vskip-\footruleskip\vskip-\footrulewidth \hrule width\headwidth height \footrulewidth\vskip\footruleskip}}
\renewcommand{\footrulewidth}{3pt}
\renewcommand\thefootnote{\textcolor{red}{\arabic{footnote}}}
\fancyfoot[RE,LO]{\footnotesize \textcolor{MyBlue} {\vskip.3cm TaskNo XXX \ - Rev.XXX}} % other info in "inner" position of footer line
\fancyfoot[LE,RO]{\footnotesize \textcolor{MyBlue} {\vskip.3cm Page \thepage\ of \pageref{LastPage}}} % page number in "outer" position of footer line
使用上述类的示例报告:
\documentclass[a4paper, 10pt]{myreport}
\begin{document}
\maketitle %creates custom cover page
\tableofcontents %creates main table of content
\newpage %start first chapter from new page
%************************** INPUT DOCUMENT CONTENT **************************************
%******************************************************************************************
\chapter{Introduction}
Some text in main document.
%************************** APPENDICIES *************************************************
%******************************************************************************************
\begin{appendices}
\chapter{Additional information}
\localtableofcontents
\section{Section 1}
Some text
\section{Section 2}
Some text
\end{appendices}
\end{document}
这是简化版本,但我相信足以说明情况。
显然,在寻求您的帮助之前,我曾尝试自己做,但我在这里,所以结果是众所周知的:)
这似乎是类似的主题,但我无法让它为我工作。我很感激您的评论。谢谢!