# How to define new command for commands like \frac{} or \int{}^{}?


-
Could you clarify a) what your new macro should do with b) how many parameters? A macro name like \fr(,) is almost not possible and would be very cumbersome to actually call in your document. Related: Symbols to avoid while creating new commands and “Non-letters in macro names”. –  Qrrbrbirlbel Feb 23 '13 at 4:14

You can also use the "old" macro for the fractions (used in plain TeX):

{a\over b}

that produces the same result of

\frac{a}{b}

For integrals, I suggest you the following macro:

\def\intx#1{\int {#1}\,dx}

that produces the integral of #1 with its differential (where x is your variable)

-
Using \over is best avoided in LaTeX, and also \def is discouraged in document preambles. –  egreg Feb 22 '13 at 9:47

You can define a command with parameters:

\newcommand{\divbytwo}[1]{\frac{#1}{2}}

The #1 is the placeholder for the first parameter to the macro: \divbytwo{3} will expand to \frac{3}{2}.