Questions tagged [arguments]

The {argument} tag is used for specific questions about macro parameters and arguments.

Filter by
Sorted by
Tagged with
7 votes
1 answer
158 views

#1# signature in macro definition

I'm reading the source code of xcolor and I'm a little bit confused about the following definition: \documentclass{article} \usepackage{xcolor} \makeatletter \def\testclr#1#{\@testclr{#1}} \def\@...
Stephen's user avatar
  • 2,785
0 votes
2 answers
63 views

Remove all instances of {} interior to argument to a command

Is it possible to remove all instances of {} which are passed as parts of an argument to a command? I would like to use the Tensor package with LyX. The problem is that LyX always puts subscripts ...
Mike Pugh's user avatar
0 votes
0 answers
65 views

Runaway Argument Error [duplicate]

I got this error. Can someone please help me how to resolve this error? {This paper presents the hardened properties of a high-performance fi\ETC. ! File ended while scanning use of \field. <...
Sabanda Athauda's user avatar
3 votes
3 answers
161 views

Usage of comma separated arguments in a macro

I've defined a macro \mychapter having an argument which is a list of two comma separated arguments (Author and Title). The macro creates a \chapter and assigns the author and the title to a fancy ...
wolfrevo's user avatar
  • 503
0 votes
2 answers
54 views

Argument string that applies different code expressions based on the specified option

I want to pass an argument string to \NewDocumentCommand that allows me to apply different code expressions based on the specified option. For instance, consider a command named product with an ...
Karl's user avatar
  • 33
4 votes
4 answers
209 views

Using \input for command arguments

I'm making an rpg system. I want to separate the contents of the spell from the formatting of the spell to, for example, be able to format the spells differently for character sheets vs a dedicated ...
Amit's user avatar
  • 43
-1 votes
1 answer
51 views

Referring to arguments in newcommand not working in math mode [closed]

I would like to create a command given the arguments $g,n,d,X$, generates the output $\overline{M}_{g,n,d}(X)$. If no $g$ is given, I would like the default to be 0. What I thought was correct was to ...
Irit's user avatar
  • 1
0 votes
1 answer
81 views

Dependency of arguments

I would like to have a secondary environment named \defin that uses a parent environment, the latter taking three arguments. \defin will call \statement with a hard-wired first argument, the rest of ...
Veak's user avatar
  • 1
2 votes
1 answer
138 views

The argument specifier N and n

I am reading the documentation about Argument Specifiers in 1.1 Naming functions and variables of interfaces.pdf, where each argument is represented by a single letter. I am confused of the argument ...
Veak's user avatar
  • 1
1 vote
0 answers
38 views

Double subscript error on ${\tilde a_0}_0$? [duplicate]

${a_0}_0$ compiles fine: ${a_0}_0$ ${\tilde a_0}_0$ yields a "double subscript" error. Why is that and how can I fix it?
Andi Bauer's user avatar
14 votes
1 answer
633 views

TeX jargon - Difference between "argument" and "parameter" in TeX?

What's the difference between the term "parameter" and the term "argument" in TeX jargon? Are outermost enclosing pairs of matching curly braces of undelimited arguments to be ...
Cattleya's user avatar
  • 349
6 votes
1 answer
95 views

How can I disable shadows (and similar preaction/postaction effects) in TikZ or PGF?

Is there a general way to disable preactions/postactions in TikZ on which effects such as shadows depend? If not, is there a straightforward way to enable users to add options to an existing style so ...
cfr's user avatar
  • 193k
4 votes
3 answers
376 views

Is there a way to add optional and/or named argument to command

I'm writing a handbook for my students and I want to create a command which should draw a task definition, its type and possible features, like source and link to the solution on YouTube. In my plan ...
Nikita Vasiliev's user avatar
3 votes
1 answer
34 views

Trying to modify multiaudience environment

I'm using the multiaudience package - works pretty nice. Here is an example \usepackage{multiaudience} \SetNewAudience{internGER} \SetNewAudience{externGER} \DefCurrentAudience{internGER} ... \begin{...
Georg's user avatar
  • 41
0 votes
1 answer
62 views

Is it possible to define commands that accept different argument types?

This is actually a more general question, but since a MWE is almost universally called for, consider David Carlisle's code \documentclass{article} \usepackage{fontspec} \usepackage{nopageno} \...
Mike Pugh's user avatar
2 votes
2 answers
94 views

Tikz Calendar - how to pass argument with '\def'

Given the following code \documentclass[a4paper,20pt]{extarticle} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[czech]{babel} \usepackage[czech]{translator} \usepackage{graphicx, ...
JoudaBouda's user avatar
1 vote
1 answer
55 views

How to properly set optional boolean parameter for pic in tikz?

I try to draw beam on tikz with the possibility to hide its axis. I created the following: \documentclass{article} \usepackage{tikz} \usetikzlibrary{math, shadings} \usepackage{ifthen} \tikzset{ ...
Sindzicat's user avatar
  • 113
1 vote
1 answer
40 views

Use of \readrecordarray with macro arguments

I'm trying to use readarray package to load several multi-line files with \readrecordarray command for the next processing. Due to processing of several files \readrecordarray is used in a command ...
Andrii's user avatar
  • 11
1 vote
1 answer
42 views

Macro without arguments to define macro with arguments

I'm trying to use xparse and generic TeX/LaTeX commands to write a macro (that takes no arguments) to define another macro that does take arguments: \documentclass{minimal} \RequirePackage{xparse,...
Ben Zelnick's user avatar
2 votes
2 answers
68 views

Early expansion of \newcommand or another macro-like statement

I would like to store a list of arguments within \newcommand, \def or any other macro. Such a list would then be passed to another command. However, it turns out that the list in question is treated ...
scriptfoo's user avatar
  • 251
6 votes
2 answers
98 views

\NewDocumentCommand: Mandatory types r / R and their “default values”

The documentation of xparse states (emphasis mine): r Given as r⟨token1⟩⟨token2⟩, this denotes a “required” delimited argument, where the delimiters are ⟨token1⟩ and ⟨token2⟩. If the opening ...
O'Neil's user avatar
  • 197
2 votes
4 answers
819 views

What are some examples of LaTeX commands which accept three or more arguments?

The \binom command is an example of a LaTeX command which accepts two inputs. We have the following example: \binom{n+1}{2k} What is an example of a LaTeX command with three or more parameters?
IdleCustard's user avatar
2 votes
1 answer
81 views

Command that creates new command based on argument

I want to have a command called \ensureinfocommand that can be called like this: \ensureinfocommand{studentid} This call will check if the command \studentid already exists and if not, it should ...
Luke's user avatar
  • 159
0 votes
0 answers
50 views

How can I highlight certain argument fields

I have this environment with 9 arguments. I want to highlight some of the inputs of the argument (#1). Is it possible to do so? \documentclass{article} \usepackage[margin=1in, a4paper]{geometry} \...
Fahad's user avatar
  • 43
0 votes
0 answers
98 views

Is there a way to remove specific characters from argument of a macro?

Suppose we have a macro saying, \NewDocumentCommand\foo{m}{#1} When it eats an argument, I want it to print whatever is in the argument without specific characters. For instance, I want to remove ...
Gau-Syu's user avatar
  • 463
2 votes
3 answers
174 views

LaTeX3 keyval forwarding

Say I want to write a command igtest, which works identically as \includegraphics from graphicx, except that if the page number is given, e.g. \igtest[page=5]{someimg}, then the page number is ...
Yijun Yuan's user avatar
1 vote
1 answer
93 views

\NewDocumentCommand embellishments/tokens syntax

Edited: David Carlisle kindly provided the answer in a comment, which is the definition after \makeatletter. I'm trying to use embellishments in \NewDocumentCommand to define a macro to kern ...
John Bourke's user avatar
1 vote
1 answer
69 views

Can you not pass argments to commands using keys?

I use my own LaTeX preamble for university, so I am fairly used to creating macros using tools such as xparse. However, I am unsure why I cannot do something that will choose between two images on my ...
TimeTravelPenguin's user avatar
0 votes
1 answer
21 views

Can't pass argument to second part of newenvironment [duplicate]

This code works: \documentclass{book} \newenvironment{testenvironment}[1][] {\begin{quote}#1} {\end{quote}} \begin{document} \begin{testenvironment}[testargument] test text \end{...
Steeven's user avatar
  • 1,397
2 votes
2 answers
177 views

Passing Boolean as Arg to a command

\usepackage{ifthen} %booleandeclaration \newboolean{istest} \setboolean{istest}{false} %Set boolean in if % \newcommand{\activate}[1]{% % \ifnum#1>0{\setboolean{istest}{true}}\fi } \newcommand{\...
d4rkshad0w's user avatar
2 votes
1 answer
126 views

How does tabularray's 'cmd' key work?

A demonstration of the issue by way of a minimal working example I saved the following LaTeX code in ~/Test.tex. \documentclass{article} \usepackage{tabularray} \begin{document} \begin{tblr}{column{2}=...
Evan Aad's user avatar
  • 10.9k
0 votes
2 answers
39 views

Concatenating macro parameter and string adds unwanted space [closed]

I wanted do define a simple macro like the following: \newcommand{\testcommand}[1]{ \includegraphics[]{pictures/#1.jpeg} } But this does not work because it adds a space between the argument #1 ...
Pa Dalton's user avatar
1 vote
2 answers
96 views

Creating "static" arguments in a string

Is there a trick to integrate arguments "statically" in a given string, to use this string in another command that will then process the argument ? Something like : \edef\mystring{Hello #1 !...
Jean-Louis Brabant's user avatar
2 votes
2 answers
210 views

Simplify arithmetics +-, -+, --, 1x, -1x

I made some command \pcoef and \mcoef that simplifies +- and -+ to -, and -- to + in arithmetic expressions, and a \coef that simplifies 1x and -1x to x and -x respectively. They are not really ...
mathteacher's user avatar
2 votes
3 answers
107 views

Command that seems to not be able to unravel the command given in argument

I am trying to define some new commands to be able to define default values for some of the things I will be using over and over again in order to centralize where the style and the typical letter ...
P. Quinton's user avatar
4 votes
1 answer
107 views

Argument “r” in math subarray environment not working

While studying LaTeX, I find that the results of following codes \[ \sum_{\begin{subarray}{c} i<n\\ i+j=k \end{subarray}} = \sum_{\begin{subarray}{l} i<n\\ i+j=k \end{subarray}} ...
Vanellope's user avatar
3 votes
3 answers
303 views

Is it possible to use multiple sub- or superscript syntax in math mode?

I often have to write expressions like this in math mode: L_t^pL_x^q For some reason, I am not always satisfied with typing this and I would like to define some new command with the same output. I ...
Lorenzo Pompili's user avatar
0 votes
2 answers
357 views

Treat command provided as argument as plain text

I find myself struggling with a supposedly simple task but after several hours of searching and trial&error I finally give up. I probably still lack the deeper understanding of LaTeX and its ...
Johnson's user avatar
  • 217
2 votes
2 answers
160 views

Pass xparse optional token argument from outer command to inner command

I have a document command which accepts several optional token arguments, and I'd like to implement another document command which accepts the same optional token arguments and passes them properly to ...
Null's user avatar
  • 1,525
0 votes
1 answer
61 views

How do I parametrize this chapterimage command by an opacity argument?

I have the following chapterimage command, based on this book template (ILM Report by Jenny Lantair) which I use simply by this oneliner: \chapterimage{./res/headers/nature.jpg}. \newcommand{\...
Eldar Sultanow's user avatar
5 votes
2 answers
76 views

Alignment with an empty argument

Here is a little newcommand exo with one argument (for a title for example). Without this argument, the alignment is bad. Is it possible to improve this ? \documentclass[a4paper]{article} \usepackage[...
Clairon's user avatar
  • 353
8 votes
1 answer
516 views

argc argv in LaTeX

Can the LaTeX executable receive arguments from the command line to be used as internal variables? That is, can a command like ./latex document.tex a=3 b=rational c=-17.2 d=true be used to pass values ...
sood7600's user avatar
1 vote
1 answer
41 views

Syntax: use second argument leaving the first argument as default in a macro

I use this command to abbreviate my notation \NewDocumentCommand{\Lp}{O{p}O{\mathbb{R}^d}O{[- \infty, \infty]}}% {L^{#1}(#2, #3)} I've set one default for each argument, in most cases I need just ...
Fral's user avatar
  • 79
3 votes
2 answers
94 views

Using `\<char> notation to work in replacement text (macro argument) - plain TeX

I'm still trying (again) to not succumb to the TeX syntax. I'd like to create a "if/when" that checks if a character is letter (catcode 11). \def\whenletter#1{\expandafter\expandafter\...
Daniel Bandeira's user avatar
0 votes
2 answers
83 views

Moderncv package provides error for optional arguments: why?

So I'm writing my CV using moderncv from TeXLive on Arch Linux. Note that I am on Emacs, where an expanding snippet for cventry gives me this suggestion: \cventry{year}{job}{employer}{city}{...
Alessandro Bertulli's user avatar
0 votes
1 answer
41 views

Grab variable number of tokens – xparse macro

I'm trying to create the following macro: \adddescr{<comma separated list>}{<description 1>}...{<description n>} this macro should print element -- description \par accordingly, so ...
antshar's user avatar
  • 4,126
2 votes
1 answer
71 views

How to avoid typing \leavevmode before a citation macro that already starts with \leavevmode?

Control sequences with optional arguments inside optional arguments must be "hidden" with braces. Using the abntex2cite package to handle my citations, I often want to write: \begin{teor}[{\...
Daniel Diniz's user avatar
1 vote
2 answers
92 views

Is there any way to pass variables to commands?

Right now I'm doing some math homework that has lots of ordered pairs. Being lazy, I got tired of writing \langle x, y \rangle and so I was wondering if there's a way to define a command, say \ordered,...
tcb93's user avatar
  • 157
1 vote
1 answer
103 views

Is it safe to use \globaldefs for setting global pgf key-value pairs?

With the help of this post (Is there a way to set a *global* key value using `pgfkeys`?), I found a simpler way to implement a solution to my own question (How can I create commands using multiple ...
frankieee's user avatar
0 votes
0 answers
73 views

Argument of \cvskill has an extra } when trying to override an existing command

I'm using the moderncv package which already defines the \cvskill command. I'm trying to override/redefine this command with \renewcommand: % ... % param 1: name of the skill / tech / etc. % param 2: ...
Pieber's user avatar
  • 101

1
2 3 4 5 6