Warning: Parameter 1 to Language::getMagic() expected to be a reference, value given in /opt/local/apache2/htdocs/wiki/includes/StubObject.php on line 58
LaTeX and MediaWiki - OSR

LaTeX and MediaWiki

From OSR

Jump to: navigation, search

This document discusses how to integrate LaTeX and Mediawiki using mw2latex. It is intended for both users of MediaWiki and administrators of MediaWiki sites. Other than the extension to add the Print as PDF link to the toolbox, there are no changes required to the MediaWiki installation. The PDF version of this document is available from http://www.osresearch.net/~hudson/mw2latex.pdf

Contents

[edit] Generating LaTeX from Mediawiki

The difference between theory and practice is that in theory they are the same, but in practice they are not. (Source unknown)

This guide explains how to setup a MediaWiki installation to use LaTeX [1] for rendering PDF documents from the wiki pages. The primary reason for doing this is to avoid the poor formating control given by printing the HTML rendering, as well as to generate references, lists of figures, etc.

This guide has three parts: chapter ch:using looks at how to map MediaWiki commands to LaTeX structures, and chapter ch:practices is concerned with the best practices of structuring large documents in the wiki so that they are easy to edit and debug, while appendix app:configuring covers the initial setup of the MediaWiki installation.

This document assumes that you are fairly familiar with MediaWiki's dialect of WikiText markup, so not all nuances of writing Wiki documents are covered. Instead only the areas where care needs to be taken for generating documents that work well with LaTeX are explored.

The underlying LaTeX class is built on the Memoir class [2] . The documentation for the class is a complete guide to text layout and is well worth the download and time to read through. It will also be useful if you need to adjust any of the defaults or configuration values in mwstyle.sty as part of setting up the package.

[edit] Cooperating with LaTeX

The self-respecting individual will try to be as tolerant of his neighbor's shortcomings as he is of his own. (Eric Hoffer (American Writer, 1902-1983))

Luckily MediaWiki and LaTeX share many common features -- they both focus more on content and structure rather than formatting and page layout. The actual formatting and typesetting are left up to the individual rendering program, your web browser for Mediawiki and the TeX engine for LaTeX. Both of these apply a style sheet that controls how chapter headings, sections, citations and lists are to be formatted, freeing you, the author, to focus on writing the content rather than twiddling font sizes and margins.

[edit] Chapters, Sections, Subsections, and beyond

The first part of writing a document in either is to produce an outline of chapters, sections, subsections and so on. The MediaWiki structures map directly to LaTeX structures, with the exception that the Memoir class supports a higher level divisions into Books and Parts for which there is no MediaWiki equivalents. From highest to lowest level the divisions are:

{{rawlatex|\book{Book name}|}}
{{rawlatex|\part{Part name}|}}
= Chapter =
== Section ==
=== Subsection ===
==== Sub-subsection ====
===== Paragraph =====
====== Subparagraph ======

If the document options include article, chapters will not create page breaks. If the options include openany, chapters will occur on either left or right pages. Otherwise the default is to force a chapter to start on a right page. See section sec:options for how to set document level options in the LaTeX preamble.

Create an empty chapter named Appendix to instruct LaTeX that every chapter afterwards goes into the Appendix section rather than the normal chapters:

= Appendix =

One caveat for naming sections is that they may not contain special characters or math markup. The LaTeX document will not correctly parse the names and generate corrupted PDFs. This limitation does not apply when writing raw LaTeX documents, so at this point it is being treated as a bug in the conversion process.

[edit] Subsection

[edit] Sub-subsection

[edit] Paragraph
[edit] Subparagraph

Demonstrating all the way down to the lowest section level supported by LaTeX.

[edit] Fonts

A good place to start is the Wikipedia Cheatsheet and How to Edit a page. The normal range of MediaWiki fonts are available. as shown in table tab:fonts .

Font table
Wikitext Output
''Italic'' Italic
'''Bold''' Bold
'''''Bold italic''''' Bold italic
<tt>Typewriter</tt> Typewriter
<del>Strike-out</del> Strike-out
<u>Underline</u> Underline
<small>Small</small> Small
<big>Big</big> Big
<sub>Subscript</sub> Subscript
<sup>Superscript</sup> Superscript

For large chunks of preformatted text, use the <pre>...</pre> tags. These will be translated to LaTeX verbatim environments. All of the examples are formatted with pre.

[edit] Formatting

LaTeX has almost infinite control over the formatting of typography and layout of the page, and it is very easy to spend more time tweaking the style sheets once you learn the programming language that is used by the low-level formatting engine, rather than focusing on content. The defaults are very good for most applications and there are several pre-defined styles that are included with the Memoir class -- see the Memoir documentation for examples and far more detail than you ever wanted to know about formatting books for publication.

In general, you will likely want to adjust the \chapterstyle{} command in the /mwstyle.sty style sheet (or what ever style sheet you include in your preamble). Other commands set the margins, paper size and an infinite array of other features.

[edit] Source code

If the SyntaxHighlight extension is installed, source code will be colorized in the web form, but translated into the listings environment in the PDF.

<source lang=cpp>#include <iostream.h>
// Comment
int main ( int argc,  char **argv ) {
    cout << "Hello World!" << endl;
    return 0;
}</source>
#include <iostream.h>
// Comment
int main ( int argc,  char **argv ) {
    cout << "Hello World!" << endl;
    return 0;
}

[edit] Links and References

To create a label, use the label template.

{{label|sec:links}}

This will create both an HTML and a LaTeX label with the same name. Typically the type of element being labeled is included as a prefix in the name as shown in table tab:label-prefixes :

Label Prefixes
Prefix Object type
ch: Chapter
app: Appendix
sec: Section
fig: Figure
eq: Equation number

To generate internal document links, use the ref and refrange templates:

... produce such references such as section {{ref|sec:links}}
or chapters {{refrange|ch:intro|ch:using}} or even
equation {{ref|eq:test}}.

These will use Varioref to produce references such as section sec:links or chapters ch:intro or even equation eq:test .

To generate HTTP URL links, use the normal MediaWiki syntax: [http://google.com Google] or plain http://google.com. Since the target output is a PDF document that will likely be printed, it is necessary for LaTeX to store the plain-text versions of the URLs in the document. For most links, a footnote will be generated to indicate the URL, such as this link to Google or this one to http://google.com. Due to a LaTeX problem with footnotes in floats, URLs in figure captions, tables and elsewhere will be expanded inline with the link text, followed by the URL in parentheses.

Inter-document links are not yet supported, but are planned as a further expansion of the mw2latex program. Ideally they would be transformed into \vref{...} calls in the LaTeX file, but we're not there yet.

[edit] Lists

[edit] Itemized lists

* Item 1
* Item 2
** Sub item 2.1
** Sub item 2.2
  • Item 1
  • Item 2
    • Sub item 2.1
    • Sub item 2.2

[edit] Enumerated lists

Enumerated lists can also include labels, as shown in item it:example . Be careful to not have any blank lines in between your itemized list elements or else both MediaWiki and LaTeX will re-start your numbering at 1. Check for how to start at arbitrary counter?

# Enumerated list example item 1
# Enumerated example 2
## Item 2.1
## {{label|it:example}} Item 2.2
  1. Enumerated list example item 1
  2. Enumerated example 2
    1. Item 2.1
    2. Item 2.2

[edit] Definition lists

Definition lists are useful for glossaries or other sort of key/value pairs. It is helpful to use the {{index}} directive to create index entries for each key, as described in section sec:index .

; Item : Definition
; Item2 : Other definition
Item 
Definition
Item2 
Other definition

[edit] Math

Luckily MediaWiki uses a version of TeX for its math formatting, so it is very easy to integrate mathematics generated in the wiki with the LaTeX output. There are some caveats, but in general the PDF output from LaTeX will look far better than printing the PNG images that are produced for reading MediaWiki sites on the web.

Note that MediaWiki does not distinguish between the three different math modes described in this section and will render all output at the same size when it generates display PNGs. This is a limitation in how it interacts with texvc and one of the main goals in building a MediaWiki to LaTeX converter.

[edit] Inline math

Inline math is done with the normal <math>...</math> tags. This will format the equations inline with the text using the LaTeX $...$ formatting. For example, <math>\int {1\over x} dx</math> produces \int {1\over x} dx. Note that on the web form of this document, the formating of this paragraph is broken by the fairly large image representing the equation, but the PDF output formats it at the same size as the surrounding text.

[edit] Equations

For equations you must set the class on the math tag to eq to get a large equation. For best formatting, it is ideal if there is no blank line after the paragraph and the open bracket of the <math> tag.

<math class=eq>\int x^2 dx</math>

\int x^2 dx

[edit] Numbered equations

For a numbered equation, set the class to eqn and pass in an optional label after a dash:

<math class=eqn-eq:test>
\phi_n(\kappa) =
\frac{1}{4\pi^2\kappa^2} \int_0^\infty
\frac{\sin(\kappa R)}{\kappa R}
\frac{\partial}{\partial R}
\left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR
</math>


\phi_n(\kappa) =
\frac{1}{4\pi^2\kappa^2} \int_0^\infty
\frac{\sin(\kappa R)}{\kappa R}
\frac{\partial}{\partial R}
\left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR

You can even refer to equation labels using {{ref|eq:test}}, such as this reference to equation eq:test . Equation numbers will not show up on the wiki, which can make the references seem a little out of place.

[edit] Tables

There is some support for MediaWiki tables, although not all features are currently implemented and frequently it doesn't do exactly what you might expect. Please see section sec:table-problems for further details.

[edit] Basic tables

The tables are implemented using the LaTeX longtable package to allow them to span multiple pages. Tables may have captions and labels as shown in table tab:sample and individual columns may be sized according to a theoretical 1000 pixel wide sheet of paper. Table headers are supported, as is the colspan directive.

{|border=1 width=500px
|+ Table caption {{label|tab:sample}}
! Col 1 header
! Col 1 header
|-
| Item 1 || Item 2
|-
| colspan=2 | Spans both columns
|-
| Item 3
| Item 4
|-
| colspan=2 | [[Image:Red-tulip.jpg|300px]]
|-
|}
Table caption
Col 1 header Col 1 header
Item 1 Item 2
Spans both columns
Item 3 Item 4

[edit] Caveats of tables

There are several known issues with tables:

  • Nested tables are not well supported
  • Images inside of tables tend to break things
  • Widths of tables onscreen with fixed sizes tend to look too large
  • LaTeX tables are not automatically sized for width
  • Table border does not line if there is line-wrapping
  • Border weight can not be changed
  • Table caption must be first item in the table
  • rowspan is not supported
  • Tables without captions can float
  • Alignment functions are not supported

[edit] Block quotes

Block quotes can be included, but they do not get fully Wiki formatting.

<blockquote>
This is a short block quote that is only one paragraph.

Extra tags are not required, but these paragraphs will run
together in the HTML.
</blockquote>
This is a short block quote that is only one paragraph. Extra tags are not required, but these paragraphs will run together in the HTML.

It is necessary to use explicit paragraph tags in the blockquote to avoid having MediaWiki run them all together:

<blockquote>
<p>This is a multi-paragraph block quote</p>.

<p>It is necessary to include the <p> and </p>
tags to separate paragraphs.
Sorry.  That is just the way it is.</p>
</blockquote>

This is a multi-paragraph block quote.

It is necessary to include the <p> and </p> tags to separate paragraphs. Sorry. That is just the way it is.


[edit] Images and Figures

Figures and images are the most frustrating part of dealing with any LaTeX document. They may require some manual adjustment to ensure that every image or figure lines up with the portion of the document that refers to it. LaTeX has its own ideas of what makes for good positioning of floats; sometimes it even matches what you might expect. In general, LaTeX will try to position the images at the top of a page as close as possible to any reference, or on a page containing nothing but images.

[edit] Figures

Typically a figure is created with the MediaWiki image syntax with a thumbnail and caption, which results in an image like figure fig:hippo :

 [[Image:Hippo-small.jpg|thumb|center|300px
 |Image caption text{{label|fig:hippo}}]]
Image caption text
Image caption text

The imaginary width of the page is 1000 pixels, so a 300px image will be 30% of the page width. This corresponds fairly well to a 1024x768 monitor displaying the Mediawiki page.

You can also create images with the {{figure}} template.


[edit] Subfigures

You can create subfigures using the MediaWiki gallery tag:

<gallery widths=400px heights=300px caption="Main figure caption">
Image:Pasta-rolling.jpg|Subfigure caption
Image:Pasta-with-cheese.jpg|Caption on other subfigure
</gallery>

Individual images in a subfigure may be refered to, as in {{ref|fig:pasta-rolling}}, which allow us to refer to figure fig:pasta-rolling .

[edit] Figure labels

For normal images, it is possible to create labels in the captions by calling the {{label}} template with the desired name, as was done in example figure fig:hippo .

Labels are generated automatically for the images in a gallery tag by applying a regular expression that strips any special characters from the image name, change the case to lower case, removes the extension from the name, converts any spaces to _ characters and adds fig: to the beginning. So the image Image:Pasta-rolling.jpg becomes fig:pasta-rolling. If the same image is used more than once, only the first reference will be valid. It is not possible to add additional labels to subfigures or to the subfigure as a whole due to the way MediaWiki processes the caption text.

[edit] Raw images

If you want to include an image without it becoming a separate figure, do not specify thumb and have the image be less than 50% the size of the page. There should be a floating image to the right side of this paragraph generated by:

[[Image:Uk-countryside.jpg|400px|right]]

If you need to ensure that the text does not overlap the image, you can use the {{clear}} command to force white space until all images are cleared. This should appear after the image. LaTeX may or may not honor the command. Also note that the image will be included exactly where it appears, which may be near the end of a page and off the bottom. Using figures rather than raw images prevents this, but only by giving up control of exactly where they appear. The spacing of raw images may be a bit off as well, with extra vertical space that shouldn't be there (and needs to be fixed).

[edit] Typographic formatting

LaTeX has much finer control over formatting and layout than MediaWiki. The defaults are for a fairly plain memoir class document, but can be configured on a per-site or per-document basis.

[edit] Front matter

Generating the title page is done with the front-matter template. It will output the title page when it occurs, which means that it should be the first non-preamble content unless you want something before the title page. It takes in several arguments, all of which are optional:

{{front-matter
|author=Name of author (default: empty)
|title=Title of paper (default: {{PAGENAME}})
|date=Publish date (default: use today's date)
|draft=yes (default: no)
|warnings=yes (default: no, if yes a chapter with LaTeX warnings will be produced)
}}

[edit] Table of contents, figures and tables

To create the table of contents, issue a rawlatex command along with a cleardoublepage if you want the table of contents to appear on a recto page as in a traditional book. Typically this would occur after any abstract, but before the introduction and preface.

{{rawlatex|\cleardoublepage\tableofcontents}}

Similar commands can be used to generate the list of figures \listoffigures and tables \listoftables. Sometimes it is helpful to collect these three into a template named front-matter.

[edit] Headers and footers

Footers have three sections and are set together with the footer template. Note that the arguments will be passed to the rawlatex template, so it is acceptable to use things like \thetitle or \thedate. Also note that it is possible to change the footers in the middle of the document and they will take effect starting on the current page.

{{footer|Left footer|Center footer|Right footer}}

If you want more contorl, such as separate even and odd footers, you can directly call the memoir class functions to set them for the mwstyle page style (or any other page style that you might define):

{{rawlatex|\makeoddfoot{mwstyle}{Test}{}{\small\thetitle}|}}
{{rawlatex|\makeevenfoot{mwstyle}{Even}{}{\small\thedate}|}}

[edit] Abstracts

To create an abstract, use the abstract or onecolabstract environment:

{{env|abstract|Text of abstract}}


This is a short summary of the document that you're about to read. It may be set in italics and is typically only a single column, even if the rest of the document is two column.


[edit] Epigraphs

Epigraphs may be added to the start of each chapter using the epigraph template:

{{epigraph|A pithy quote ....|Source of pithy quote}}

These will be rendered in HTML with the blockquote element and with the Memoir \epigraph{}{} command.

[edit] Dedications

To be written.

[edit] Indices

Create an empty chapter named Index to generate the index, starting on a double page.

= Index =

[edit] Index Entries

  • Plain entry: uses the basic command {{index|cheese}} to make an entry for cheese with the current page number

  • Subindex Entry: uses the basic command with an exclamation point to separate the first main entry from the subentry. The command for a single level of subentry appears as such:
{{index|cheese!gouda}}

  • Subentries can be up to one additional level deep, and the command appears as such:
{{index|cheese!gouda!brie}}

  • Cross-references: Entries which are simple "See" and another entry are created using the vertical bar in LaTeX with this command"
{{index see|cheese|crackers}}

  • Font changes: To change the style of an index entry use one of the following:
{{index it|Fonts!Italics font}}
{{index tt|Fonts!Typewriter font}}
This example indexes Kraft and italicizes it at the same time. Any of the standard font change commands which use \text... will work within this syntax.

  • Out of sequence: This can be used to make index entries appear out of sequence, so that they appear with the work they represent. For instance:
{{index|cheese@gouda}}
Would place gouda in the list right next to cheese, as if gouda was actually spelled cheese.

[edit] Bibliographies

Wikipedia has its own means of citing documents that is different than the normal BibTeX technique. Wikipedia has all of the citations occur inline with full references, which makes it difficult to share between documents, while the BibTeX model is to have a database with citation keys that allow frequently cited sources to be shared. For both models, it is necessary that the Extension:Cite is installed, as described in section extensions .

Where at all possible, these templates will preserve the references in both formats.

[edit] Citations

To implement the BibTeX model, create the templates for cite, bibtex book and others as listed in section templates . Then to cite a reference, use {{cite|texbook}}, while will produce [3] . Depending on the bibliography style the printed version may be a numeric source index in alphabetic order, an alphabetic key or the full name and date of the author. The wiki version will always be a numeric value in the order in which they appear in the document.

[edit] Creating BibTeX entries

To be written. BibTeX extensions?

[edit] Outputing bibliography

To create the bibliography, use this template. It will generate both the wiki version and the LaTeX version:

{{references|optional-bibtex-style}}

If no style is passed in, the plain style will be used. Many different styles are available depending on the end destination of the document. The bibliography for this document (chapter ch:bib ) was prepared with the amsalpha style.

[edit] LaTeX preamble and document class

Commands can be inserted into the preamble using the rawlatex template, passing in the preamable id. This is how the style sheet described in ch:stylesheet controls the over all page layout.

{{rawlatex|id=preamble|\usepackage{randompackage}|}}

If you want to change the document class, use the docclass id (the last one takes precident). The default if one is not specified is

{{rawlatex|id=docclass|\documentclass[11pt,article]{memoir}|}}

[edit] LaTeX Best Practices

These are the collected best practices of using LaTeX to format MediaWiki documents.

[edit] Appendix

[edit] Configuring Mediawiki

A journey of a thousand miles begins with a single step. (Lao-tzu, The Way of Lao-tzu. Chinese philosopher (604 BC - 531 BC))

[edit] LocalSettings.php and Extensions

  • Install the modified extension in extensions/PdfExport/ and set default preference to "Always use PNG for equations" by adding to LocalSettings.php and enable subpages for the main namespace if you haven't already:
 require_once( "$IP/extensions/PdfExport/PdfExport.php" );
 $wgDefaultUserOptions['math'] = 0;
 $wgNamespacesWithSubpages[NS_MAIN] = 1;
  • Set path to mw2pdf in PdfExport.php

Other extensions that might be worth installing:

  • Extension:FlaggedRevs to allow specific version to be marked as definitive. If a paper is being submitted for publication, this allows the authors to sign off on the version and always retrieve that version, even if other things have changed.
  • Extension:Cite, the official Wikipedia citation plugin. Some of the BibTeX specific ones (like Extension:Bibwiki are easier to integrate with BibTeX references, but Extension:Cite is the official one.


[edit] Templates

  1. Template:Clear
  2. Template:Env
  3. Template:Epigraph
  4. Template:Footers
  5. Template:LaTeX
  6. Template:Label
  7. Template:Nowiki
  8. Template:Rawlatex
  9. Template:Ref
  10. Template:Refrange

[edit] env

<noinclude> [[Category:LaTeX templates]] Create a {{LaTeX}} environment and put the text into it. Usage: <pre> {{env|envname| text to put into the environment}} </pre> </noinclude><includeonly> {{rawlatex|\begin{{{{1|}}}}|}} {{{2|}}} {{rawlatex|\end{{{{1|}}}}|}} </includeonly>

[edit] ref

<noinclude> [[Category:LaTeX templates]] Usage: <pre> {{ref|label-name|html version}} </pre> </noinclude><includeonly><span class=ref id={{{1}}}>{{{2|{{{1|}}} }}}</span></includeonly>

[edit] refrange

<noinclude> [[Category:LaTeX templates]] Generate a range of pages between two references. </noinclude><includeonly>{{rawlatex |1=\vrefrange{{{{1|}}}}{{{{2|}}}} |2={{{3|{{{1|}}} }}} }}</includeonly>

[edit] nowiki

{{#tag:nowiki|{{{1}}}}}<noinclude> First parameter is <code>nowiki</code>'d. This can be useful in template coding. </noinclude>

[edit] LaTeX Style Sheet

This document was prepared with the /mwstyle.sty wiki page. Early in the document there is a command to transclude the page with some special wrappers to trick both MediaWiki and LaTeX into handling the style sheet correctly. Note that there is a leading % on the transclusion to ensure that the pre command that opens the style sheet on the wiki page is not interpreted by LaTeX.

{{rawlatex|id=preamble|%{{/mwstyle.sty}}|}}

To generate a chunk of raw LaTeX code for the preamble section, you can use this idiom to ensure that the wiki parser does not try to parse any of the arguments passed into rawlatex template:

{{rawlatex|id=preamble|%<pre>
.....
%</pre>
|}}

By default the mw2latex conversion includes the following packages for you:

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{times}
\usepackage{url}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{varioref}
\usepackage{multicol}
\usepackage{lscape}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{listings}
\usepackage{subfigure}
\usepackage{ulem}
\usepackage{xspace}
\usepackage{hyperref}
\usepackage{memhfixc}


[edit] mwstyle.sty

This is the style sheet used to generate this document. Due to a limitation in MediaWiki it is not correctly styled as a source listing and it has lost the pre tag at the beginning and the closing tag at the end.

% Enable making the index
\makeindex

%% Encourge figures and text to share the same page
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}
\widowpenalty=5000
\clubpenalty=5000

% Use narrower margins on each side (less wasted paper)
% but keep the inner margin (towards the spine) fairly large.
\usepackage[
 inner=5cm,
 outer=3cm,
 top=3cm,
 bottom=3cm,
 twoside
]{geometry}

% Define our page style with headers, footers, etc
\makepagestyle{mwstyle}

\makeoddhead{mwstyle}{\rightmark}{}{\thepage}
\makeevenhead{mwstyle}{\thepage}{}{\leftmark}
\makeoddfoot{mwstyle}{}{}{\small\thetitle}
\makeevenfoot{mwstyle}{\small\thetitle}{}{}

\renewcommand*{\footnoterule}{}


%
% Display the page and section in the header of each page
%
\makeatletter
\makepsmarks{mwstyle}{
  \def\chaptermark##1{\markboth{%
        \ifnum \value{secnumdepth} > -1
          \if@mainmatter
            \chaptername\ \thechapter\ --- %
          \fi
        \fi
        ##1}{}}
  \def\sectionmark##1{\markright{%
        \ifnum \value{secnumdepth} > 0
          \thesection. \ %
        \fi
        ##1}}
}


%
% For sections include a rule that extends across the entire
% page to make them stand out compared to the other
% document divisions.
%
\newcommand{\ruledsection}[1]{%
  \noindent%
  \parbox[t]{\textwidth}{%
    %\hrule\vskip1em
    \sffamily\large\bfseries #1%\vskip1em%
    \hrule%
  }
}


\makerunningwidth{mwstyle}{1.0\textwidth}
\makeheadposition{mwstyle}{flushright}{flushleft}{flushright}{flushleft}
\makeheadrule{mwstyle}{1.0\textwidth}{\normalrulethickness}
%\makefootrule{mwstyle}{1.0\textwidth}{\normalrulethickness}{1mm}

% Use our newly defined style for the page
% and hang the section numbers off the left margin
\pagestyle{mwstyle}
\chapterstyle{ell}
\hangsecnum


%
% Use san-serif fonts and rules for section headers, 
%
\setsecheadstyle{\ruledsection}
\setsubsecheadstyle{\sffamily\bfseries\raggedright}
\maxsecnumdepth{subsection} % number subsections
\maxtocdepth{subsection}

% Use italics for the abstract
\renewcommand{\abstracttextfont}{\itshape}

% Make verbatim text slightly smaller so that it doesn't
% overwhelm the article text
\renewcommand{\verbatim@font}{%
  \ttfamily\small%\catcode`\<=\active\catcode`\>=\active%
}

% Switch 'at' to be a special command again
\makeatother


%


References

  1. Leslie Lamport, 1986 {\LaTeX:} {A} Document Preparation System, Addison-Wesley
  2. BibTeX/Wilson thememoir
  3. Donald E. Knuth, 1984 The {\TeX}book, Addison-Wesley

[edit] Index