Quickly change the default look of LaTeX papers

Have you ever tried (or wished) to modify the default article class of LaTeX? I do not like the AMS amsart class, although it is much more powerful than the basic classes. In particular I do not understand why the AMS decided to put almost everything in the middle of the line: the title, the author name, the titles of every section, everything is centered. Many mathematicians like that, but I don't. And, finally, why should the address go to the end of the last page? I'd like it just after the author's name.

If you can master Plain TeX, you will write down your preprints as you like: Plain TeX is essentially a typewriter, and you can format the page on-the-fly.
But Plain TeX is nowadays obsolete, and it lacks the most important feature of LaTeX: cross-references. It is a true nightmare when you realize that an un-numbered equation should be numbered, because you must then advance the number of each equation by hand! LaTeX does this for you, and it works so well.

So, okay: how on earth can I make my preprints more personal with LaTeX? The answer is simple: you should jump into the style files (those ending in .sty or .cls) and figure out what goes on. Easy? No, not at all.

Fortunately, the classical approach of trial and error is perfect to face our problem, and in less than an hour I could produce the following source:


%%%%%%%%%%%%%%%%%%
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}

\makeatletter

\def\address#1{\gdef\@address{#1}}
\def\@address{\@latex@warning@no@line{No \noexpand\address given}}

\def\email#1{\gdef\@email{#1}}
\def\@email{\@latex@warning@no@line{No \noexpand\email given}}


  \renewcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]%
      \fi
    \else
      \newpage
      \global\@topnum\z@   % Prevents figures from going at top of page.
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@address\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\address\relax
  \global\let\date\relax
  \global\let\and\relax
}
\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \\begin{flushleft}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large \@author \ \textbullet \ \@address \par%
    \emph{Email address}: \texttt{\@email}\par}%
    \vskip 1em%
    {\large \@date}%
  \\end{flushleft}%
  \par
  \hrule
  \vskip 1.5em}




\makeatother



%opening
\title{A sample paper}
\author{A. U. Thor}
\address{Topolinia city}
\email{a.u.thor@topolinia.edu}


\begin{document}

\maketitle

\begin{abstract}

\end{abstract}

\section{Introduction}

\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A purist will see that I just copied very large pieces of some styles (article.cls and amsart.cls) but I don't care: I am not looking for a job as a LaTeX programmer. Of course I could make more changes, such as the fonts of the title, or the position of the abstract. But this is just an example.

Commenti

Post più popolari