如何在LaTeX中扩展文章文档类? [英] How do you extend article document class in LaTeX?

查看:233
本文介绍了如何在LaTeX中扩展文章文档类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的不需要对默认文章文档类进行大量更改.我想要的是:

I don't really need a lot of changes to the default article document class. All I want is:

  • 重新定义页边距(我希望它们在所有页面上都相同,但与默认值不同);
  • 使用标题页;
  • 在标题页上添加更多元素( title author date 对我来说还不够,我想要 company 和公司徽标也在标题页上);
  • 更改 section subsections subsubsections 的样式(我不希望显示数字,否则-它们是好).
  • redefine page margins (I want them to be the same on all pages, but different from the default values);
  • use title page;
  • add more elements on the title page (title, author and date is not enough for me, I want company and company logo to be on the title page as well);
  • change styles of the sections, subsections and subsubsections (I don't want the numbers to be shown, otherwise - they're good).

也许在这种情况下有一些软件包可能会有所帮助?

Perhaps, there are some packages that could be helpful in this case?

推荐答案

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

There are a number of packages that can help you achieve the results you're looking for. The packages I've selected below are the ones I like, but there is more than one way to do it.

\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

您将要阅读几何包的文档调整边距.如果要修改外观,可以使用 titlesec包的标题(除了仅关闭数字).

You'll want to read the documentation for the geometry package to adjust the margins. The titlesec package can be used if you want to modify the appearance of the headings (aside from just turning off the numbers).

标题页是LaTeX的默认标题页.您需要对其进行修改以添加公司名称和徽标.我已经将要打印的东西"从与标题页相关的所有其他代码中分离出来.您只需要更改\maketitlepage命令.在文档中,使用\maketitle打印标题页.

The titlepage is LaTeX's default title page. You'll need to modify it to add your company name and logo. I've separated out the "stuff to be printed" from all the other code associated with the title page. You should only need to change the \maketitlepage command. In your document, use \maketitle to print the title page.

\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}

让我知道我是否错过了您的任何要求.

Let me know if I missed any of your requirements.

这篇关于如何在LaTeX中扩展文章文档类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆