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

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

问题描述

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

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

  • 重新定义页边距(我希望它们在所有页面上都相同,但与默认值不同);
  • 使用标题页;
  • 在标题页添加更多元素(titleauthordate 对我来说还不够,我想要 company 和公司 logo 也将出现在标题页上);
  • 更改 sectionssubsectionssubsubsections 的样式(我不希望显示数字,否则 - 它们是好).
  • 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.

ewcommand{maketitlepage}{%
  
ullvfil
  vskip 60p@
  egin{center}%
    {LARGE @title par}%
    vskip 3em%
    {large
     lineskip .75em%
      egin{tabular}[t]{c}%
        @author
      end{tabular}par}%
      vskip 1.5em%
    {large @date par}%       % Set date in large size.
  end{center}par
  @thanks
  vfil
ull%
  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.

enewcommandmaketitle{egin{titlepage}%
  letfootnotesizesmall%
  letfootnoterule
elax%
  let footnote 	hanks%
  maketitlepage%
  setcounter{footnote}{0}%
  globallet	hanks
elax
  globalletmaketitle
elax
  globallet@thanks@empty
  globallet@author@empty
  globallet@date@empty
  globallet@title@empty
  globallet	itle
elax
  globalletauthor
elax
  globalletdate
elax
  globalletand
elax
}

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

% That's all, folks!
endinput

您需要阅读 geometry 包的文档 调整边距.如果要修改外观,可以使用 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}

	itle{My New Document Class}
author{Paulius}

usepackage{lipsum}% provides some filler text

egin{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天全站免登陆