6

The \maketitle function for articles and reports proves useful, but the format required for my situation is different from the standard Title that is given. I am using LaTeX from MiKTeX on Windows, and have found the class and style files for article, but can't understand the code completely. I need to modify:

  • Add a component to be created called \class, which would work the same was as \author.
  • Make the Title show below the author, class, and date.
  • Flush the author, class, and date to the right.

To illustrate, I want to be able to write my maketitle code like the following:

\documentclass[notitlepage,12pt,Arial]{article}
\author{Me}
\date{April 14, 2015}
\class{1}
\title{Example Title}
\begin{document}
\maketitle
Some Text here.
\end{document}

It should turn out Something like the following: Example created with a word processor

2
  • Welcome to TeX.SX! Please help us to help you and add a full minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Is easier for us in this way can help you copiyng and running code instead watch a screenshot.
    – Aradnix
    Commented Apr 15, 2015 at 5:17
  • Meanwhile and after read your question, perhaps a good solution could be create your own titlepage with an environment called titlepage.
    – Aradnix
    Commented Apr 15, 2015 at 5:26

1 Answer 1

5

If there are only one author and one class (i.e., without using \and), some like this could be enough:

MWE

\documentclass[11pt]{article}

\makeatletter
\def\class#1{\gdef\@class{#1}}
\def\@class{\@latex@warning@no@line{Hey you, no \noexpand\class given}}
\def\@maketitle{%
  \newpage \null  \vskip 2em%
  \begin{flushright}%
  \let\footnote\thanks
    \vskip 1.5em%
    {\large  \lineskip .5em%
      \begin{tabular}[t]{r@{}}%
        \@author    
     \end{tabular}\par 
      \begin{tabular}[t]{r@{}}%
      {\sffamily \@class}   
     \end{tabular}\par 
  \par}%
    \vskip .5em%
   {\small\@date}\par\bigskip%
    {\LARGE\scshape \@title \par\bigskip\hrule}%
  \end{flushright}%
  \par   \vskip 1.5em}
\makeatother


\title{Some long Wonderfull Title}
\class{UFO affairs\thanks{Area 51}} 
\author{Clever Reporter\thanks{No dot disturb.}}
\date{\today}

\begin{document}
\maketitle
\end{document}

If you can have several authors and classes, then left the tabular as environment as originally defined (with one ccolumn type) and simply use \author{author\\class \and author\\class \and ...}

2
  • This code works great to produce the result I need. I am fairly new to LaTeX, so how can i implement this into the article class or my own, that is based from article?
    – Monkeyman
    Commented Apr 15, 2015 at 21:27
  • @Monkeyman I think that simply including the chunk inside the \makeatletter ... \makeatotther (but without these two control sequences) at the end of your myclass.cls should work ...
    – Fran
    Commented Apr 15, 2015 at 22:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .