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?

  • $\begingroup$ I think that the topic of global macros have been brought up before. Several times. I'm still against. $\endgroup$
    – Asaf Karagila Mod
    Feb 7, 2014 at 8:22
  • $\begingroup$ @AsafKaragila You disagree with my proposal? Is that why you downvoted? I don't think that's the function of those arrows friend. I also don't understand why you could possibly be against it. It's a feature that adds nothing but convenience $\endgroup$ Feb 7, 2014 at 8:23
  • 7
    $\begingroup$ @Alex: Please note that voting is different on meta, and is frequently used to indicate agreement/disagreement. $\endgroup$
    – user642796
    Feb 7, 2014 at 8:28
  • 2
    $\begingroup$ Ah, I see. I apologize then--I wasn't aware of this difference :) $\endgroup$ Feb 7, 2014 at 8:30
  • 3
    $\begingroup$ There have been multiple requests that certain custom macros be automatically loaded: 1, 2, 3 4. I think that until Willie Wong's proposal is finally implemented it's best to simply include the requisite \newcommand in your posts whenever you find yourself using something frequently enough in that post. (At least, that's what I do.) $\endgroup$
    – user642796
    Feb 7, 2014 at 9:03
  • 11
    $\begingroup$ Also, don't use \text for operator names. Use \mathrm at least or better yet, use \operatorname to be syntactically correct. To avoid typing that string multiple times, instead of \newcommand you should use \DeclareMathOperator, as in \DeclareMathOperator\Spec{Spec} which allows you to call \Spec to get the Roman letters Spec shown. $\endgroup$ Feb 7, 2014 at 9:12
  • $\begingroup$ Alex, as Arthur pointed out, downvotes mean disagreement on meta. Well, usually. As to why I disagree? I think LaTeX is a style you get used to, and I don't like nudges very much. Adding global macros is one hell of a nudge. $\endgroup$
    – Asaf Karagila Mod
    Feb 7, 2014 at 11:35
  • 1
    $\begingroup$ @AsafKaragila I don't understand your comment. Not having a macro for extremely common commands just seems silly, unless it would somehow disrupt some existing setup, or is monumentally difficult to do. I mean, math.se is a very successful website, I would find it hard to believe that it would take that much time/effort for someone to introduce macros for common commands like Spec, Hom, or Ord. I mean, I understand the desire to do one big change (a la Willie Wong's suggestion) instead of a bunch of little ones. But, if we don't want to go half-way, then let's just do it. $\endgroup$ Feb 7, 2014 at 11:40
  • $\begingroup$ Maybe it is because I have a naive understanding of the organization of this site (this is certainly a possibility), but with the amount of foot traffic it receives, I would assume there is someone who takes care of these types of things? Even if it would take a long time to complete, have their been moves to get the ball rolling? Thanks for any information! :) $\endgroup$ Feb 7, 2014 at 11:42
  • $\begingroup$ @WillieWong I think I'll use $\text{}$ :) It's less letters, and it's for math.se. In an actual TeX program I'd use DeclareMathOperator, but that seems painful here. Thanks for the suggestion! $\endgroup$ Feb 7, 2014 at 11:43
  • $\begingroup$ Alex, I expressed my opinions on the matter at least once in the links given by Arthur. You might want to read about nudge theory, in case you don't know what that is. $\endgroup$
    – Asaf Karagila Mod
    Feb 7, 2014 at 11:45

1 Answer 1


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$ Jun 21, 2015 at 11:09
  • $\begingroup$ There is now a userscript version with similar functionality. Should work in userscript-friendly browsers. $\endgroup$
    – user147263
    Jul 30, 2015 at 7:11
  • $\begingroup$ @sandwich The link doesn't work anymore. Is this still available anywhere? $\endgroup$ 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
    May 24, 2016 at 6:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .