![模板中未对齐的抽象部分](https://linux22.com/image/344153/%E6%A8%A1%E6%9D%BF%E4%B8%AD%E6%9C%AA%E5%AF%B9%E9%BD%90%E7%9A%84%E6%8A%BD%E8%B1%A1%E9%83%A8%E5%88%86.png)
我最近下载了一个适合我的风格的模板。在自己配置了一点之后,出现了一个问题。摘要部分现在与其余文本不一致。
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[fleqn,9pt]{SelfArx} % Document font size and equations flushed left
\usepackage[english]{babel} % Specify a different language here - english by default
%----------------------------------------------------------------------------------------
% COLORS
%----------------------------------------------------------------------------------------
\definecolor{color1}{RGB}{0,0,90} % Color of the article title and sections
\definecolor{color2}{RGB}{0,20,20} % Color of the boxes behind the abstract and headings
%----------------------------------------------------------------------------------------
% HYPERLINKS
%----------------------------------------------------------------------------------------
\usepackage{hyperref} % Required for hyperlinks
\hypersetup{hidelinks,colorlinks,breaklinks=true,urlcolor=color2,citecolor=color1,linkcolor=color1,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}
%----------------------------------------------------------------------------------------
% ARTICLE INFORMATION
%----------------------------------------------------------------------------------------
\JournalInfo{Journal, Vol. XXI, No. 1, 1-5, 2013} % Journal information
\Archive{Additional note} % Additional notes (e.g. copyright, DOI, review/research article)
\PaperTitle{Article Title} % Article title
\Authors{John Smith\textsuperscript{1}*, James Smith\textsuperscript{2}} % Authors
\affiliation{\textsuperscript{1}\textit{Department of Biology, University of Examples, London, United Kingdom}} % Author affiliation
\affiliation{\textsuperscript{2}\textit{Department of Chemistry, University of Examples, London, United Kingdom}} % Author affiliation
\affiliation{*\textbf{Corresponding author}: [email protected]} % Corresponding author
\Keywords{Keyword1 --- Keyword2 --- Keyword3} % Keywords - if you don't want any simply remove all the text between the curly brackets
\newcommand{\keywordname}{Keywords} % Defines the keywords heading name
%----------------------------------------------------------------------------------------
% ABSTRACT
%----------------------------------------------------------------------------------------
\Abstract{}
%----------------------------------------------------------------------------------------
\begin{document}
\flushbottom % Makes all text pages the same height
\maketitle % Print the title and abstract box
\tableofcontents % Print the contents section
\thispagestyle{empty} % Removes page numbering from the first page
%----------------------------------------------------------------------------------------
% ARTICLE CONTENTS
%----------------------------------------------------------------------------------------
\section*{Introduction} % The \section*{} command stops section numbering
\addcontentsline{toc}{section}{Introduction} % Adds this section to the table of contents
%------------------------------------------------
\section{Methods}
\subsection{Subsection}
\subsection{Subsection}
%------------------------------------------------
\section{Results and Discussion}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsection{Subsubsection}
\subsubsection{Subsubsection}
\subsection{Subsection}
%------------------------------------------------
\phantomsection
\section*{Acknowledgments} % The \section*{} command stops section numbering
\end{document}
上面包含的类用以下代码指定:
\NeedsTeXFormat{LaTeX2e}
\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=0.8cm,%
right=0.8cm,%
top=1.8cm,%
bottom=1.8cm,%
headheight=11pt,%
a4paper]{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}
{}
{0em}
{#1}
\titlespacing*{\section}{0pc}{3ex \@plus4pt \@minus3pt}{5pt}
\titlespacing*{\subsection}{0pc}{2.5ex \@plus3pt \@minus2pt}{0pt}
\titlespacing*{\subsubsection}{0pc}{2ex \@plus2.5pt \@minus1.5pt}{0pt}
\titlespacing*{\paragraph}{0pc}{1.5ex \@plus2pt \@minus1pt}{10pt}
%----------------------------------------------------------------------
% TABLEOFCONTENTS SET-UP
%----------------------------------------------------------------------
\newlength{\tocsep}
\setlength\tocsep{1.5pc} % Sets the indentation of the sections in the table of contents
\setcounter{tocdepth}{3} % Three levels in the table of contents section: sections, subsections and subsubsections
\usepackage{titletoc}
\contentsmargin{0cm}
\titlecontents{section}[\tocsep]
{\addvspace{4pt}\small\bfseries\sffamily}
{\contentslabel[\thecontentslabel]{\tocsep}}
{}
{\hfill\thecontentspage}
[]
\titlecontents{subsection}[\tocsep]
{\addvspace{2pt}\sffamily}
{\contentslabel[\thecontentslabel]{\tocsep}}
{}
{\ \titlerule*[.5pc]{.}\ \thecontentspage}
[]
\titlecontents*{subsubsection}[\tocsep]
{\footnotesize\sffamily}
{}
{}
{}
[\ \textbullet\ ]
%----------------------------------------------------------------------
% MULTIPLE AUTHOR SET
%----------------------------------------------------------------------
\newcount\@authcnt
\newcount\@tmpcnt\@tmpcnt\z@
\def\@affiliation{%
\ifnum\@tmpcnt<\@authcnt
\global\advance\@tmpcnt1
\raggedright \csname @auth\romannumeral\the\@tmpcnt\endcsname\hfill\\%
\let\next\@affiliation \vskip1pt
\else
\let\next\relax
\fi
\next}
\newcommand{\affiliation}[1]{%
\global\advance\@authcnt1
\expandafter\gdef\csname @auth\romannumeral\the\@authcnt\endcsname
{#1}}
%----------------------------------------------------------------------
% LIST CONTROL
%----------------------------------------------------------------------
\RequirePackage{enumitem}
%\setlist{nolistsep} % Uncomment to remove spacing between items in lists (enumerate, itemize)
%----------------------------------------------------------------------
% ABSTRACT+AUTHOR FRAME
%----------------------------------------------------------------------
\newcommand{\PaperTitle}[1]{\def\@PaperTitle{#1}}
\newcommand{\Archive}[1]{\def\@Archive{#1}}
\newcommand{\Authors}[1]{\def\@Authors{#1}}
\newcommand{\JournalInfo}[1]{\def\@JournalInfo{#1}}
\newcommand{\Abstract}[1]{\def\@Abstract{#1}}
\newcommand{\Keywords}[1]{\def\@Keywords{#1}}
% ---------------------------------------------------------------------
\renewcommand{\@maketitle}{%
\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-4\fboxsep-2\fboxrule}{%
\ifx\@Keywords\@empty%
\sffamily\textbf{\abstractname}\\\@Abstract%
\else%
\sffamily\textbf{\abstractname}\\\@Abstract\\[4pt]%
\textbf{\keywordname}\\\@Keywords%
\fi%
}%
}%
\vskip4pt%
\begingroup%
\raggedright\sffamily\small%
\footnotesize\@affiliation\par%
\endgroup%%
}%
}%
\vskip25pt%
}
答案1
缩进是由段落中断引起的。我建议\parindent
在范围内将其设置为零,\maketitle{}
因为您根本不想在这里使用常规缩进。(我假设。)
请注意,除非在特殊上下文(例如和环境)\\
下,否则不应使用它来插入换行符。tabular
array
\begin{filecontents}{SelfArx.cls}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{SelfArx}[25/01/2012, v1.0]
\RequirePackage{ifthen}
\RequirePackage{calc}
\AtEndOfClass{\RequirePackage{microtype}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions*
\LoadClass{article}
\RequirePackage{ifpdf}
\RequirePackage{times}% package is deprecated and ought not be used
\RequirePackage{mathptmx}
\RequirePackage[utf8]{inputenc}
\RequirePackage{amsmath,amsfonts,amssymb}
\RequirePackage{graphicx,xcolor}
\RequirePackage{booktabs}
\RequirePackage[left=0.8cm,%
right=0.8cm,%
top=1.8cm,%
bottom=1.8cm,%
headheight=11pt,%
a4paper]{geometry}
\RequirePackage[labelfont={bf,sf,small},%
labelsep=period,%
justification=raggedright]{caption}
\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{0pt}
\RequirePackage{fancyhdr}
\RequirePackage{lastpage}
\pagestyle{fancy}
% Headers
\lhead{}
\chead{}
\rhead{\small\sffamily\bfseries\@PaperTitle\ --- \thepage/\pageref{LastPage}}
% Footers
\lfoot{}
\cfoot{}
\rfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\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}
{}
{0em}
{#1}
\titlespacing*{\section}{0pc}{3ex \@plus4pt \@minus3pt}{5pt}
\titlespacing*{\subsection}{0pc}{2.5ex \@plus3pt \@minus2pt}{0pt}
\titlespacing*{\subsubsection}{0pc}{2ex \@plus2.5pt \@minus1.5pt}{0pt}
\titlespacing*{\paragraph}{0pc}{1.5ex \@plus2pt \@minus1pt}{10pt}
\newlength{\tocsep}
\setlength\tocsep{1.5pc}
\setcounter{tocdepth}{3}
\usepackage{titletoc}
\contentsmargin{0cm}
\titlecontents{section}[\tocsep]
{\addvspace{4pt}\small\bfseries\sffamily}
{\contentslabel[\thecontentslabel]{\tocsep}}
{}
{\hfill\thecontentspage}
[]
\titlecontents{subsection}[\tocsep]
{\addvspace{2pt}\sffamily}
{\contentslabel[\thecontentslabel]{\tocsep}}
{}
{\ \titlerule*[.5pc]{.}\ \thecontentspage}
[]
\titlecontents*{subsubsection}[\tocsep]
{\footnotesize\sffamily}
{}
{}
{}
[\ \textbullet\ ]
\newcount\@authcnt
\newcount\@tmpcnt\@tmpcnt\z@
\def\@affiliation{%
\ifnum\@tmpcnt<\@authcnt
\global\advance\@tmpcnt1
\raggedright \csname @auth\romannumeral\the\@tmpcnt\endcsname\hfill\\%
\let\next\@affiliation \vskip1pt
\else
\let\next\relax
\fi
\next}
\newcommand{\affiliation}[1]{%
\global\advance\@authcnt1
\expandafter\gdef\csname @auth\romannumeral\the\@authcnt\endcsname
{#1}}
\RequirePackage{enumitem}
\newcommand{\PaperTitle}[1]{\def\@PaperTitle{#1}}
\newcommand{\Archive}[1]{\def\@Archive{#1}}
\newcommand{\Authors}[1]{\def\@Authors{#1}}
\newcommand{\JournalInfo}[1]{\def\@JournalInfo{#1}}
\newcommand{\Abstract}[1]{\def\@Abstract{#1}}
\newcommand{\Keywords}[1]{\def\@Keywords{#1}}
\renewcommand{\@maketitle}{%
\thispagestyle{empty}%
\setlength\parindent{0pt}%
\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-4\fboxsep-2\fboxrule}{%
\ifx\@Keywords\@empty
\sffamily\textbf{\abstractname}\par\@Abstract
\else
\sffamily\textbf{\abstractname}\par\@Abstract\vskip4pt\par
\textbf{\keywordname}\par\@Keywords
\fi
}%
}%
\vskip4pt%
\begingroup
\raggedright\sffamily\small
\footnotesize\@affiliation\par
\endgroup
}%
}%
\vskip25pt%
}
\end{filecontents}
\documentclass[fleqn,9pt]{SelfArx}
\usepackage[english]{babel}
\definecolor{color1}{RGB}{0,0,90}
\definecolor{color2}{RGB}{0,20,20}
\usepackage{hyperref}
\hypersetup{hidelinks,colorlinks,breaklinks=true,urlcolor=color2,citecolor=color1,linkcolor=color1,bookmarksopen=false,pdftitle={Title},pdfauthor={Author}}
\JournalInfo{Journal, Vol. XXI, No. 1, 1-5, 2013}
\Archive{Additional note}
\PaperTitle{Article Title}
\Authors{John Smith\textsuperscript{1}*, James Smith\textsuperscript{2}}
\affiliation{\textsuperscript{1}\textit{Department of Biology, University of Examples, London, United Kingdom}}
\affiliation{\textsuperscript{2}\textit{Department of Chemistry, University of Examples, London, United Kingdom}}
\affiliation{*\textbf{Corresponding author}: [email protected]}
\Keywords{Keyword1 --- Keyword2 --- Keyword3}
\newcommand{\keywordname}{Keywords}
\Abstract{As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown elsewhere, the phenomena should only be used as a canon for our understanding. The paralogisms of practical reason are what first give rise to the architectonic of practical reason. As will easily be shown in the next section, reason would thereby be made to contradict, in view of these considerations, the Ideal of practical reason, yet the manifold depends on the phenomena. Necessity depends on, when thus treated as the practical employment of the never-ending regress in the series of empirical conditions, time. Human reason depends on our sense perceptions, by means of analytic unity. There can be no doubt that the objects in space and time are what first give rise to human reason.}
\begin{document}
\flushbottom
\maketitle
\tableofcontents
\thispagestyle{empty}
\section*{Introduction}
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown elsewhere, the phenomena should only be used as a canon for our understanding. The paralogisms of practical reason are what first give rise to the architectonic of practical reason. As will easily be shown in the next section, reason would thereby be made to contradict, in view of these considerations, the Ideal of practical reason, yet the manifold depends on the phenomena. Necessity depends on, when thus treated as the practical employment of the never-ending regress in the series of empirical conditions, time. Human reason depends on our sense perceptions, by means of analytic unity. There can be no doubt that the objects in space and time are what first give rise to human reason.
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown elsewhere, the phenomena should only be used as a canon for our understanding. The paralogisms of practical reason are what first give rise to the architectonic of practical reason. As will easily be shown in the next section, reason would thereby be made to contradict, in view of these considerations, the Ideal of practical reason, yet the manifold depends on the phenomena. Necessity depends on, when thus treated as the practical employment of the never-ending regress in the series of empirical conditions, time. Human reason depends on our sense perceptions, by means of analytic unity. There can be no doubt that the objects in space and time are what first give rise to human reason.
\addcontentsline{toc}{section}{Introduction}
\section{Methods}
\subsection{Subsection}
\subsection{Subsection}
\section{Results and Discussion}
\subsection{Subsection}
\subsubsection{Subsubsection}
\subsubsection{Subsubsection}
\subsubsection{Subsubsection}
\subsection{Subsection}
\phantomsection
\section*{Acknowledgments}
\end{document}