A community for students.
Here's the question you clicked on:
 0 viewing
ParthKohli
 3 years ago
Parameters in `\newcommand`?
ParthKohli
 3 years ago
Parameters in `\newcommand`?

This Question is Closed

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3``\newcommand\cat[4]{^{#1}_{#2}\large\operatorname {\mathcal {UNK}}^{#3}_{#4}} \cat abcd ~\to ~ \cat {\cat defg}{\cat hijk}{\cat lmno}{\cat pqr{\cat {\cat stuv}{\cat wxyz}{\cat \alpha\beta\gamma\delta}{\cat \epsilon\zeta \eta{\cat {\cat \theta\iota \kappa\lambda}{\cat \mu\nu o\pi}{\cat\rho\sigma\tau\upsilon }{\cat \phi\chi\psi\omega}}}}}`` \[\newcommand\cat[4]{^{#1}_{#2}\large\operatorname {\mathcal {UNK}}^{#3}_{#4}} \cat abcd ~\to ~ \cat {\cat defg}{\cat hijk}{\cat lmno}{\cat pqr{\cat {\cat stuv}{\cat wxyz}{\cat \alpha\beta\gamma\delta}{\cat \epsilon\zeta \eta{\cat {\cat \theta\iota \kappa\lambda}{\cat \mu\nu o\pi}{\cat\rho\sigma\tau\upsilon }{\cat \phi\chi\psi\omega}}}}}\]

ParthKohli
 3 years ago
Best ResponseYou've already chosen the best response.1LOL wow, can you just show me how to make an operator which colors the text green and makes it gold, and then I could give parameters to it? Like a function in javascript. ``` function ranFunction(ranText) { [insert stuff here] } ``` and then running it on a string. ``` ranFunction("Parth"); ```

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3`\newcommand\Parth[1]{\bf\color{green}{#1}} 500+abc+\Parth{13} =?` \[\newcommand\Parth[1]{\bf\color{green}{#1}} 500+abc+\Parth{13} =?\]

ParthKohli
 3 years ago
Best ResponseYou've already chosen the best response.1Yes, that's what I wanted! What does the `#` mean? Does it act like a parameter or something?

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3after `\newcommand ` and `\Parth` (the operator name) there is a term in square brackets that is the number of variables the operator works with the `#1` is a reference to the first variable

ParthKohli
 3 years ago
Best ResponseYou've already chosen the best response.1Ah, nice, we have variables in typesets too.

ParthKohli
 3 years ago
Best ResponseYou've already chosen the best response.1\[\newcommand\Unk[1]{\mathbf{#1}}\\ \Unk{UnkleRhaukus~rocks!}\]

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3you can leave a variable blank with `{}` `\newcommand\intl[4]{\int\limits_{#1}^{#2}f(#3)\mathrm d#4}` `\intl ab{}z =?` \[\newcommand\intl[4]{\int\limits_{#1}^{#2}f(#3)\mathrm d#4} \intl ab{}z =?\]

ParthKohli
 3 years ago
Best ResponseYou've already chosen the best response.1Thanks, gotta go. I owe you a lot. =)

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3you can even have a newcommand without variables `\newcommand\something[0]{ {\tiny\color{gray} ? }} \ \something` \[\newcommand\something[0]{ {\tiny\color{gray} ? }} \ \something \]

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3maybe you really want to use `\newenvironment` @ParthKohli I haven't tried that command yet

UnkleRhaukus
 3 years ago
Best ResponseYou've already chosen the best response.3use \(\text{\ }\boldsymbol{{boldsymbol{}}} \) instead of just \(\bf{\text {\ bf}}\) if you dont want to loose italics ``` \newcommand\Parth[1]{\boldsymbol{\color{green}{#1}}} \Parth{@ParthKohli} ``` \[\newcommand\Parth[1]{\boldsymbol{\color{green}{#1}}} \Parth{@ParthKohli}\]
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.