As per this answer, \par should properly end the effect of \centering. But in the following case, it doesn't. Why?
\documentclass{article}
\makeatletter
\newcommand\@mytitle{} % create macro for title
\newcommand\mytitle[1]{\renewcommand\@mytitle{#1}}
\newcommand\@myauthor{} % create macro for author
\newcommand\myauthor[1]{\renewcommand\@myauthor{#1}}
\newcommand{\articletitle}{%
\centering%
\fontsize{18bp}{18bp}\selectfont%
\@mytitle\par%
\vspace{\baselineskip}%
\fontsize{14bp}{14bp}\selectfont%
\@myauthor\par%
\fontsize{12bp}{12bp}\selectfont%
\vspace{2\baselineskip}\par}%
\makeatother
\mytitle{This is my title}
\myauthor{This is the author}
\AtBeginDocument{\articletitle}
\begin{document}
I start writing here
\end{document}

%at line endings serves no purpose whatsoever!;-)(Except for those introducing a comment, of course.) – egreg Aug 30 '15 at 19:25%at the end of every line just in case, as I didn't really have a good understanding of when it was needed or not. I understand more now, but not enough that I dare ridding myself of this habit:)– Sverre Aug 30 '15 at 21:11;-)http://river-valley.zeeba.tv/conferences/tug-2015 – egreg Aug 30 '15 at 21:12