1

I want to define a new function \juse which takes 3 parameters and prints the second one. However, this doesn't work:

\documentclass{article}
\newcommand\juse{#1#2#3}{#2}
\begin{document}
$\juse{ abc }  {def} { ghi }$
\end{document} 

It should print $def$ but gives an error.

1
  • 3
    The correct syntax for LaTeX would be \newcommand\juse[3]{#2}
    – user220367
    Jul 27 '20 at 10:11
2

To define a command in LaTeX that takes three mandatory arguments you'd only have to add a [3] to it. So a complete example would be:

\documentclass{article}
\newcommand\juse[3]{#2}
\begin{document}
$\juse{ abc }  {def} { ghi }$
\end{document}

It is a bit unclear however, what you want to achieve with the command in a math enviroment, or if I got you wrong with the $'s.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.