I hope this hasn't been previously asked. There are certain symbols that are used very, very often on math.se for which there isn't a preprogrammed TeX command for. The ones that jump immediately to mind are $\text{Spec}$, $\text{tr.deg}$ and $\text{Hom}$. Is there any way to make these widely used symbols into standard TeX so we don't have to type \text{} every time?
1 Answer
$\begingroup$
$\endgroup$
4
I published a userscript implementing custom LaTeX commands for SE sites. (First install a userscript manager such as Tampermonkey/Greasemonkey; then click the script installation link). It works by performing on-the-fly substitutions in the editor window, both for posts and comments. Such as:
- \spec% $\to$ \operatorname{spec}; the % character is used as a delimiter of operator name
- \RR $\to$ \mathbb{R}; same for other double-capital letters
- H\"older $\to$ Hölder; L'H\^opital $\to$ L'Hôpital, Amp\`ere $\to$ Ampère, Poincar\'e $\to$ Poincaré, Erd\H{o}s $\to$ Erdős, etc.
-
$\begingroup$ How about other browsers? $\endgroup$Fallen Apart– Fallen Apart2015-06-21 11:09:20 +00:00Commented Jun 21, 2015 at 11:09
-
$\begingroup$ There is now a userscript version with similar functionality. Should work in userscript-friendly browsers. $\endgroup$user147263– user1472632015-07-30 07:11:22 +00:00Commented Jul 30, 2015 at 7:11
-
$\begingroup$ @sandwich The link doesn't work anymore. Is this still available anywhere? $\endgroup$TY Mathers– TY Mathers2016-05-24 06:12:44 +00:00Commented May 24, 2016 at 6:12
-
$\begingroup$ @AlexMathers Chrome extension has been discontinued, but the userscript works for Chrome too, under Tampermonkey. I updated the post. $\endgroup$user147263– user1472632016-05-24 06:50:27 +00:00Commented May 24, 2016 at 6:50
\newcommandin your posts whenever you find yourself using something frequently enough in that post. (At least, that's what I do.) $\endgroup$\textfor operator names. Use\mathrmat least or better yet, use\operatornameto be syntactically correct. To avoid typing that string multiple times, instead of\newcommandyou should use\DeclareMathOperator, as in\DeclareMathOperator\Spec{Spec}which allows you to call\Specto get the Roman lettersSpecshown. $\endgroup$