2

I am using TeXnic Cener on Windows. My latex document is in article format. Initially, I had the following title page:

    \documentclass{article}
    \setcounter{tocdepth}{3}
    \begin{document}
    \title{Some title}

    \author{My Name}
    \date{\today}
    \maketitle

     \thispagestyle{empty}

     \clearpage
     \tableofcontents
      \clearpage

Then, to add more structure to the title page, I made the following modifications:

     \begin{document}
     \title{Some title}

      \author{My Name}


     \paragraph{}
     \large \centerline{My Report}
     \centerline{for the purpose}
     \centerline{\date{\today}}
     \normalsize


      \maketitle

     \thispagestyle{empty}

     \clearpage
     \tableofcontents
     \clearpage

The problem is, the date appeared in two places: the old place and the new place. I removed the date completely and tried the following:

  1. Restart texnic center
  2. Restart my laptop
  3. Remove the pdf file generated so it is created again.

Nothing seems to work and I still get the date displayed in its old place. I also want to mention that before adding date to any of the above code, the date did not display at all.

Thanks in advance for any suggestions.

  • \maketitle is typesetting the date again. (I didn't realise that putting \date{} like that actually typeset anything but I guess it does.) Also, it is better not to use \centerline except when absolutely needed. \centering is a better option here. You might wish to look at the titling package to make this layout easier. Also, please remember to post complete code for a small, compilable document rather than mere fragments which are much less useful. And welcome to TeX SE! – cfr Aug 20 '14 at 22:23
  • @HarishKumar: Thanks for the comment, but I specifically deleted the date after author (in first code), and deleted it in the second code, but it still shows!!! – Jenna Adler Aug 20 '14 at 22:31
  • @cfr: Thanks for the comment. The code is really long so I could not copy all parts. I am not clear on your suggestion. Could you provide more details? At this point I have completely deleted the date from both places but it still shows. How can I remove it? – Jenna Adler Aug 20 '14 at 22:33
  • @HarishKumar: What is MWE? and how can I provide you with it? – Jenna Adler Aug 20 '14 at 22:34
  • 1
    minimal working example (MWE) – user11232 Aug 20 '14 at 22:53
2

Few things. First you have to use \date{}. If you delete it, since it is hard-coded in the definition of \maketitle today's date will be printed. And you should use \today instead of \date{\today}. Also, since \centerline is a TeX command, you should use \centering (which is LaTeX) and enclose entire thing inside a group so that the scope is limited.

With these, your code becomes

\documentclass{article}
\begin{document}
\title{Some title}

\author{My Name}
\date{}

\paragraph{}
{%   <-- starts a group
\large \centering
My Report \par
for the purpose \par
\today \par
}%   <-- ends that group

\maketitle

\thispagestyle{empty}

\clearpage
\tableofcontents
\clearpage
\end{document}

giving

enter image description here

Edit to address the comment.

You can use re-define \maketitle or use titling package. Here is an attempt using second option.

\documentclass{article}
\usepackage{titling}
\begin{document}
\pretitle{%
    \begin{center}\LARGE
    \begin{minipage}{\textwidth}
        \large \centering
        My Report \par\vskip 0.5em
        for the purpose \par\vskip 0.5em
        \today \par
    \end{minipage}
    \vskip 1em
}
\posttitle{\par\end{center}\vskip 0.5em}
\title{Some title}

\author{My Name}
\date{}

\maketitle

\thispagestyle{empty}

\clearpage
\tableofcontents
\clearpage
\end{document}

enter image description here

Here is a simpler version which adds extra details inside \title itself:

\documentclass{article}
\begin{document}
\title{{%   <-- starts a group
\large
My Report \\[0.75ex]
for the purpose \\[0.75ex]
\today \\[0.5em]
}%   <-- ends that group
Some title}

\author{My Name}
\date{}

\maketitle

\thispagestyle{empty}

\clearpage
\tableofcontents
\clearpage
\end{document}
  • Thanks, but I need the all of this information to be on one page, not two. – Jenna Adler Aug 21 '14 at 0:10
  • @JennaAdler Please see the edit. – user11232 Aug 21 '14 at 0:29
1

This answer uses the titling package to set things up. The first part answers the original question which had the title split across the first two pages. The second part answers the secondary question raised in the comments responding to Harish Kumar's answer.

Part I

This uses \maketitle twice with different settings, restoring the defaults in between using a new command, \restoredefaults:

\documentclass{article}
\usepackage{titling}
\newcommand{\restoredefaults}{%
  \pretitle{\begin{center}\LARGE}
  \posttitle{\par\end{center}\vskip 0.5em}
  \preauthor{\begin{center}
  \large \lineskip 0.5em%
  \begin{tabular}[t]{c}}
  \postauthor{\end{tabular}\par\end{center}}
  \predate{\begin{center}\large}
  \postdate{\par\end{center}}}
\begin{document}
  \pretitle{\large\centering}
  \posttitle{\par}
  \preauthor{\large\centering}
  \postauthor{\par}
  \predate{\large\centering}
  \postdate{\par}
  \title{for the purpose}
  \author{My Report}
  \maketitle
  \newpage
  \restoredefaults
  \title{Some title}
  \author{My Name}
  \date{}% for empty date with \maketitle
  \maketitle
  \thispagestyle{empty}
  \clearpage
  \tableofcontents
  \clearpage
\end{document}

split title

Part II

The following solution uses the \maketitlehooka facility from \titling and sets up two new commands \purpose{} and \preliminarytitle{} to hold the relevant information. Each takes one mandatory argument. Today's date is hard-coded although you could obviously change that if you wished.

\documentclass{article}
\usepackage{titling}
\newcommand{\purpose}[1]{%
  \renewcommand{\docpurpose}{#1}}
\newcommand{\prelimtitle}[1]{%
  \renewcommand{\docprelimtitle}{#1}}
\newcommand{\docpurpose}{}
\newcommand{\docprelimtitle}{}
\renewcommand{\maketitlehooka}{%
  \centering
  \large
  \docpurpose\par
  \docprelimtitle\par
  \today\par}
\begin{document}
  \purpose{for the purpose}
  \prelimtitle{My Report}
  \title{Some title}
  \author{My Name}
  \date{}% for empty date with \maketitle
  \maketitle
  \thispagestyle{empty}
  \clearpage
  \tableofcontents
  \clearpage
\end{document}

unified title

If you would prefer the additional information to be further above the remainder of the title, set the length \droptitle to an appropriate value.

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.