# Why is the following text getting the error "! Undefined control sequence."?

\documentclass{article}
\begin{document}
\normalsize
\section{The Model}

${\P}\_t$ is a stochastic process representing the stock price.
${\varphi}\_t$ is the borrowing cost of 1 share on the time interval [t, t+dt].
It is assumed the interest rate is 0.
$\X_{t}^{Q}$ = Capital of squeezer.

\end{document}


I believe the error is coming from the notation used for the capital of the squeezer but cannot find out what it is. Any help would be greatly appreciated.

• How is \P defined? Jul 3 at 12:13
• @Bernard Well, \P is actually a kernel macro, the undefined one is \X. Jul 3 at 12:33
• @KillianGavin Undefined means that the macro \X does not exists. Therefore your attempt to use it does not work. Jul 3 at 12:37
• You need to define \X. For example in document preamble add \newcommand\X{\mathbf{X}} if X had to be in boldface. But I gues that you looking for just P and X . Jul 3 at 12:44
• At first glance, I though he meant the Greek letters, where he mistyped Pi as P and Xi as X since there was already one Greek letter that was correctly typed. Jul 3 at 12:53

I know very little about stochastic process notation other than what I gleaned from looking at a wikipedia page just now. From that, I think that you actually meant to write:

$\{P_t\}$ % ❶
is a stochastic process representing the stock price.
$\{\varphi_t\}$ % ❷
is the borrowing cost of 1 share on the time interval
$[t, t+dt]$. % ❸
It is assumed the interest rate is 0.
$X_{t}^{Q} = \mbox{Capital of squeezer}$. % ❹


❶ I assumed that you want printed curly braces with the subscript inside per the notation described at the wikipedia article. I also got rid of the \ because I'm pretty sure you wanted to print P and not ¶. By the way % indicates a comment and the black numbers are my way of enabling references to commentary in the midst of the code. I always preceded these notes with a % so that copy-and-pasters won't get errors from their appearance.

❷ Similar modification to the appearance, although this is more of a financial notation .

all mathematical material should be inside $$, not just the stuff that LaTeX gives you an error for. You'll find that this change gives better spacing and also prints t and dt in math italics which is what you would want.

❹ I got rid of the \ before X since \X doesn't mean anything. I also moved the phrase “Capital of squeezer“ inside the mathematics since it's the right hand side of the = and thus part of a mathematical expression. This, in turn, is enclosed inside \mbox so that it will be treated as text.¹

1. An even better approach is to use the \text command from the amsmath package instead of \mbox, but that adds a level of complexity to the answer that isn't necessary at this point, so this footnote is mostly for the other commenters.
• An even better practice than \text is \textup, which won't suddenly change to italic if the expression happens to occur in the middle of a theorem or other text environment that's normally italic. Jul 4 at 3:14
• @barbarabeeton The gotcha here is that \text will change size with context but \textup gives the same results as \mbox. Writing a book on LaTeX gets one exploring a lot of edge cases. Jul 4 at 3:23
• If \textup doesn't do the right thing in context, then \mathrm would. But I'd be inclined to report misbehaving \textup as a bug. In any event \mbox is not the best answer here. Jul 4 at 3:48
• \mathrm won't preserve spaces. I had to do some digging in my buddy source2e.pdf (I kind of want to keep a monitor on my desktop dedicated to showing just that), to discover that the size changing from \textup is dependent on having amsmath loaded. Otherwise, the \textXX commands are equivalent to using \mbox. This conversation has just dramatically improved lesson 7-7 of the book. The thing that should be updated, more than anything else, is amsldoc.pdf which could be better written (and fails to acknowledge that \textrm works with and without amsmath just without the Jul 4 at 4:33
• size changing feature. Jul 4 at 4:34