# Create “bracket free” macros (like in mimeTeX)

In mimeTeX, an abundance of macros like \cd = \cdot, \fr = \frac and \sq = \sqrt are allowed. This kind of macros are easily created in own LaTeX documentens, using \newcommand. Other mimeTeX macros are so to speak "bracket free"; for instance, \te hallo is possible to use instead of \text{hello}. My question is, whether this kind of macros too are possible to imitate in LaTeX, and, if so, how that is done.

-
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. A tip: You can use backticks  to mark your inline code as I did in my edit. – Joseph Wright Mar 23 '13 at 20:10

You can use \def to make macros with delimited arguments so

\def\te#1 {\text{#1}}
\te hello aaa


would put hello in the argument to \text. The argument to te ends at the first space (or newline) where the space after \te does not count as it never makes a space token, it is used to terminate the command name.

However in general you should not do this. A major design aim in LaTeX is to give a consistent top level syntax to commands: mandatory arguments get {} optional arguments get [] etc.

Judging from the use case in the comments it seems that you do not in fact want want \te to take an argument at all but want the plain Tex/LaTeX2.09 usage

\newcommand\te{\rm}


will make \te switch to an upright roman font for the rest of the current expression.

-
Great! Is it possible to make it work for longer arguments, like \te how do you do (that should be interpreted as \text{how do you do}? The reason I'm asking this is that I'm converting from mimeTeX to mathJax on a web forum where \te is frequently used in the beginning of math environments to generate chemical reaction formulas and similar non-italic objects. – PoetryInMotion Mar 23 '13 at 20:30
Yes but you need to replace the   that I put in the definition before { by whatever sequence of tokens you want to end the argument, you need some marker eg \par will work to go as far as the next blank line. But beware this is a TeX forum and this is a TeX answer, MathJax does not use TeX, it emulates simple TeX syntax but if you do anything too tricky with low level tex code it will not be supported. – David Carlisle Mar 23 '13 at 20:34
@PoetryInMotion, yes, you can do this. But latex need to know where is the end of macro's argument. So, you can write \def\te#1|{\text{#1}} and after this write \te More than one word|. All text till | will become argument of \text`. – Eddy_Em Mar 23 '13 at 20:35
Thank you. The problem is the already existing forum posts, where I cannot easily add anything. – PoetryInMotion Mar 23 '13 at 20:40
Sorry, I was referring to existing mimetex content. How would LaTeX react if I let the end markers be omitted in old posts? – PoetryInMotion Mar 23 '13 at 20:46