Using newcommand to produce (simple) newcommands [duplicate]
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?
macros
marked as duplicate by Christian Hupfer
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.
add a comment |
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?
macros
marked as duplicate by Christian Hupfer
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
add a comment |
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?
macros
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
macros
asked Jan 18 at 13:16
Dušan KnopDušan Knop
133
133
marked as duplicate by Christian Hupfer
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
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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}

add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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}

add a comment |
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}

add a comment |
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}

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}

answered Jan 18 at 13:27
egregegreg
715k8618993186
715k8618993186
add a comment |
add a comment |
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