The abstract package
Changes the layout of the abstract environment (heading font, text font, indents) and provides onecolabstract for a full-width abstract in a two-column document.
Loading the package
\usepackage{abstract}The standard classes set the abstract in a fixed way: small type, a centred bold heading and indented margins. With this package each of these parts is a command or a length that you redefine.
In a document with the class option twocolumn, the abstract normally sits in the first column. onecolabstract inside the optional argument of \twocolumn sets title and abstract across both columns.
Main commands
\renewcommand{\abstractnamefont}{\normalfont\bfseries} | Font of the heading "Abstract". |
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} | Font of the abstract text. |
\setlength{\absleftindent}{1cm} | Indent of the abstract on the left; \absrightindent sets the right side. |
\renewcommand{\abstractname}{Summary} | Text of the heading. |
addtotoc | Option: adds the abstract to the table of contents. |
runin | Option: the heading starts the first line of the text instead of standing above it. |
\begin{onecolabstract} ... \end{onecolabstract} | Abstract across the full width in a two-column document. |
\saythanks | Prints the \thanks footnotes of the title when \maketitle stands inside \twocolumn[...]. |
Complete example
\documentclass[twocolumn]{article}
\usepackage{abstract}
\renewcommand{\abstractnamefont}{\normalfont\bfseries}
\renewcommand{\abstracttextfont}{\normalfont\small\itshape}
\title{Line numbers in long documents}
\author{A. Author}
\begin{document}
\twocolumn[
\maketitle
\begin{onecolabstract}
We compare two ways of numbering lines and measure the compile time of each.
\end{onecolabstract}
\vspace{1cm}
]
\saythanks
\section{Introduction}
The text of the article starts here, in two columns.
\end{document}Compiled with pdfLaTeX from TeX Live 2023.
Pitfalls
- Inside
\twocolumn[...]a closing square bracket ends the optional argument early. Put a command with an optional argument, such as\cite[p.~3]{key}, in braces there. - The package works with
articleandreport. With the classbook,\begin{abstract}stops with Undefined control sequence, because the class defines no\abstractname.
Related pages
- How-to Write an abstract in LaTeX
- How-to Two-column text in LaTeX
- How-to Create a title page in LaTeX