# Problem in defining new environment [duplicate]

Since I want to add line number in my manuscript, I have to wrap align environment into linenomath environment to have right numbering. I wanted to define new environment in preamble in which I want Latex to put the math inputting into these environments, but It didn't work. Can you help me please? Here is my codes.

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[switch*, displaymath,pagewise, mathlines]{lineno}
\leftlinenumbers
\linenumbers

\newenvironment{Align}{\begin{linenomath*}  \begin{align}}{\end{align}
\end{linenomath*}}

\begin{document}
\begin{Align}
x+y=10
\end{Align}
\end{document}


## marked as duplicate by clemens, user13907, JPi, Jesse, egreg align StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Sep 25 '16 at 15:50

• Not clear what you want. Should lines of display maths be numbered or not? – Bernard Sep 25 '16 at 12:28
• ... "but it didn't work". Please be more specific. E.g., do tell us if you get an error and/or warning messages. – Mico Sep 25 '16 at 12:38
• @Bernard I guess line numbers should be omitted for aligned math. – gernot Sep 25 '16 at 13:31
• @gernot: But that is the default! B.t.w., the displaymath is obsolete: it's the default now. – Bernard Sep 25 '16 at 13:33
• @Bernard True. Strange. So the purpose remains a mystery, but the problem is solved ;-) – gernot Sep 25 '16 at 13:37

This is a particular problem of the align environment, see also newenvironment: error with \begin{align} and \end{align}. In your case, you have to define your environment as
\newenvironment{Align}%

• Yes, but lineno doesn't seem to work correctly with align: it displays two consecutive numbers (one above the other) for the last line, even if there's only one line. – Bernard Sep 25 '16 at 13:32
• @Bernard Well, no harm is done: \linenomathNonumbers suppresses line numbers. – gernot Sep 25 '16 at 13:42