0

I am trying to add on separate lines "This version" and "First version". I have tried the following code, but it does not seem to work:

\renewcommand*{\today}{\normalsize{This draft: December 2018}} 
\renewcommand*{\newline}{\normalsize{First draft: March 2015}} 

Any help will be greatly appreciated.

The ideal outcome would look like as follows:

enter image description here

1
  • 3
    It would also be more helpful if you post a pic of how you want your final output looks like.
    – hesham
    Jan 26 '19 at 21:11
1

At first you need to define two commands in the preamble \thisdraft and \firstdraft which you are supposed to use later in your document. These commands includes the words of your choice (in your case "This draft: December 2018" and "First draft: March 2015"). Then place the commands as an arguments in the date{} commands of the article so that you ensure the commands output will be printed in the place designated for the date{} in the article title. The code will be as follows:

\documentclass{article}
%
%
\newcommand*{\thisdraft}{This draft: December 2018} % define command
\newcommand*{\firstdraft}{First draft: March 2015}  % define command
%
\title{Title}
\author{Name}
%
\date{\thisdraft \\ \firstdraft}

\begin{document}

\maketitle

\hrule % optional rule after title

\begin{abstract}
Type your abstract here.
\end{abstract}

\section{Sec One}

\end{document}

The output will be: enter image description here

You can later change the arguments of the commands \thisdraft and \firstdraft according to your needs.

2
  • 1
    In fact you can even automate the date in the command \thisdraft to print out the current month and year of your current document. To do this you shall need a little more details and using datetime or datetime2 package and defining the desired format for date. Anyway just wanted to keep things simple at least to your present needs.
    – hesham
    Jan 27 '19 at 20:19
  • Thank you very much @hesham!! You were extremely helpful.
    – Job
    Jan 28 '19 at 0:38
1

Why redefine such important commands? The commands \today and \newline that you are trying to re-define are mainly used in latex in many classes and packages definitions. Re-defining them may cause unnecessary issues.

You can use \newcommand*{\mytoday} and \newcommand*{\mynewline} instead a follows.

\newcommand*{\mytoday}{\normalsize{This draft: December 2018}} 
\newcommand*{\mynewline}{\normalsize{First draft: March 2015}} 

and then use them in the text as \mytoday{} and \mynewline{}.

I would also suggest choosing a better command name (e.g. \mytoday --> \myversion and \mynewline --> \myfirstversion).

3
  • Thanks very much, @hesham. I just tried your suggestion and still do not get the outcome.
    – Job
    Jan 27 '19 at 4:05
  • Any further suggestions will be greatly appreciated, @hesham!
    – Job
    Jan 27 '19 at 19:47
  • 1
    yes there is. plz wait
    – hesham
    Jan 27 '19 at 20:03

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.