[Tex/LaTex] Redefined maketitle gives error

document-classestitles

I'm currently using a template I found online, it included a .cls file that modified the usual \maketitle. Every time I compile with this class I get an error after the \maketitlesaying There's no line to end, here is the whole .cls I'm using:

% ---------------------------------------------------------------------
% Conference proceedings and article templates for
% personal open-archiving activities
% September 2012
% ---------------------------------------------------------------------

\ProvidesClass{SelfArx}[25/01/2012, v1.0]
\RequirePackage{ifthen}
\RequirePackage{calc}
\AtEndOfClass{\RequirePackage{microtype}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions*
\LoadClass{article}
\RequirePackage{ifpdf}      % Needed to pick between latex and pdflatex

%----------------------------------------------------------------------
%   FONTS
%----------------------------------------------------------------------

\RequirePackage{times}      % Loads the Times-Roman Fonts
\RequirePackage{mathptmx}   % Loads the Times-Roman Math Fonts

%----------------------------------------------------------------------
%   VARIOUS USEFUL PACKAGES
%----------------------------------------------------------------------

\RequirePackage[utf8]{inputenc}
\RequirePackage{amsmath,amsfonts,amssymb}
\RequirePackage{graphicx,xcolor}
\RequirePackage{booktabs}

%----------------------------------------------------------------------
%   MARGINS 
%----------------------------------------------------------------------

\RequirePackage[left=2cm,%
                right=2cm,%
                                top=2.25cm,%
                                bottom=2.25cm,%
                                headheight=11pt,%
                                letterpaper]{geometry}%

%----------------------------------------------------------------------
%   FIGURES AND TABLES CAPTIONS
%----------------------------------------------------------------------

\RequirePackage[labelfont={bf,sf,small},%
                labelsep=period,%
                justification=raggedright]{caption}
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{0pt}

%----------------------------------------------------------------------
%   PAGE HEADER
%----------------------------------------------------------------------

\RequirePackage{fancyhdr}  % Needed to define custom headers/footers
\RequirePackage{lastpage}  % Number of pages in the document
\pagestyle{fancy}          % Enables the custom headers/footers
% Headers
\lhead{}%
\chead{}%
\rhead{\small\sffamily\bfseries\@PaperTitle\  --- \thepage/\pageref{LastPage}}
% Footers
\lfoot{}%
\cfoot{}%
\rfoot{}%
\renewcommand{\headrulewidth}{0pt}% % No header rule
\renewcommand{\footrulewidth}{0pt}% % No footer rule

%----------------------------------------------------------------------
%   SECTION/SUBSECTION/PARAGRAPH SET-UP
%----------------------------------------------------------------------

\RequirePackage[explicit]{titlesec}
\titleformat{\section}
  {\color{color1}\large\sffamily\bfseries}
  {}
  {0em}
  {\colorbox{color2!10}{\parbox{\dimexpr\linewidth-2\fboxsep\relax}{\centering\arabic{section}. #1}}}
  []
\titleformat{name=\section,numberless}
  {\color{color1}\large\sffamily\bfseries}
  {}
  {0em}
  {\colorbox{color2!10}{\parbox{\dimexpr\linewidth-2\fboxsep\relax}{\centering#1}}}
  []  
\titleformat{\subsection}
  {\color{color1}\sffamily\bfseries}
  {\thesubsection}
  {0.5em}
  {#1}
  []
\titleformat{\subsubsection}
  {\sffamily\small\bfseries}
  {\thesubsubsection}
  {0.5em}
  {#1}
  []    
\titleformat{\paragraph}[runin]
  {\sffamily\small\bfseries}

and here is a minimal example that produces the error:

\documentclass[fleqn,10pt]{SelfArx} 

\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\setlength{\columnsep}{0.55cm} 
\setlength{\fboxrule}{0.75pt} 


\definecolor{color1}{RGB}{0,0,90} 
\definecolor{color2}{RGB}{0,20,20} 


\PaperTitle{Title} % Article title

\Authors{Julio Cáceres\textsuperscript{1}*} 
\affiliation{\textsuperscript{1}\textit{stuff}} 
\affiliation{*\textbf{Email}: e@mail.com} 


\Keywords{key1 -- key2 -- key3} 
\newcommand{\keywordname}{Keywords} 

\begin{document}
\flushbottom    

\maketitle

Hi there

\end{document}

Any help would be appreciated.

Best Answer

Firstly, the class file provided was not complete, this solution found it here SelfArx

It seems that what you meant by redefined maketitle giving errors is to remove the \JournalInfo \Archive and \Abstract, all requiring one arguments, but you did not mark out those corresponding definitions in the \@maketitle definition. Thus, when \maketile is issued, it expects those inputs. Since those were not supplied by user, it complains there is no line to end. To work around is (1) either provide those inputs (2) use \JournalInfo{~} \Archive{~} and \Abstract{~} to cheat or (3) mark out those input as shown below

\renewcommand{\@maketitle}{%
\twocolumn[{%
\thispagestyle{empty}%
\vskip-36pt%
%{\raggedleft\small\sffamily\bfseries\@JournalInfo\\
%\@Archive\par
%}%
\vskip20pt%
{\raggedright\color{color1}\sffamily\bfseries\fontsize{20}{25}\selectfont \@PaperTitle\par}%
\vskip10pt
{\raggedright\color{color1}\sffamily\fontsize{12}{16}\selectfont  \@Authors\par}
\vskip18pt%
\fcolorbox{color1}{white}{%
\parbox{\textwidth-2\fboxsep-2\fboxrule}{\centering%
\colorbox{color2!10}{%
\parbox{\textwidth-3.5\fboxsep-3.5\fboxrule}{%
\ifx\@Keywords\@empty
%\sffamily\small\textbf{\abstractname}\\
%\@Abstract
\else
%\sffamily\small\textbf{\abstractname}\\
%\@Abstract\\[5pt]%
\textbf{\keywordname}\\
\@Keywords%
\fi
}%
}%

results in

enter image description here

Code

\documentclass[fleqn,10pt]{SelfArx} 
%\usepackage[spanish]{babel}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\setlength{\columnsep}{0.55cm} 
\setlength{\fboxrule}{.75pt} 


\definecolor{color1}{RGB}{0,0,90} 
\definecolor{color2}{RGB}{0,20,20} 


\PaperTitle{Title} % Article title

\Authors{Julio Cáceres\textsuperscript{1}*} 
\affiliation{\textsuperscript{1}\textit{stuff}} 
\affiliation{*\textbf{Email}: e@mail.com} 



\Keywords{key1 -- key2 -- key3} 
\newcommand{\keywordname}{Keywords} 


\begin{document}
\flushbottom   

\maketitle

Hi there
\clearpage
Hi there again
\label{LastPage}
\end{document}