This question already has an answer here:

Is it possible to make a command that create commands??

Something like:

\newcommand{apprentice}[4][forestgreen]{ %
\newcommand{#2}{ \color{#1} Lærling #3}%
 \newcommand{a#2}{\color{#1} #4}%

that creates 2 new commands \#2 and \a#2 defined as shown above.

this would just be faster than doing the above 8+ times

marked as duplicate by user31729 Mar 30 '17 at 14:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \expandafter\newcommand\csname #2\endcsname{\color{#1}...} etc. – user31729 Mar 30 '17 at 14:15
  • See: tex.stackexchange.com/questions/259287/…, so it's most likely a duplicate, but I won't use the [macro] - gold - badge hammer right now to close this question – user31729 Mar 30 '17 at 14:18
  • Christian Hupfer You are right it is a duplicate, that thread did not come up when i wrote command to make commands in the ask a question field. – Thorbjørn E. K. Christensen Mar 30 '17 at 14:30
  • You can do so XD, still can't get the colors working thou XD, but just close it – Thorbjørn E. K. Christensen Mar 30 '17 at 14:35
  • 1
    got it working, just forgot to put in the package that gives me forestgreen XD, stupid mistake. Thanks for the help – Thorbjørn E. K. Christensen Mar 30 '17 at 14:39

Browse other questions tagged or ask your own question.