8
$\begingroup$

$\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?

$\endgroup$
9
  • 1
    $\begingroup$ 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. $\endgroup$ Oct 27, 2012 at 12:18
  • $\begingroup$ @HenningMakholm : I see it in questions to math.stackexchange.com very frequently. $\endgroup$ Oct 27, 2012 at 16:31
  • 3
    $\begingroup$ 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. $\endgroup$
    – GEdgar
    Oct 27, 2012 at 17:04
  • 1
    $\begingroup$ @GEdgar : Why not? LaTeX is supposed to be adaptable; that's why things like LaTeX packages and \newcommand exist. $\endgroup$ Oct 27, 2012 at 17:34
  • $\begingroup$ 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. $\endgroup$
    – TMM
    Oct 27, 2012 at 18:02
  • 1
    $\begingroup$ \lcm is another one whose absence seems strange. $\endgroup$ Oct 27, 2012 at 18:16
  • 3
    $\begingroup$ \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. $\endgroup$
    – Fabian
    Oct 28, 2012 at 10:34
  • 1
    $\begingroup$ \im could also mean "image". $\endgroup$ Oct 28, 2012 at 17:32
  • $\begingroup$ Also, \span needs to be in there! (Well, \span won't work, but something similar.) $\endgroup$
    – wj32
    Nov 1, 2012 at 9:28

1 Answer 1

14
$\begingroup$

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.

$\endgroup$
7
  • 2
    $\begingroup$ 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. $\endgroup$
    – GEdgar
    Oct 29, 2012 at 14:02
  • 1
    $\begingroup$ @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". $\endgroup$ Oct 30, 2012 at 9:17
  • $\begingroup$ @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. $\endgroup$ Oct 30, 2012 at 9:19
  • 4
    $\begingroup$ 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. $\endgroup$ Nov 1, 2012 at 12:59
  • 3
    $\begingroup$ 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. $\endgroup$ Nov 2, 2012 at 6:02
  • $\begingroup$ @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. $\endgroup$ Nov 2, 2012 at 9:41
  • 2
    $\begingroup$ @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)? $\endgroup$ Nov 2, 2012 at 9:42

You must log in to answer this question.

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