We know that we could define a new command for boldfaced or calligraphic C, for example I can define \newcommand{\Cx}{\mathbb{C}}, which will produce the boldfaced C, i.e. $\mathbb{C}$ for me. But how do I define new command for say more complicated commands, e.g. \frac{}{} for getting fractions or say \int{}^{} for definite integrals? I tried defining \newcommand{\fr(,)}{\frac{}{}}, but it is not working. It seems to me there should be a correct way to define it.
Tell me more
×
TeX - LaTeX Stack Exchange is a question and answer site for
users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
|
|
||||
|
You can define a command with parameters:
The Edit: incorporating comments from the OP and @SašoŽivanović asking/answering about macros with more than one argument -
will do the job. The |
|||||||
|
|
You can also use the "old" macro for the fractions (used in plain TeX):
that produces the same result of
For integrals, I suggest you the following macro:
that produces the integral of #1 with its differential (where x is your variable) |
|||||
|

\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 at 4:14