1
\usepackage{times}
\usepackage{graphicx}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[nointegrals]{wasysym}
\usepackage{amsmath}
\usepackage{pseudocode}
\usepackage{rotating}

I've used the following code to generate a formula with equation number, nevertheless, the equation number is not appeared:

\begin{align}
T(n) & \leq 2(c\lfloor n/2 \rfloor \lg( \lfloor n/2 \rfloor )) + n \\
T(n) & \leq 2(cn/2) \lg(n/2) + n \\
T(n) & = cn (\lg n - 1) + n \\
T(n) & \leq cn \lg n
\end{align}

The packages used are as above.

Thanks in advance.

EDIT:

The culprit is found if I put the following line that uses indent command before invoking align command:

\indent $ratio_{actual}$ = ground truth ratio between width and length of the box \nonumber \\

I'm still curious how I would still use the align command while preserving the indent command.

  • 1
    No problems here, assuming the article class. – Paul Gessler Apr 12 '14 at 22:30
  • 2
    it'd be great if you could make your snippets into a complete MWE - not only will it help the community, but it will also help you to diagnose the problem :) – cmhughes Apr 12 '14 at 22:35
  • Did you try using align or aligned inside equation environment? – MattAllegro Apr 13 '14 at 1:21
  • I found the culprit as the above EDIT, but still hunting for the remedy. – alfa_80 Apr 13 '14 at 2:36
  • @PaulGessler: Yes, it is an article class. – alfa_80 Apr 13 '14 at 2:37
2

If you remove the \nonumber \\ as I have commented out below you get the numbering:

enter image description here

Notes:

  • I am not sure what purpose the \nonumber \\ was to serve. I don't think there should be a need to use a \\ outside of a tabular or math environment.
  • Also, I added a \mathrm to the ratio and actual as I don't think that is more appropriate.
  • Have also removed the \indent as I am not sure as to why you need it. But, it does not effect the numbering of the align environment.

Code:

\documentclass{article}

\usepackage{times}
\usepackage{graphicx}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[nointegrals]{wasysym}
\usepackage{amsmath}
\usepackage{pseudocode}
\usepackage{rotating}

\begin{document}

$\mathrm{ratio}_{\mathrm{actual}}$ = ground truth ratio between width and length of the box  %\nonumber \\
\begin{align}
T(n) & \leq 2(c\lfloor n/2 \rfloor \lg( \lfloor n/2 \rfloor )) + n \\
T(n) & \leq 2(cn/2) \lg(n/2) + n \\
T(n) & = cn (\lg n - 1) + n \\
T(n) & \leq cn \lg n
\end{align}
\end{document}
  • Thanks anyway, I found another way of resolving it, but this is helpful too. – alfa_80 Apr 13 '14 at 4:36
  • @Shah: You should post an answer then. You probably are not the last person to encounter this problem so posting an answer will be helpful. – Peter Grill Apr 13 '14 at 5:05
  • I've added but it needs two days for it to be approved. Even so, I'll give a more concrete one. Thanks for reminding me :-) – alfa_80 Apr 13 '14 at 5:34
0

I found out that omitting \nonumber command in the \indent command solves the issue. So, the resultant fix of it is as below:

\usepackage{times}
\usepackage{graphicx}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[nointegrals]{wasysym}
\usepackage{amsmath}
\usepackage{pseudocode}
\usepackage{rotating}

\indent $ratio_{actual}$ = ground truth ratio between width and length of the box \\

\begin{align}
T(n) & \leq 2(c\lfloor n/2 \rfloor \lg( \lfloor n/2 \rfloor )) + n \\
T(n) & \leq 2(cn/2) \lg(n/2) + n \\
T(n) & = cn (\lg n - 1) + n \\
T(n) & \leq cn \lg n
\end{align}
  • 1
    The \indent command is doing nothing here (you never need to use \indent in LaTeX) Never use \\ at the end of a paragraph, and never leave a blank line before a math display such as align. Also when posting questions and answers please always post complete documents as in Peter's answer. – David Carlisle Apr 13 '14 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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