Problem:
How can I add lines numbers (with lineno) in the Abstract environment as defined in this Overleaf template?
The following piece of code is the Abstract definition, which is included in the wlscirep.cls file:
\def\xabstract{abstract}
\long\def\abstract#1\end#2{\def\two{#2}\ifx\two\xabstract
\long\gdef\theabstract{\ignorespaces#1}
\def\go{\end{abstract}}\else
\typeout{^^J^^J PLEASE DO NOT USE ANY \string\begin\space \string\end^^J
COMMANDS WITHIN ABSTRACT^^J^^J}#1\end{#2}
\gdef\theabstract{\vskip12pt BADLY FORMED ABSTRACT: PLEASE DO
NOT USE {\tt\string\begin...\string\end} COMMANDS WITHIN
THE ABSTRACT\vskip12pt}\let\go\relax\fi
\go}
My attempt:
In the main.tex file I added the following code:
\documentclass[fleqn,10pt]{wlscirep}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[displaymath]{lineno}
\linenumbers
\makeatletter
\let\LN@abstract\abstract
\let\LN@endabstract\endabstract
\renewcommand{\abstract}{\linenomath\LN@abstract}
\renewcommand{\endabstract}{\LN@endabstract\endlinenomath}
\makeatother
\begin{abstract}
bla bla bla bla bla bla bla bla bla bla ....
bla bla bla bla bla bla bla bla bla bla ....
bla bla bla bla bla bla bla bla bla bla ....
bla bla bla bla bla bla bla bla bla bla ....
\end{abstract}
\begin{document}
\flushbottom
\maketitle
\thispagestyle{empty}
\section*{My first section}
Here I write about .....
\end{document}
but I do not get the lines numbers in the Abstract. Any idea?
\documentclass{...}
and ending with\end{document}
.wlscirep
class? As has been discovered already, this document class is not coded in an optimal way which makes certain things very difficult to change. So, if not really necessary, I suggest that you use some other document class for your project.article
class, as things will probably be typeset again anyways using some other class or tools.