Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The package lineno.sty is not numbering my abstract's lines. Any suggestions? Thanks.

\documentclass[a4paper,12pt]{amsart} 

\usepackage{indentfirst}
\usepackage{hyperref}
\usepackage{showkeys}

\usepackage{lineno}

\hyphenpenalty=5000
  \tolerance=1000


\begin{document}

\linenumbers

\title{Lineno in the Abstract}
\begin{abstract}
We do this, do that, ...
\end{abstract}

\maketitle

\section{Introduction}

\end{document}
share|improve this question
3  
Your example is not entirely a minimal one (e.g., the packages indentfirst, hyperref and showkeys aren't needed), but it does show the problem. I'm out of votes for today, but will upvote your question tomorrow. –  lockstep Feb 17 '11 at 23:42

2 Answers 2

up vote 7 down vote accepted

Seems to be an incompatibility between lineno and the amsart class. If I change the document class in your minimal example to article, the abstract's lines are numbered.

EDIT: See this answer for an in-depth explanation.

If you really need linenumbers and the amsart class (I would rather ditch amsart), here's a quick fix: Delete the abstract environment in your example. Instead, add the following immediately after \maketitle:

\vspace{-7pt}

\begin{quote}
\footnotesize
\textsc{Abstract.} We do this, do that, ...
\end{quote}

\vspace{21pt}
share|improve this answer
    
Hum, but that's quite bad... Any alternative? –  Florian Pei Feb 17 '11 at 23:41
    
@Florian: Hard to say ... I have no experience with amsart and don't know what to look for in its code. After you have verified my answer, delve into the documentations of both lineno and amsart for a suggested fix. Or wait some time if someone familiar with amsart drops by. –  lockstep Feb 17 '11 at 23:48
    
@lockstep: I'm a very beginner in TeX, so we better wait. Thanks anyway! –  Florian Pei Feb 18 '11 at 2:06
    
Not contrary to me at all! I was simply assuming that amsart was the sine qua non in this case. –  Loop Space Feb 18 '11 at 12:19
    
@Andrew: Fixed. –  lockstep Feb 18 '11 at 12:37

Page 1, lines 11-12 of the lineno states:

lineno.sty can only number lines in the main text. Lines in any kind of boxes cannot be numbered. But see section 7.4 below.

The AMS class file typesets the abstract as part of the title page, but the abstract is specified using an environment. So it has to slurp in the text and save it for reuse. It does that by using a box, precisely the situation that lineno.sty warns us against.

Section 7.4 may help but it is not a true numbering: it describes an extension of lineno.sty that simply typesets a list of numbers down the left in the vague hope that they will line up correctly with the lines in the box.

So to answer your question: No, I have no suggestions! Other than to ask, do you really need your abstract to have line numbers?


Okay, I do have a suggestion.

\documentclass{amsart}

\usepackage{lipsum}
\usepackage{lineno}

\makeatletter
\let\my@abstract=\relax
\def\abstract#1{%
  \def\my@abstract{%
    \normalfont\Small
    \list{}{\labelwidth\z@
      \leftmargin3pc \rightmargin\leftmargin
      \listparindent\normalparindent \itemindent\z@
      \parsep\z@ \@plus\p@
      \let\fullwidthdisplay\relax
    }%
    \item[\hskip\labelsep\scshape\abstractname.]%
    #1
  \endlist}}
\def\@setabstracta{%
  \ifx\my@abstract\relax
  \else
    \skip@20\p@ \advance\skip@-\lastskip
    \advance\skip@-\baselineskip \vskip\skip@
  \my@abstract
    \prevdepth\z@ % because \abstractbox is a vtop
  \fi
}
\makeatother

\linenumbers
\begin{document}
\title{Line numbering and amsart}

\abstract{%
\lipsum[1]}

\maketitle

\lipsum[2]

\end{document}

I don't particularly recommend it, and it needs a little adjusting to get the spacing right above and below. Basically, it reimplements the amsart abstract handling without using a box. It's ugly, it's hacky, and it probably just sent a coded signal to the AMS which will get me on their naughty list for years to come. But it does number the lines of the abstract and, apart from the spacing, it looks right.

amsart with lineno

share|improve this answer
    
Thanks! –  Florian Pei Feb 21 '11 at 8:10
1  
nah, not on the ams naughty list. the ams document classes are designed for specific purposes, and we don't promise to be compatible with all other packages. the reason the abstract is included as part of the top matter is to make it easier to segregate and pull out for use in the on-line contents list for ams journals. automated processes put tight restrictions on what is allowable. if an article were submitted with your coding, yes, we'd scream, but if it's just for your own use, what's the problem? –  barbara beeton Mar 23 '11 at 19:31
    
@barbara: Phew! I was worried there. I still have hopes of - one day! - getting an article accepted by one of the AMS journals so I'm pleased to hear that I haven't prejudiced my case. –  Loop Space Mar 23 '11 at 20:21
    
@barbara (actually, I'm misremembering. My first published article was in an AMS series. So I've already gotten one in. I now want to show that it wasn't a fluke!) –  Loop Space Mar 23 '11 at 21:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.