# \newcommand{\ord}{\operatorname{ord}}

$\newcommand{\ord}{\operatorname{ord}}$

I keep seeing things like this: $$ord_a p$$ etc. I just went through a posting and changed a lot of instances of "ord" to "\ord" after prefacing it with this: \newcommand{\ord}{\operatorname{ord}}

That way you see this: $$\ord_a p$$ This not only prevents italicization, but also results in proper spacing, so that instead of $$x ord x$$ you see this: $$x\ord x$$

"ord" is used in this way so often on math.stackexchange.com that it would be useful to make \ord a standard thing, so "newcommand" and "\operatorname" aren't needed every time. Is that possible?

• I don't remember seeing it used at all, or at least not so often that I've taken notice of it. It's only one of a potential infinity of named operators that one might like to have predefined commands for, and I'm not convinced it's even particularly common among those that don't already have predefined commands. – hmakholm left over Monica Oct 27 '12 at 12:18
• @HenningMakholm : I see it in questions to math.stackexchange.com very frequently. – Michael Hardy Oct 27 '12 at 16:31
• Is \ord in Latex? If so, of course it should be here. If not, do we really want to add it here? I think not. – GEdgar Oct 27 '12 at 17:04
• @GEdgar : Why not? LaTeX is supposed to be adaptable; that's why things like LaTeX packages and \newcommand exist. – Michael Hardy Oct 27 '12 at 17:34
• Searching for "ord" on the main site gives $213$ results, less than e.g. "lcm" ($316$) or "rank" ($1600$, although some may not actually contain \rank). So if this is added, I'd like to nominate these two too. – TMM Oct 27 '12 at 18:02
• \lcm is another one whose absence seems strange. – Michael Hardy Oct 27 '12 at 18:16
• \tr is also missing if I search I get 433 results (of course I am not sure if all the results are relevant). Other missing which come to my mind are \im (for image not imaginary part). However, in general I am against defining all these commands. – Fabian Oct 28 '12 at 10:34
• \im could also mean "image". – Michael Hardy Oct 28 '12 at 17:32
• Also, \span needs to be in there! (Well, \span won't work, but something similar.) – wj32 Nov 1 '12 at 9:28

In my not-so-humble opinion (which is why I'm repeating it again here after mentioning it in a comment):

As long as we are asking for technical upgrades, might as well ask for customisability. That is, ask for the begingroup extension to be loaded and allow each user to have a customized set of LaTeX macros definable in the profile, which are automatically inserted for every post (see below). This way each user can define his or her own macros and not be tied down to other users' naming conventions.

To be more precise, what I imagine is an editable field in the profile which will contain some sort of "preamble" or "template". Every time a user tries to post a new question or answer, the content of the preamble gets automatically loaded into the text box. (For comments and edits the preamble does not get loaded.) (One other possibility is to add to the text edit toolbar an extra button for loading the preamble text, so that the preamble is only manually loaded on request.)

I see this having several benefits, if used with the begingroup extension:

1. As said before, each user can define his or her own set of macros without interfering with those of the other users'.

2. The auto/manual loading makes it more convenient (so we don't have to copy-paste or re-type the definitions every time).

3. The fact that the preamble text is copied into the post, as opposed to otherwise loaded from user profile through some internal magic, means that in the event that the user modifies his macro definitions (or in the event that a user requests account deletions), the previously posted content will not be negatively affected. That is, users don't have to actively worry about backwards compatibility when editing their macro definitions.

Until the begingroup extensions are loaded, I would rather not introduce any global "non-standard" \newcommands. I would hate to define a new command using a macro name that I know is safe to use, only to find that it broke everyone else's posts on the same page.

• If each user has his own macros, then when I copy the Latex from your question into my reply it won't work? I have gotten used to writing \mathbb{R} for this site instead of my usual macro. – GEdgar Oct 29 '12 at 14:02
• @GEdgar: my proposal works around that by forcing the software to copy the macro definitions to the top of every post where it is clearly visible and copy-able. If you like you can additionally propose that the scope of the begin...endgroup be "the post + its comments". – Willie Wong Oct 30 '12 at 9:17
• @GEdgar: to clarify: some people have already, on occasion when composing longer answers, resort to defining their own macros. (I in particular remember one by t.b. where he used some MathJax cheat to add additional formatting elements then commonly available in MarkDown.) This just streamlines the process for those users. – Willie Wong Oct 30 '12 at 9:19
• As far as I can see this would just have the effect of making it completely impossible for newcomers to learn the markup by seeing what others do (because every user would have his own private LaTeX dialect and it would be a matter of luck whether things copy-pasted from one user's posts would work in another context) -- with only the dubious advantage of saving a trivial amount of typing for a minority of power users. – hmakholm left over Monica Nov 1 '12 at 12:59
• The macros could exist in the profile only, and when used in an answer they are just parsed. That way, with the right definition in my profile, I can type \CC in my answer but \mathbb{C} is what will appear after posting. – Martin Argerami Nov 2 '12 at 6:02
• @Martin: automatic expansion of the macros would probably involve significant recoding of the UI for SE, and my bet would be it not happening anytime soon. – Willie Wong Nov 2 '12 at 9:41
• @Henning: Some people do it already (the defining their own macro thing). Are you worried that by making it easier to use and configure that more people will start using it (and lead to the scenario you described)? – Willie Wong Nov 2 '12 at 9:42