我目前正在使用在线找到的模板,它包含一个.cls
修改了通常的文件。每次我用这个类编译时,在说完\maketitle
后都会出现错误,这是我正在使用的全部内容:\maketitle
There's no line to end
.cls
% ---------------------------------------------------------------------
% 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}
这是一个产生错误的最小示例:
\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}: [email protected]}
\Keywords{key1 -- key2 -- key3}
\newcommand{\keywordname}{Keywords}
\begin{document}
\flushbottom
\maketitle
Hi there
\end{document}
任何帮助,将不胜感激。
答案1
首先,提供的类文件不完整,解决方案在这里找到自学
看来您的意思redefined maketitle giving errors
是删除 \JournalInfo \Archive 和 \Abstract,它们都需要一个参数,但您没有在定义中标记出相应的定义\@maketitle
。因此,在\maketile
发布时,它会期望这些输入。由于这些输入不是由用户提供的,因此它会抱怨there is no line to end
。解决方法是 (1) 提供这些输入 (2) 使用 \JournalInfo{~} \Archive{~} 和 \Abstract{~} 来作弊或 (3) 标记出这些输入,如下所示
\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
}%
}%
结果是
代码
\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}: [email protected]}
\Keywords{key1 -- key2 -- key3}
\newcommand{\keywordname}{Keywords}
\begin{document}
\flushbottom
\maketitle
Hi there
\clearpage
Hi there again
\label{LastPage}
\end{document}