For example, I do not know the definition of the LaTeX command \ensuremath. Where can I get its accurate meaning? Is there one professional website to offer some information about this?
- 603,163
- 311
1 Answers
The best source for definitions and meanings of LaTeX sources is source2e. Specifically for \ensuremath, it states
In math mode,
\ensuremath{text}is equivalent totext; in LR or paragraph mode, it is equivalent to$text$.\relaxis not needed in front of the\ifmmodeas\protectwill be\letto\relax. This version (due to Donald Arseneau) avoids duplicating its argument in the ‘then’ and ‘else’ part of the\ifmathwhich is necessary in nested ‘tabular’ like environments. See amslatex/2104.305 \DeclareRobustCommand{\ensuremath}{% 306 \ifmmode 307 \expandafter\@firstofone 308 \else 309 \expandafter\@ensuredmath 310 \fi}
Then there are also numerous LaTeX Help pages compiled in HTML format. Here's the specific one related to \ensuremath:
\ensuremath(LaTeX2e)\ensuremath{Text set in math mode}The argument of the
\ensuremathcommand is always set in math mode, regardless of the current mode. Note that math mode is not specifically invoked in the argument of the\ensuremathcommand.Thus
\ensuremath{$\alpha^2+\beta^2$}is not correct. The correct form is\ensuremath{\alpha^2+\beta^2}.
- 603,163
latex ensuremath- and pick a link that I think will give me an explanation at the level I want. – Ethan Bolker Jul 23 '15 at 16:50