I wrote a class file, but I found if I want to change the space between the math environment and text by the solution provided by Stefan Kottwitz, the indentation appears in front of the 'abstract'. Here is the mwe,
\begin{filecontents}{mycls.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mycls}
\LoadClass{article}
\newdimen\@bls
\@bls=\baselineskip
\renewcommand\section{\@startsection {section}{1}{\z@}%
{1.2\@bls plus .3\@bls minus .1\@bls}%
{5pt\@afterindentfalse}%
{\sffamily\large\bfseries\raggedright}}
\newbox\absbox
\def\abstract{\lrbox\absbox\minipage{\textwidth}%
\sffamily%
\hspace{-\fill}\section*{\normalsize\noindent Abstract}\vskip -1.5mm\relax%
}
\def\endabstract{\endminipage\endlrbox}
\def\keywords#1{%
\gdef\@keywords{\begin{minipage}{\textwidth}{\normalsize\sffamily \textbf{Keywords}}\\ \parbox[t]{\textwidth}{#1}\end{minipage}}}
\let\@keywords\@empty
\def\@maketitle{{\noindent\usebox\absbox\par}
{\vspace{20pt}%
{\noindent\normalsize\@keywords}\par}{\vskip2em\relax}}
\end{filecontents}
\documentclass{mycls}
\usepackage{lipsum}
\begin{abstract}
\lipsum[1]
\end{abstract}
\keywords{Hello}
\begin{document}
\maketitle
\lipsum[1]
\begin{equation}\label{eq:test}
a^2+b^2=c^2
\end{equation}
\lipsum[1]
\end{document}
The class and code above gives

But if I add the code
\expandafter\def\expandafter\normalsize\expandafter{%
\normalsize
\setlength\abovedisplayskip{40pt}
\setlength\belowdisplayskip{40pt}
\setlength\abovedisplayshortskip{40pt}
\setlength\belowdisplayshortskip{40pt}
}
in the class file, the output will be
Some space appears in front of the 'abstract' and 'keywords'.
I want to know where the space comes from and how to cancel it.

%to remove unwanted spaces? – Johannes_B Sep 06 '16 at 06:31\normalsizein its own definition and provide a proper size fornormalzise. – Johannes_B Sep 06 '16 at 06:32{5pt\@afterindentfalse}%is wrong, that argument should be a positive or negative length. And there are lots of%missing from ends of lines so they will generate spaces in your output. every use of\normalsizeas defined above will add 4 spaces. – David Carlisle Sep 06 '16 at 06:48