如何在LaTeX中扩展article文档类?

如何在LaTeX中扩展article文档类?,latex,customization,Latex,Customization,我真的不需要对默认的article文档类进行太多更改。我想要的是: 重新定义页边距(我希望它们在所有页面上都相同,但不同于默认值) 使用标题页 在标题页上添加更多元素(标题、作者和日期对我来说还不够,我希望公司和公司徽标也在标题页上) 更改节、子节和子节的样式(我不希望显示数字,否则-它们很好) 也许,在这种情况下,有些软件包可能会有所帮助?您可以从 \NeedsTeXFormat{LaTeX2e} \ProvidesClass{classname}[2009/02/24] \LoadCla

我真的不需要对默认的article文档类进行太多更改。我想要的是:

  • 重新定义页边距(我希望它们在所有页面上都相同,但不同于默认值)
  • 使用标题页
  • 在标题页上添加更多元素(标题、作者和日期对我来说还不够,我希望公司和公司徽标也在标题页上)
  • 更改节、子节和子节的样式(我不希望显示数字,否则-它们很好)
也许,在这种情况下,有些软件包可能会有所帮助?

您可以从

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{classname}[2009/02/24]
\LoadClass{article}
然后添加任何自定义项


更新:我建议您阅读LaTeX2e for class and package Writer:。第3节(类或包的结构)中的示例应该很有帮助。

有几点可能很有趣:

  • 通过重置控制长度,如
    \setlength{\textwidth}{6.80in}
    \setlength{\oddsidemargin}{0.0in}
    等,可以重新定义标题中的边距(即在
    \begin{document}
    }之前)

  • \section*{…}
    将为您提供未编号的节。同样,对于
    \subsection*
    \subsection*
    ,如果您确实使用了此技巧,并且还需要工作参考,您可以查看

  • 您看过
    标题页
    环境了吗
但也许最重要的是,在不进行任何类黑客攻击的情况下,可以为您提供所需的所有控制


或者使用。

有许多软件包可以帮助您实现所需的结果。我在下面选择的软件包是我喜欢的,但有多种方法可以实现

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{paulius-article}[2009/02/25 v0.1 Paulius' modified article class]

% Passes and class options to the underlying article class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions

% Load LaTeX's article class with the `titlepage' option so that \maketitle creates a title page, not just a title block
\LoadClass[titlepage]{article}

% Redefine the page margins
% TODO: Adjust margins to your liking
\RequirePackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}

% Remove the numbers from all the headings (\section, \subsection, etc.)
\setcounter{secnumdepth}{-1}

% To modify the heading styles more thoroughly use the titlesec package
%\RequirePackage{titlesec}

% Adjust the title page design
% NOTE: This is the default LaTeX title page -- free free to make it look like whatever you want.
% TODO: Add company name and logo somewhere in here.
\newcommand{\maketitlepage}{%
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
  \@thanks
  \vfil\null%
  \end{titlepage}%
}

% This some before-and-after code that surrounds the title page.  It shouldn't need to be modified.  
% I've pulled out the part the actually typesets the title page and placed it in the \maketitlepage command above.
\renewcommand\maketitle{\begin{titlepage}%
  \let\footnotesize\small%
  \let\footnoterule\relax%
  \let \footnote \thanks%
  \maketitlepage%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}

% TODO: If there are any other article modifications required, add them here.

% That's all, folks!
\endinput
您需要阅读文档以调整页边距。如果要修改标题的外观(除了关闭数字之外),可以使用

标题页是LaTeX的默认标题页。您需要修改它以添加您的公司名称和徽标。我已将“要打印的内容”分离出来从与标题页关联的所有其他代码。您只需更改
\maketitlepage
命令。在文档中,使用
\maketitle
打印标题页

\documentclass{paulius-article}

\title{My New Document Class}
\author{Paulius}

\usepackage{lipsum}% provides some filler text

\begin{document}
\maketitle% Actually makes a title page

\section{Section Heading}
\subsection{Look no numbers!}
\lipsum[1-10]

\end{document}

如果我错过了您的任何要求,请告诉我。

好吧,我已经走到了这一步,我甚至有一堆\setlength{..},但它似乎对我不起作用。你有什么评论良好的扩展可以分享吗?也许是某个地方的链接?很好的链接。我和那个东西睡了一个星期左右,试图让我的论文得到《边缘女郎》的认可…@dmckee:那些《边缘女郎》…=)嗯,我只看了一下,但看起来很有希望。