3

So, this is building on Omitting the date when using \maketitle; but I'd still like to include the date in the page footer. This means \date{} isn't an option. (Of course, I'd like to get rid of the superfluous spacing in \maketitle as well.)

I'm using KOMA (specifically, scrartcl); but I couldn't hunt down a built-in way to disable this; does that exist? If not, can I use the {titling} package to do this?

\documentclass[paper=a4]{scrartcl}
\usepackage{scrlayer-scrpage}
\automark[subsection]{section}
\pagestyle{scrheadings}

\title{Something}
\author{Some Body}

\ofoot{\today}

\usepackage{blindtext}
\begin{document}
   \maketitle
   \blinddocument
\end{document}
  • 2
    It's always a good idea to provide the community with a minimal working example (MWE) so we don't have to construct one from scratch (regardless of how simple it may seem to you to do such a thing). Additionally, could you be specific about what you mean by "superfluous spacing in \maketitle"? Spacing above and below? how much do you want that to change? – Werner Jan 21 '16 at 21:25
  • Will do! The original post mentions that \date{} removes the line, but leaves invisible spacing that had been placed around it. This comment by Reid demonstrates one way to remove the spacing (but that still wipes out the actual \date{}.) – ELLIOTTCABLE Jan 21 '16 at 21:26
  • 3
    I don't get it. The date is still included in the footer if you add \date{}, adding that doesn't change \today. – Torbjørn T. Jan 21 '16 at 21:49
  • 1
    Oh. Hmmmm. In my original document, \today was evaluating to the numeral 0, so I assumed \date{} was resetting the date globally or something. Must be some un-related issue, I'll go digging … thank you! >,< – ELLIOTTCABLE Jan 21 '16 at 21:52
  • That's precisely why you make a minimal example to post here. Or just for troubleshooting. (Minimal examples are not a side-effect of sites like this.) – cfr Jan 22 '16 at 1:45
7

If you only wish to remove the \date-related entry in the title, then you can patch \@maketitle and remove the relevant content (using etoolbox):

enter image description here

\documentclass{scrartcl}
\usepackage{scrlayer-scrpage,etoolbox}
\automark[subsection]{section}
\pagestyle{scrheadings}

\title{Something}
\author{Some Body}

\ofoot{\today}

\usepackage{blindtext}

\makeatletter
% Remove \@date and spacing following it from \@maketitle
\patchcmd{\@maketitle}% <cmd>
  {{\usekomafont{date}{\@date \par}}%
    \vskip \z@ \@plus 1em}% <search>
  {}% <replace>
  {}{}% <success><failure>
\makeatother

\begin{document}

\maketitle
\blinddocument

\end{document}

The above

\patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}

searches for <search> in <cmd> and replaces it with <replace> (executing <success> on success of the patch, or <failure> otherwise). Since we're patching \@maketitle, let's look at its definition (in scrkernel-title.dtx):

\newcommand*{\@maketitle}{%
  \global\@topnum=\z@
  \ifx\@titlehead\@empty \else
    \begin{minipage}[t]{\textwidth}
      \usekomafont{titlehead}{\@titlehead\par}%
    \end{minipage}\par
  \fi
  \null
  \vskip 2em%
  \begin{center}%
    \ifx\@subject\@empty \else
      {\usekomafont{subject}{\@subject \par}}%
      \vskip 1.5em
    \fi
    {\usekomafont{title}{\huge \@title \par}}%
    \vskip .5em
    {\ifx\@subtitle\@empty\else\usekomafont{subtitle}\@subtitle\par\fi}%
    \vskip 1em
    {%
      \usekomafont{author}{%
        \lineskip .5em%
        \begin{tabular}[t]{c}
          \@author
        \end{tabular}\par
      }%
    }%
    \vskip 1em%
    {\usekomafont{date}{\@date \par}}%
    \vskip \z@ \@plus 1em
    {\usekomafont{publishers}{\@publishers \par}}%
    \ifx\@dedication\@empty \else
      \vskip 2em
      {\usekomafont{dedication}{\@dedication \par}}%
    \fi
  \end{center}%
  \par
  \vskip 2em
}%

The occurrence of

    {\usekomafont{date}{\@date \par}}%
    \vskip \z@ \@plus 1em

is replaced with with nothing (removed), since <replace> is empty. As such, no \@date is set, and neither is the usual \vskip space following it.

  • This is great! A little more exposition on what you're doing inside that patch might be good, but otherwise … accepted! <3 – ELLIOTTCABLE Jan 28 '16 at 5:13
  • @ELLIOTTCABLE: See my updated answer where I explain a little what the \patchcmd does. – Werner Jan 29 '16 at 1:11
  • Beaaaautiful! :D – ELLIOTTCABLE Jan 29 '16 at 2:52
0

Perhaps this might work:

\documentclass{article}
\usepackage{lipsum}
\usepackage{fancyhdr}
\fancyhf{}
\fancyfoot[L]{\today\ -Page \thepage}
  \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\author{Me}
\title{Foo}
\date{\vspace{-5ex}}

\begin{document}

\maketitle
\pagenumbering{gobble}  
\newpage
\pagenumbering{arabic}      
\lipsum

\end{document}
  • 3
    That answer is mildly non-compatible to the class the OP is using. – Johannes_B Jan 22 '16 at 7:19

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.