Questions tagged [optional-arguments]
{optional-arguments} concerns commands and environments that accept optional arguments. For example the \sqrt command can be used as \sqrt[3]{x}.
489 questions
4 votes
2 answers
142 views
Passing a macro as the argument to an arbitrary arg-spec
MWE: \documentclass{article} \usepackage{mathtools} \begin{document} \ExplSyntaxOn \tl_new:N \g__mymodule_env_name_tl \tl_new:N \g__mymodule_env_args_tl % Defaults \tl_set:Nn \g__mymodule_env_name_tl {...
9 votes
4 answers
413 views
Using macros to define optional arguments for environments
I am trying to use a macro to define the optional arguments to a tcbraster environment. Here is a simple example: \documentclass{article} \usepackage{tcolorbox} \tcbuselibrary{raster} \def\myoptions{...
9 votes
3 answers
320 views
Defining a verbatim environment as a pair of commands (e.g., using c argspec), with optional argument
I'm wondering if it's possible to use the new c arg spec (or any other method) in LaTeX to define a verbatim environment as a pair of commands. I also want the starting command to take an optional ...
1 vote
1 answer
118 views
why `fancyfoot` doesn't follow the change of parameters?
I have a code like below but the fancyfoot doesn't follow the change of parameters which I altered randomly with the numbers -300 100pt and 200pt: \documentclass[landscape,a4paper]{article} \...
4 votes
2 answers
151 views
Command to give a dimension expression with an optional argument
My aim is to create a command that issues a dimension for box height control. In the example below, I've tried to get it work with an optional argument but I don't get why it throws an error regarding ...
5 votes
3 answers
290 views
Second kind of Surface Integral with P,Q,R optional
I want to use \dss[\Sigma][P][Q][R] or \dss[\Sigma]{P,Q,R} or \dss{\Sigma,P,Q,R} to generate \[ \iint_{\Sigma} P\mathrm{d}y\mathrm{d}z+Q\mathrm{d}z\mathrm{d}x+R\mathrm{d}x\mathrm{d}y \] \documentclass{...
0 votes
1 answer
53 views
Passing documentclass arguments at compiler level [duplicate]
Say we have a LaTeX document for beamer presentation \documentclass{beamer} ... \end{document} Now if I want to make a handout of it, I have to manually change this file to \documentclass[handout]{...
3 votes
1 answer
168 views
Using \sqrt and \root commands with even and odd indices in the mathfixs package
I am trying to use the mathfixs package to handle roots with both even indices (like the square root) and odd indices (like the cube root). I would to use the command \root with other options. ...
1 vote
1 answer
84 views
List with numbering that includes section or subsection numbering in it
I have something that works for me for lists, but I have to define the label always in when I start it. I'm using enumitem package and I was looking at this post to try to make this into a new ...
5 votes
1 answer
162 views
If I defined a command with optional arguments after calling lists of figures/tables, how can I use this command in a caption without causing errors?
I would like to be able to use commands with default arguments in captions of figures/tables without causing an error in \listoftables or \listoffigures. For example, the following code causes an ...
0 votes
2 answers
61 views
conditional optional argument not working in the amsthm proof environment
I would like to use the optional argument in the proof environment (provided by the amsthm package) only in one version of my paper, when a toggle Details is on. This is my code: \documentclass{...
3 votes
2 answers
249 views
Pass key-value options to command through newcommand
I am using a command that takes key-value parameters: \somecommand[key1=val1, ..., keyn=valn] and I would like to use it the following way: \newcommand{\myoptions}{key1=val1, ..., keyn=valn} \...
7 votes
3 answers
276 views
New command with named arguments [duplicate]
I wanted to make a command which accepted named boolean arguments like: \mycmd{foo=true, bar=false} So, I tried using keyval package and tried: \documentclass{article} \usepackage{keyval} \...
1 vote
1 answer
54 views
Using xskak for handicap chess
I want to use xskak to typeset a chess game in which Black plays with a handicap; specifically, White is allowed to make two consecutive moves to start the game. (This handicap is similar to the ...
2 votes
1 answer
72 views
Create a macro with optional argument that add a letter
I would like to add an optional argument to my macro \documentclass[french]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[a4paper]{geometry} \...