Using newcommand to produce (simple) newcommands [duplicate]












2
















This question already has an answer here:




  • How can I combine two text strings to represent the name of a command?

    2 answers




I would like to have, say, two custom comment macro for every author.
For example suppose there are two authors Alice and Bob and they would like to have commands:



newcommand{acom}[1]{textcolor{green}{#1}}
newcommand{aissue}[1]{textcolor{red}{textbf{#1}}}


for Alice a maybe with different color scheme for Bob.
Of course, Alice can write these but it is a bit annoying.



Now, suppose Cecil joins our team. Ideally, I would like to have a command



registerAuthor{Cecil}{yellow}{purple}


since then it is easy to ask Cecil to add his command and everything goes smoothly (otherwise Alice has to do this every time; and imagine if we have 20 different macros).
Is there any possible workaround?










share|improve this question













marked as duplicate by Christian Hupfer macros
Users with the  macros badge can single-handedly close macros questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 14:58


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





    Welcome to TeX.Stackexchange!

    – samcarter
    Jan 18 at 13:28











  • I'm not sure if you want something like this to track changes for every author in a collaborative work. Just a wild guess !

    – Partha D.
    Jan 18 at 13:34
















2
















This question already has an answer here:




  • How can I combine two text strings to represent the name of a command?

    2 answers




I would like to have, say, two custom comment macro for every author.
For example suppose there are two authors Alice and Bob and they would like to have commands:



newcommand{acom}[1]{textcolor{green}{#1}}
newcommand{aissue}[1]{textcolor{red}{textbf{#1}}}


for Alice a maybe with different color scheme for Bob.
Of course, Alice can write these but it is a bit annoying.



Now, suppose Cecil joins our team. Ideally, I would like to have a command



registerAuthor{Cecil}{yellow}{purple}


since then it is easy to ask Cecil to add his command and everything goes smoothly (otherwise Alice has to do this every time; and imagine if we have 20 different macros).
Is there any possible workaround?










share|improve this question













marked as duplicate by Christian Hupfer macros
Users with the  macros badge can single-handedly close macros questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 14:58


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





    Welcome to TeX.Stackexchange!

    – samcarter
    Jan 18 at 13:28











  • I'm not sure if you want something like this to track changes for every author in a collaborative work. Just a wild guess !

    – Partha D.
    Jan 18 at 13:34














2












2








2


0







This question already has an answer here:




  • How can I combine two text strings to represent the name of a command?

    2 answers




I would like to have, say, two custom comment macro for every author.
For example suppose there are two authors Alice and Bob and they would like to have commands:



newcommand{acom}[1]{textcolor{green}{#1}}
newcommand{aissue}[1]{textcolor{red}{textbf{#1}}}


for Alice a maybe with different color scheme for Bob.
Of course, Alice can write these but it is a bit annoying.



Now, suppose Cecil joins our team. Ideally, I would like to have a command



registerAuthor{Cecil}{yellow}{purple}


since then it is easy to ask Cecil to add his command and everything goes smoothly (otherwise Alice has to do this every time; and imagine if we have 20 different macros).
Is there any possible workaround?










share|improve this question















This question already has an answer here:




  • How can I combine two text strings to represent the name of a command?

    2 answers




I would like to have, say, two custom comment macro for every author.
For example suppose there are two authors Alice and Bob and they would like to have commands:



newcommand{acom}[1]{textcolor{green}{#1}}
newcommand{aissue}[1]{textcolor{red}{textbf{#1}}}


for Alice a maybe with different color scheme for Bob.
Of course, Alice can write these but it is a bit annoying.



Now, suppose Cecil joins our team. Ideally, I would like to have a command



registerAuthor{Cecil}{yellow}{purple}


since then it is easy to ask Cecil to add his command and everything goes smoothly (otherwise Alice has to do this every time; and imagine if we have 20 different macros).
Is there any possible workaround?





This question already has an answer here:




  • How can I combine two text strings to represent the name of a command?

    2 answers








macros






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 18 at 13:16









Dušan KnopDušan Knop

133




133




marked as duplicate by Christian Hupfer macros
Users with the  macros badge can single-handedly close macros questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 14:58


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.









marked as duplicate by Christian Hupfer macros
Users with the  macros badge can single-handedly close macros questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 14:58


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





    Welcome to TeX.Stackexchange!

    – samcarter
    Jan 18 at 13:28











  • I'm not sure if you want something like this to track changes for every author in a collaborative work. Just a wild guess !

    – Partha D.
    Jan 18 at 13:34














  • 1





    Welcome to TeX.Stackexchange!

    – samcarter
    Jan 18 at 13:28











  • I'm not sure if you want something like this to track changes for every author in a collaborative work. Just a wild guess !

    – Partha D.
    Jan 18 at 13:34








1




1





Welcome to TeX.Stackexchange!

– samcarter
Jan 18 at 13:28





Welcome to TeX.Stackexchange!

– samcarter
Jan 18 at 13:28













I'm not sure if you want something like this to track changes for every author in a collaborative work. Just a wild guess !

– Partha D.
Jan 18 at 13:34





I'm not sure if you want something like this to track changes for every author in a collaborative work. Just a wild guess !

– Partha D.
Jan 18 at 13:34










1 Answer
1






active

oldest

votes


















4














The trick is to use csname:



documentclass{article}
usepackage[dvipsnames]{xcolor}

newcommand{registerAuthor}[3]{%
expandafternewcommandcsname #1comendcsname[1]{textcolor{#2}{##1}}%
expandafternewcommandcsname #1issueendcsname[1]{textcolor{#3}{textbf{##1}}}%
}

registerAuthor{a}{green}{red}
registerAuthor{c}{yellow}{purple}

begin{document}

Alice comment: acom{something}

Alice issue: aissue{something}

Cecil comment: ccom{something}

Cecil issue: cissue{something}

end{document}


enter image description here






share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    The trick is to use csname:



    documentclass{article}
    usepackage[dvipsnames]{xcolor}

    newcommand{registerAuthor}[3]{%
    expandafternewcommandcsname #1comendcsname[1]{textcolor{#2}{##1}}%
    expandafternewcommandcsname #1issueendcsname[1]{textcolor{#3}{textbf{##1}}}%
    }

    registerAuthor{a}{green}{red}
    registerAuthor{c}{yellow}{purple}

    begin{document}

    Alice comment: acom{something}

    Alice issue: aissue{something}

    Cecil comment: ccom{something}

    Cecil issue: cissue{something}

    end{document}


    enter image description here






    share|improve this answer




























      4














      The trick is to use csname:



      documentclass{article}
      usepackage[dvipsnames]{xcolor}

      newcommand{registerAuthor}[3]{%
      expandafternewcommandcsname #1comendcsname[1]{textcolor{#2}{##1}}%
      expandafternewcommandcsname #1issueendcsname[1]{textcolor{#3}{textbf{##1}}}%
      }

      registerAuthor{a}{green}{red}
      registerAuthor{c}{yellow}{purple}

      begin{document}

      Alice comment: acom{something}

      Alice issue: aissue{something}

      Cecil comment: ccom{something}

      Cecil issue: cissue{something}

      end{document}


      enter image description here






      share|improve this answer


























        4












        4








        4







        The trick is to use csname:



        documentclass{article}
        usepackage[dvipsnames]{xcolor}

        newcommand{registerAuthor}[3]{%
        expandafternewcommandcsname #1comendcsname[1]{textcolor{#2}{##1}}%
        expandafternewcommandcsname #1issueendcsname[1]{textcolor{#3}{textbf{##1}}}%
        }

        registerAuthor{a}{green}{red}
        registerAuthor{c}{yellow}{purple}

        begin{document}

        Alice comment: acom{something}

        Alice issue: aissue{something}

        Cecil comment: ccom{something}

        Cecil issue: cissue{something}

        end{document}


        enter image description here






        share|improve this answer













        The trick is to use csname:



        documentclass{article}
        usepackage[dvipsnames]{xcolor}

        newcommand{registerAuthor}[3]{%
        expandafternewcommandcsname #1comendcsname[1]{textcolor{#2}{##1}}%
        expandafternewcommandcsname #1issueendcsname[1]{textcolor{#3}{textbf{##1}}}%
        }

        registerAuthor{a}{green}{red}
        registerAuthor{c}{yellow}{purple}

        begin{document}

        Alice comment: acom{something}

        Alice issue: aissue{something}

        Cecil comment: ccom{something}

        Cecil issue: cissue{something}

        end{document}


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 18 at 13:27









        egregegreg

        715k8618993186




        715k8618993186















            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?