I would like to use lineno with elsevier class elsart. However, amsmath
makes some conflicts, namely the line number does not appear in all
lines. Please compile the code below with and without the line
\usepackage{amsmath}
Thans for some help,
Diego
RESULT OF \listfiles
*File List*
elsart.cls 2006/05/01, 2.19: Elsevier
latexsym.sty 1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
ulasy.fd 1998/08/17 v2.2e LaTeX symbol font definitions
amsmath.sty 2000/07/18 v2.13 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
lineno.sty 2005/01/10 line numbers on paragraphs v4.1c
***********
\listfiles
\documentclass{elsart}
\usepackage{amsmath}
\usepackage{lineno}
\linenumbers
\begin{document}
In the following we will briefly discuss nonspecificity for finite
sets and for convex subsets of $R^d$. For details the
reader is referred to XXX.
\subsection{Nonspecificity for finite sets}
Consider the following problem: given a finite set $E$ of balls,
which contains a black ball, while the rest are white, we would like
to measure the amount of information $H$ required to find the
black ball. Suppose that the set of balls $E$ has $m \times n$
elements. If this set is partitioned into $n$ sets of $m$ balls or
into $m$ sets of $n$ balls, the measure of nonspecificity $H$
characterizing all those sets will be
\begin{equation}
H(m \times n) = H(m) + H(n) \label{eq:ax1ns}
\end{equation}
Also, note that the larger the set of balls $E$, the less specific
the predictions are, and in consequence
\begin{equation}
H(n) \leq H(n+1) \label{eq:ax2ns}
\end{equation}
where $n := \|E\|$.
xxx proposed the formula
\begin{equation}
H(n) := \log_2 n
\end{equation}
where $n := \|E\|$, and XXX showed that this is
the unique expression that satisfies equations \ref{eq:ax1ns}
and \ref{eq:ax2ns} up to the normalization $H(2)=1$.
This function is known in the literature as the \emph{Hartley
measure} of uncertainty, and it measures the lack of specificity
of a finite set.
\end{document}
\begin{linenomath}
\end{linenomath}
surrounding all math, it can work. However, this solution is not
nice... too much work.
\let\oldequation\equation
\let\endoldequation\endequation
\renewenvironment{equation}%
{\begin{linenomath}\begin{oldequation}}%
{\end{oldequation}\end{linenomath}}
the equation command is redefined...
But I have problems with this:
\let\oldalign\align
\let\endoldalign\endalign
\renewenvironment{align}%
{%
\begin{linenomath}%
\oldalign%
}%
{\oldendalign%
\end{linenomath}%
}
I get the error:
! LaTeX Error: \begin{linenomath} on input line 286 ended by
\end{align}.
What should I do?
read the amsmath "technote.pdf" for the reasons for this. i guess
\let\oldalign\align
\let\endoldalign\endalign
\renewenvironment{align}%
{%
\begin{linenomath}%
\let\align\oldalign
\let\endalign\endoldalign
\begin{align}%
}%
{\end{align}%
\end{linenomath}%
}
would do the trick for you.
--
Robin Fairbairns, Cambridge
I get the error:
! LaTeX Error: \begin{linenomath} on input line 66 ended by
\end{document}.
Here is the minimal document:
\listfiles
\documentclass{elsart}
\usepackage{amsmath}
\usepackage{lineno}
\let\oldequation\equation
\let\endoldequation\endequation
\renewenvironment{equation}%
{\begin{linenomath}\begin{oldequation}}%
{\end{oldequation}\end{linenomath}}
\let\oldalign\align
\let\endoldalign\endalign
\renewenvironment{align}%
{%
\begin{linenomath}%
\let\align\oldalign
\let\endalign\endoldalign
\begin{align}%
}%
{\end{align}%
\end{linenomath}%
}
%
% \let\oldalign\align
% \let\endoldalign\endalign
% \renewenvironment{align}%
% {%
% \begin{linenomath}%
% \oldalign%
% }%
% {\oldendalign%
% \end{linenomath}%
% }
\linenumbers
\begin{document}
In the following we will briefly discuss nonspecificity for finite
sets and for convex subsets of $R^d$. For details the
reader is referred to XXX.
\subsection{Nonspecificity for finite sets}
Consider the following problem: given a finite set $E$ of balls,
which contains a black ball, while the rest are white, we would like
to measure the amount of information $H$ required to find the
black ball. Suppose that the set of balls $E$ has $m \times n$
elements. If this set is partitioned into $n$ sets of $m$ balls or
into $m$ sets of $n$ balls, the measure of nonspecificity $H$
characterizing all those sets will be
\begin{linenomath}
\begin{equation}
H(m \times n) = H(m) + H(n) \label{eq:ax1ns}
\end{equation}
\end{linenomath}
joint and conditional Hartley measures. Given a set $R \subseteq X
\times Y$, whose projections on the sets $X$ and $Y$ are given by
$R^X:=\operatorname{proj}_X(R)$ and $R^Y:=\operatorname{proj}_Y(R)$
where the \emph{projection
operators} $\operatorname{proj}_X:X \times Y \to X$ and
$\operatorname{proj}_Y:X \times Y \to Y$ stand for,
\begin{align}
\operatorname{proj}_X(\gamma) &:= \{x \in X : \exists y \in Y,
(x,y)\in \gamma\} \\
\operatorname{proj}_Y(\gamma) &:= \{y \in Y : \exists x \in X,
(x,y)\in \gamma\}
\end{align}
given $\gamma \subseteq X\times Y$. These measures are defined by,
\begin{align}
%\HL(R^X|R^Y) &:= \HL(R) - \HL(R^Y) \label{eq:HLXY} \\
%\HL(R^Y|R^X) &:= \HL(R) - \HL(R^X) \label{eq:HLYX}
HL(R|R^Y) &:= HL(R) - HL(R^Y) \label{eq:HLXY} \\
HL(R|R^X) &:= HL(R) - HL(R^X) \label{eq:HLYX}
\end{align}
\section{Random sets} \label{sec:randomsets}
This section is a minimal introduction to RS theory. The reader is
Also, note that the larger the set of balls $E$, the less specific
the predictions are, and in consequence
\begin{linenomath}
\begin{equation}
H(n) \leq H(n+1) \label{eq:ax2ns}
\end{equation}
\end{linenomath}
where $n := \|E\|$.
xxx proposed the formula
\begin{linenomath}
\begin{equation}
H(n) := \log_2 n
\end{equation}
\end{linenomath}
where $n := \|E\|$, and XXX showed that this is
the unique expression that satisfies equations \ref{eq:ax1ns}
and \ref{eq:ax2ns} up to the normalization $H(2)=1$.
This function is known in the literature as the \emph{Hartley
measure} of uncertainty, and it measures the lack of specificity
of a finite set.
\end{document}
\linenumbers
\begin{document}
\begin{equation}
H(m \times n) = H(m) + H(n) \label{eq:ax1ns}
\end{equation}
joint and conditional Hartley measures. Given a set $R \subseteq X
\times Y$, whose projections on the sets $X$ and $Y$ are given by
$R^X:=\operatorname{proj}_X(R)$ and $R^Y:=\operatorname{proj}_Y(R)$
where the \emph{projection
operators} $\operatorname{proj}_X:X \times Y \to X$ and
$\operatorname{proj}_Y:X \times Y \to Y$ stand for,
\begin{align}
\operatorname{proj}_X(\gamma) &:= \{x \in X : \exists y \in Y,
(x,y)\in \gamma\} \\
\operatorname{proj}_Y(\gamma) &:= \{y \in Y : \exists x \in X,
(x,y)\in \gamma\}
\end{align}
given $\gamma \subseteq X\times Y$. These measures are defined by,
\begin{align}
%\HL(R^X|R^Y) &:= \HL(R) - \HL(R^Y) \label{eq:HLXY} \\
%\HL(R^Y|R^X) &:= \HL(R) - \HL(R^X) \label{eq:HLYX}
HL(R|R^Y) &:= HL(R) - HL(R^Y) \label{eq:HLXY} \\
HL(R|R^X) &:= HL(R) - HL(R^X) \label{eq:HLYX}
\end{align}
\section{Random sets} \label{sec:randomsets}
This section is a minimal introduction to RS theory. The reader is
Also, note that the larger the set of balls $E$, the less specific
the predictions are, and in consequence
\begin{equation}
H(n) \leq H(n+1) \label{eq:ax2ns}
\end{equation}
where $n := \|E\|$.
xxx proposed the formula
\begin{equation}
H(n) := \log_2 n
\end{equation}
no matter: as soon as you said it didn't work, i realised my mistake...
> \let\oldalign\align
> \let\endoldalign\endalign
> \renewenvironment{align}%
> {%
> \begin{linenomath}%
> \let\align\oldalign
> \let\endalign\endoldalign
> \begin{align}%
> }%
> {\end{align}%
> \end{linenomath}%
> }
we need to hack things up even more drastically:
\let\oldalign\align
\let\endoldalign\endalign
\renewenvironment{align}%
{%
\gobblealign
}%
{}
\def\gobblealign#1\end#2{%
\begin{linenomath}%
\let\align\oldalign
\let\endalign\endoldalign
\begin{align}#1\end{align}%
\end{linenomath}%
\end{align}%
}
i've actually tested this one. note: i'm running an old lineno.sty
and am on a testing system, which precludes patching, just now :-(
--
Robin Fairbairns, Cambridge
> we need to hack things up even more drastically:
>
> \let\oldalign\align
> \let\endoldalign\endalign
> \renewenvironment{align}%
> {%
> \gobblealign
> }%
> {}
>
> \def\gobblealign#1\end#2{%
> \begin{linenomath}%
> \let\align\oldalign
> \let\endalign\endoldalign
> \begin{align}#1\end{align}%
> \end{linenomath}%
> \end{align}%
> }
>
> i've actually tested this one. note: i'm running an old lineno.sty
> and am on a testing system, which precludes patching, just now :-(
What is the problem with (tested with example using article class):
\let\oldalign\align
\let\endoldalign\endalign
\renewenvironment{align}{%
\linenomath
\oldalign
}{%
\endoldalign
\endlinenomath
}
Yours sincerely
Heiko <ober...@uni-freiburg.de>
Your patch also works, and is so simple!!! shame on me :-(