newcommand: Using one parameter as the default for the otherHow can I use one argument as the default value...

Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?

Was it really inappropriate to write a pull request for the company I interviewed with?

Learning to quickly identify valid fingering for piano?

Where do you go through passport control when transiting through another Schengen airport on your way out of the Schengen area?

What is a term for a function that when called repeatedly, has the same effect as calling once?

Professor forcing me to attend a conference

Is this nominative case or accusative case?

Is being socially reclusive okay for a graduate student?

Integrating function with /; in its definition

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Is there a math expression equivalent to the conditional ternary operator?

Is it a Cyclops number? "Nobody" knows!

Create chunks from an array

Do natural melee weapons (from racial traits) trigger Improved Divine Smite?

Why is there an extra space when I type "ls" on the Desktop?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Can a space-faring robot still function over a billion years?

Paper published similar to PhD thesis

Has a sovereign Communist government ever run, and conceded loss, on a fair election?

If nine coins are tossed, what is the probability that the number of heads is even?

Does the in-code argument passing conventions used on PDP-11's have a name?

Is every open circuit a capacitor?

Are Wave equations equivalent to Maxwell equations in free space?

“I had a flat in the centre of town, but I didn’t like living there, so …”



newcommand: Using one parameter as the default for the other


How can I use one argument as the default value for another?Problem with newcommand, no space after calling new command in the compiled textDefining a command for a minted environmentHow to specify an optional final argument with newcommand?how to define a newcommand with several optional arguments?Optional argument for newcommand?Set the default value of argument as parameter in newcommandUsing the compulsory argument for the optional argument?How to pass optional arguments to command?Default value of command













0















I would like to define a command that takes two arguments, one of which is optional. If it is not given, then it should take the other one as default value.



Unfortunately, newcommand{mycommand}[2][#1]{ ... } does not work, neither does newcommand{mycommand}[2][#2]{ ... }.



Does anybody know how to do this?









share























  • newcommand{mycommand}[2][default]{...}?

    – marmot
    30 secs ago
















0















I would like to define a command that takes two arguments, one of which is optional. If it is not given, then it should take the other one as default value.



Unfortunately, newcommand{mycommand}[2][#1]{ ... } does not work, neither does newcommand{mycommand}[2][#2]{ ... }.



Does anybody know how to do this?









share























  • newcommand{mycommand}[2][default]{...}?

    – marmot
    30 secs ago














0












0








0








I would like to define a command that takes two arguments, one of which is optional. If it is not given, then it should take the other one as default value.



Unfortunately, newcommand{mycommand}[2][#1]{ ... } does not work, neither does newcommand{mycommand}[2][#2]{ ... }.



Does anybody know how to do this?









share














I would like to define a command that takes two arguments, one of which is optional. If it is not given, then it should take the other one as default value.



Unfortunately, newcommand{mycommand}[2][#1]{ ... } does not work, neither does newcommand{mycommand}[2][#2]{ ... }.



Does anybody know how to do this?







macros





share












share










share



share










asked 2 mins ago









Bodo MantheyBodo Manthey

1217




1217













  • newcommand{mycommand}[2][default]{...}?

    – marmot
    30 secs ago



















  • newcommand{mycommand}[2][default]{...}?

    – marmot
    30 secs ago

















newcommand{mycommand}[2][default]{...}?

– marmot
30 secs ago





newcommand{mycommand}[2][default]{...}?

– marmot
30 secs ago










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478354%2fnewcommand-using-one-parameter-as-the-default-for-the-other%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478354%2fnewcommand-using-one-parameter-as-the-default-for-the-other%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paper upload error, “Upload failed: The top margin is 0.715 in on page 3, which is below the required...

Emraan Hashmi Filmografia | Linki zewnętrzne | Menu nawigacyjneGulshan GroverGulshan...

How can I write this formula?newline and italics added with leqWhy does widehat behave differently if I...