# Issue with mathmode in command

First off I'm new to Latex so my understanding of the Language is quite limited.

I want to print a Formula with cases for the convergence of geometric series i learnt like this(without box):

Now im getting multiple errors due to the mathmode. I tried a lot of configurations but none of them solved the problem.

I'd be glad to have a solution to my problem and of course, if possible, a good explanation so that i don't trip over the same issue again.

The following code is a sample of my full code including an own command i created:


\newcommand{\symbonsymb}[2]{\mathrel{\underset{\makebox[0pt]{\mbox{\normalfont\tiny #2}}}{#1}}}

$\sum\limits_{k=k_0}^{$\infty$}x^k=\symbonsymb{lim}{$n\rightarrow\infty$}\frac{x^m-x^{n+1}}{1-x}= \begin{cases*} \frac{x^m}{1-x} & x\in]-1,1[\setminus\{0\} \\ divergent & \:else \end{cases*}$


Thank you in advance for any answers For Notice: Im using TexStudio

• Welcome to TeX.SE... Please post the MWE always as in executable format... – MadyYuvi Dec 23 '19 at 13:52

\lim is the default tag available in TeX, so no need to redefine it, please refer the updated MWE:

\documentclass{book}
\usepackage{mathtools}

\begin{document}

$\sum\limits_{k=k_0}^{\infty}x^k=\lim_{n\rightarrow\infty}\frac{x^m-x^{n+1}}{1-x}= \begin{cases} \frac{x^m}{1-x} & x\in]-1,1[\setminus\{0\} \\ \text{divergent} & \text{else } \end{cases}$

\end{document}


Output:

PS: Sorry few of the handwritten symbols are not able to understand, so just I followed your codes...

• The spacing around ] ... [ is bad. These should be \mathopen] ... \mathclose[. Also, this would be handled better as a display, with $...$ rather than \$ signs. – barbara beeton Dec 23 '19 at 14:12
• What does MWE stand for? – Fomps Dec 23 '19 at 15:44
• "@Fomps -- An "MWE" is a Minimum (non-)Working Example". See I've just been asked to write a minimal example, what is that? – barbara beeton Dec 23 '19 at 20:41

Such a complex formula should be displayed, to begin with.

Next, I'm not sure where you found the code for \symbonsymb, but it is wrong under many respects. The right command here is \lim.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\sum_{k=m}^{\infty} x^k = \lim_{n\rightarrow\infty}\frac{x^m-x^{m+n+1}}{1-x} = \begin{cases} \dfrac{x^m}{1-x} & x\in \mathopen]-1,1\mathclose[ \\[2ex] \text{divergent} & \text{else} \end{cases}$

\end{document}


For French style intervals, note that you need to use \mathopen and \mathclose in order to override the standard nature of the brackets.

I also fixed the math: either you use k0 in both places or m. Besides, the series is obviously convergent for x = 0, unless the starting index m is negative. In that case it's wrong to say that the series is divergent, because it is undefined in the first place.