20

I am using a template which defines \maketitle to include the date, in addition to the author and the title. I cannot find the file in which this is defined, but there is the following comment in the .tex template which I am modifying:

\maketitle          % Use the \author, \title and \date info

I would like to redefine the command to include just the \author and \title info. Any suggestions on how to do this?

I want to redefine \maketitle in my .tex file. The original definition could be in any package that I might be using.

  • 1
    Without seeing the definition, it's impossible to give sensible advice. – egreg Dec 9 '14 at 8:41
  • If you want to create the titlepage completely on your own, you can have a look at How to customize a titlepage. – Johannes_B Dec 9 '14 at 9:05
  • \maketitle often is defined in your documentclass. Which one are you using? – David Woitkowski Dec 9 '14 at 9:11
24

As you indicated you have no clue where your \maketitle is defined. Lets take TeX to find out the definition:

Replace

\maketitle          % Use the \author, \title and \date info

with

\meaning\maketitle

This line will give you the definition of \maketitle currently in effect. Chances are high that this will result in some bookkeeping operations and then calling another macro, often called \@maketitle or similar as in WChargin's answer. We thus have to find out what \@maketitle (or however it is called) does. So add

\makeatletter\meaning\@maketitle\makeatother

The \makeatletter ... \makeatother-pair is necessary to make LaTeX cope with the @ in \@maketitle.

With this information you can proceed as described win WChargin's answer. Lets assume you get the definition WChargin posted you could alter it as below (adding \makeatletter ... \makeatother again because of the @)

\makeatletter
\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    %{\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\makeatother

You will observe that this is exactly equivalent to what WChargin wrote.

  • your suggestion worked exceedingly well, so thanks for the same. there was a minor typo in the last \fi, and I commented it out, because tex was cribbing. – Vinod Dec 9 '14 at 10:24
  • Btw, I found another link with a similar problem, which has a different method, so sharing it for what it is worth: physical-thought.blogspot.com.au/2008/01/… Coincidentally, I tried editing the code snippet provided in the link to add the author information as well, but could not get it working. My code change (which does not work) is as follows: \makeatletter \renewcommand{\@maketitle}{ \newpage \null \vskip 2em% \begin{center}% {\LARGE \@title \par}% \end{center}% \begin{center}% {\SMALL \@author \par}% \end{center}% \par} \makeatother – Vinod Dec 9 '14 at 10:24
  • btw, I get the following when I substitute \maketitle as you suggested: macro:-.gnewpage gnull gvskip 2emgbegin .center.glet gfootnote gthanks .gLARGE g@title gpar .gvskip 1.5em.glarge glineskip .5emgbegin .tabular.[t].c.g@author gend .tabular .gpar .gvskip 1em.glarge g@date .gend .center.gpar gvskip 1.5em – Vinod Dec 9 '14 at 10:25
  • I haven't seen \meaning before. Is it just \show but actually typesetting the macro? Why is this preferable to \show? – wchargin Dec 10 '14 at 2:03
  • Imho \show has the advantage of giving a copy-pasteable output in the log-file, which is easy to transfer into your tex-file and is already (more or less) nicely formatted. \meaning on the other hand has the advantage that one does not need to navigate a "clueless" person through the log-file. Apart from that: Ask the gurus. – David Woitkowski Dec 10 '14 at 8:30
11

Well, the simplest way to do this is

\date{}

which will use an empty date. But there will be an extra space.

I don't have your style file, so I'll use article as an example. To find the definition of \maketitle, you could either execute \show\maketitle from an interactive TeX run, or you could look it up in the style file. (The latter is probably better because you get nicer formatting.) From article.cls (line 213):

\newcommand\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\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}

From this, we can see that it's the \@maketitle command that does the actual typesetting. That's defined on the next line.

\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\fi

So you can just redefine it, remove the line you don't want, and you're done.


MWE

\documentclass{article}

\makeatletter
    \def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    %\vskip 1em%
    %{\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\fi
\makeatother

\title{MWE}
\author{You}
\date{Today}

\begin{document}
\maketitle
Hello, world!
\end{document}
  • As I metioned, I do not know where this is defined....so ideally I would like to add a new definition overriding the existing one....how can I do this? – Vinod Dec 9 '14 at 3:58
  • Well, you may not know where it is defined, but obviously TeX does, or it wouldn't be able to compile. So open up your style file, search for \maketitle, and follow an analogous procedure. – wchargin Dec 9 '14 at 4:02
  • @Vinod Please see my edit. – wchargin Dec 9 '14 at 4:04
  • I am not sure where the .sty file is located....in fact, I am not very familiar with tex and I see only the .tex and .bib files in my directory....so I want to add a new definition in my .tex file overriding the existing one – Vinod Dec 9 '14 at 4:04
  • @Vinod Somewhere in your preamble, you must have a \usepackage command to load your style file. Note the name of the package; I'll call it foo. Then, run kpsewhich foo.sty at a terminal and you'll get the path to the sty file. Example: kpsewhich amsmath.sty yields /usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty. – wchargin Dec 9 '14 at 4:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.