You wrote,
I'm just really curious what's causing this interesting issue
Short answer: To use \cal
in any LaTeX document written after 1994 [!] is either an accident waiting to happen -- as is the case with your sample code -- or won't work at all -- say, if the memoir
document class is used.
Longer answer: \cal
is a plain-TeX font switching command that is implemented in some, but not all, LaTeX2e document classes, as a legacy command to ease the changeover from LaTeX209 to LaTeX2e. (That changeover occurred in 1994.) Because \cal
is a switch rather than a command that takes an argument, its scope is through to the end of the current TeX group. Hence, by writing \cal{A}
, one creates the false impression that only A
is affected by whatever \cal
does; that's not the case, as you've (re)discovered. One must encase \cal A
in curly braces -- i.e., write {\cal A}
-- in order to avoid creating a typographic disaster. What you really ought to be doing, though, is to write \mathcal{A}
. (In this regard, \cal
is not different from the other legacy/PlainTeX font switching commands, such as \bf
, \it
, \sl
, and \sc
.)
Additional comment: Your sample code contains one further inaccuracy and one typographically questionable choice.
To write \textbf{y}
in math mode will sooner or later come back to haunt you, especially if the document's text and the math fonts don't look alike. You should be writing \textbf{y}
in text mode and \mathbf{y}
in math mode.
To write 1,\cdots, n^{2}
is somewhat unconventional from a typographic point of view, to put it charitably. Better to write 1,\ldots, n^{2}
or, better still, 1,\dots, n^{2}
-- and let LaTeX decide whether to generate a typographic ellipsis that's placed on the baseline or on the mathline. (The mathline is where the mathematical -
(minus) symbol is placed.) \cdots
should be employed, say, to elide a sequence of binary operations, as in \prod_{i=1}^N a_i = a_1 a_2 \cdots a_N
. In contrast, \ldots
should be used to abbreviate a list of comma-separated items.
To summarize, then, do consider replacing
${\cal{A}} = \textbf{y}_{i}, \forall i = 1,\cdots, n^{2}$,
with
$\mathcal{A} = \mathbf{y}_{i} \quad \forall i = 1,\dots, n^{2}$,
\cal
is not intended for use in math mode. Instead of it rather use\mathcal
and your problem will disappear.\cal
is a PlainTeX font switching command and, as such, is very much meant to be used in math mode. However, precisely because it's a PlainTeX holdover, it shouldn't be used in a LaTeX document written after 1994.