1

I have trouble obtaining the needed space after redefining \maketitle in the article class. I do not want the spacing after the title to depend on whether I start with \section or not.

For instance,

\documentclass{article}

\makeatletter
\def\@maketitle{\Huge\textbf{New Title}}
\makeatother

\begin{document}

    \maketitle

    Some text
\end{document}

yields a much smaller space after the title than

\documentclass{article}

\makeatletter
\def\@maketitle{\Huge\textbf{New Title}}
\makeatother

\begin{document}

    \maketitle

    \section{Some section}

    Some text
\end{document}

I understand why this is the case, and it is trivial to add the needed space manually, but I am wondering if LaTeX can do it for me.

3
  • You can add the desired skip as part of the definition, as in\def\@maketitle{\Huge\textbf{New Title}\bigskip}. \section adds its own pre-skip in your 2nd example. Jun 30, 2022 at 22:27
  • @StevenB.Segletes It seems like there will then be two \bigskip when using \section, is that correct?
    – Zuy
    Jul 1, 2022 at 5:16
  • Yes, \section will always adds its own space, in addition. Jul 1, 2022 at 10:29

1 Answer 1

3

Based on OP comments, it seems that it is desired to make the vertical space conditional, only adding it if there is not additional vertical space added by another following command, for example, \section.

In this case, you are looking for \addvspace, which must be invoked in vertical mode. Thus, adding \par\addvspace{<length>} to the end of your revised \maketitle will only add this space if is not already being added by what follows.

In the MWE, you can comment and uncomment the \section command to see the result.

\documentclass{article}

\makeatletter
\def\@maketitle{\Huge\textbf{New Title}\par\addvspace{15pt}}
\makeatother

\begin{document}

    \maketitle

%\section{Title}
    Some text
\end{document}

With no following \section:

enter image description here

With following \section:

enter image description here

You must log in to answer this question.

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