3

I'm new to LaTeX. I was writing this equation the other day.

\begin{equation}
 \sum_{1}^{n} =
   \left\{\begin{array}{lr}
       1, & n=1\\
       n+\sum_{1}^{n-1}, &\forall n>1
    \end{array}\right.
 \end{equation}

But when I executed it, there was always this (1) dangling on the side.

enter image description here

Can anyone help get rid of it?

JamesT
  • 3,169
Sean
  • 95
  • 1
    JamesT has answered your question, but the idea of the (1) is that elsewhere in your paper you can say "as we saw/see in Equation (1)". You can even use LaTeX's label/ref mechanism to have the (1) automatically change if you rearrange your equations. – Teepeemm May 31 '23 at 12:45

2 Answers2

7

You need to use the starred environments to remove the automatic equation numbering i.e. \begin{equation*} and \end{equation*}:

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document} \begin{equation} \sum_{1}^{n} = \left{\begin{array}{lr} 1, & n=1\ n+\sum_{1}^{n-1}, &\forall n>1 \end{array}\right. \end{equation} \end{document}


A more succinct way that reduces typing is to follow the advice from @barbara beeton and use \[ and \] to wrap the one-line equation in:

\documentclass{article}

\usepackage{mathtools}

\begin{document} [ \sum_{1}^{n} = \left{\begin{array}{lr} 1, & n=1\ n+\sum_{1}^{n-1}, &\forall n>1 \end{array}\right. ] \end{document}

which produces the same output image.

JamesT
  • 3,169
  • 1
    Thank you very much! – Sean May 31 '23 at 00:40
  • 4
    @Sean - The "starred" varieties of LaTeX commands and environments often [but not universally] serve to eliminate numbering. This is the case not only for equation/equation* display-math environments, but also for other, multi-line math environments -- align vs. align*, gather vs. gather*, etc -- and for commands such as \chapter, \section, and \subsection. To create unnumbered chapter, section, and subsection level headers, just write \chapter*, \section*, and \subsection*. – Mico May 31 '23 at 05:23
  • 1
    An alternative to equation* is to wrap the (one-line) display in \[ ... \]. – barbara beeton May 31 '23 at 12:46
2

Using cases enviroment.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{equation*}
\sum_{1}^{n} = \begin{cases}
       1, & n=1\\
       n+\sum_{1}^{n-1}, &\forall n>1
\end{cases}
\end{equation*}
\end{document}

enter image description here

Sebastiano
  • 54,118