# Undefined Control Sequence,Missing $and Display math should end with $$I am trying to write the below equation and keep getting the various below errors. 1. Undefined control sequence 2. Missing  inserted 3. Display math should end with $$ I don't really understand the problem with my code. FYI...this is the code $$\label{eqn: current} I_{FS} = \sum_{\substack{i}}*\frac{1}{2}*\frac{W}{L}*(V_{gs}-V_{th})^2*(1+\lambdaV_{ds})=\frac{1}{2}*k*(V_{gs}-V_{th})^2*(1+\lambda*V_{ds})*\sum_{\substack{i}}*\frac{W}{L}$$  I have tried putting \equation also doesn't work. Previous to that, I used simple $...$ also, still useless. Would be glad if someone can point out the error and give me a fix for this issue as I am a new user to LaTeX. • Multiplication is usually not denoted with *; also \substack{i} can be just i: \substack is necessary only for multiline subscripts. – egreg Nov 27 '13 at 11:11 ## 2 Answers use $$\label{eqn: current} I_{FS} = \sum_{\substack{i}}*\frac{1}{2}*\frac{W}{L}*(V_{gs}-V_{th})^2*(1+\lambdaV_{ds})=\frac{1}{2}*k*(V_{gs}-V_{th})^2*(1+\lambda*V_{ds})*\sum_{\substack{i}}*\frac{W}{L}$$  without the $ ...$ They are only for inline math mode, see http://mirror.ctan.org/info/math/voss/mathmode/Mathmode.pdf "Undefined control sequence" error messages are always followed by a line that ends with the problem control sequence. It is important to include that information in your question. I will guess that it is \lambdaV. You need to separate \lambda and V with a space or some non-letter character. All The other errors are because of the $s at the start and end. The equation environment puts you in math mode already. Don't use those extra dollar signs, they just confuse LateX. The following should compile without error (though there are typographical problems with it):

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$\label{eqn: current} I_{FS} = \sum_{\substack{i}} * \frac{1}{2} * \frac{W}{L} * (V_{gs}-V_{th})^2 * (1 + \lambda V_{ds}) = \frac{1}{2} * k * (V_{gs}-V_{th})^2 * (1+\lambda*V_{ds}) * \sum_{\substack{i}} * \frac{W}{L}$$
\end{document}


(I've broken the lines and added some spaces for readability, but it is the same as your equation.) The \sum symbols seem not to be actual sums, perhaps you wanted \Sigma? The * are very seldom used in math for multiplication. The \substack command is for stacking one line on top of another in a subscript. I has no effect on a single symbol except to misposition it. Removing the *s and the \substacks it becomes:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$\label{eqn: current} I_{FS} = \sum_{i} \frac{1}{2} \frac{W}{L} (V_{gs} - V_{th})^2 (1 + \lambda V_{ds}) = \frac{1}{2} k (V_{gs} - V_{th})^2 (1+\lambda V_{ds}) \sum_{i} \frac{W}{L}$$
\end{document}

• This equation might also benefit from being placed in an align environment, with a line break before the second = symbol and alignment done on the two equal symbols. – Mico Nov 27 '13 at 23:38
• @Mico Yes, but I was trying to take small steps. The most important points were: (1) explain the error messages (and how to correctly report one); (2) remove things that were incorrect, though didn't produce errors, except in appearence. Improving appearence and exposition is several steps down the list. – Dan Nov 28 '13 at 6:23
• Sorry if I came across as overbearing. Your reworking of the original posting is a major improvement. – Mico Nov 28 '13 at 6:50