Questions tagged [arguments]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
99 views

Generate math symbols from argument

I have been trying to create a small latex math symbol reference. My list will require repetition of lines like \textbackslash lfloor - $\lfloor$. I want to create a command that takes in one argument ...
2
votes
3answers
70 views

Custom command with addressable arguments

I know about \newcommand[<arg_num>]{#1 ... #n} to define a simple macro with up to nine arguments. (More if you link multiple newcommands together) I recently started to look at xparse for ...
8
votes
4answers
377 views

Runaway argument? with \newcommand[2]

I have a date (in the format YYYY.MM.DD) and a time (format HH:MM). From these, I want to compute a kind of TimeStamp/Total of minutes. \documentclass{article} \makeatletter % Timestamp \...
1
vote
1answer
157 views

Runaway argument? with \def

I have a time value in the format HH:MM (i.e 03:00). I need to compute the TotalMinutes of this time (expected result 180). My current code is \documentclass{article} \makeatletter \newcommand{\...
0
votes
1answer
523 views

Argument of \language@active@arg~ has an extra } when long caption

Here is my Preamble: \documentclass[letterpaper, 10 pt, conference]{ieeeconf} \overrideIEEEmargins \usepackage{graphics} \usepackage{graphicx} \usepackage[spanish]{babel} % spanish \...
3
votes
1answer
61 views

newcommand says missing number

I plan to write a command which rounds a number with n digits. n is an optional argument and it is 2 by default. However, I keep receiving error message: Missing number, treated as zero. Let's see ...
0
votes
0answers
47 views

Is there a list of ALL standard commands of LaTeX 2e? [duplicate]

I am looking for a list of all commands available in LaTeX 2e, commands available without packages. I am creating a parser for latex therefore I need to know all commands and the corresponding ...
1
vote
1answer
55 views

\IfStrEqCase redefines #1

What is the meaning of #1, #2, etc in the optional parameter of \IfStrEqCase? This required me to use a ##1 instead of #1 within \pgfplotsinvokeforeach which I was not expecting. I would have ...
0
votes
0answers
46 views

How to pass argument to an environment in command form

I have defined \newenvironment{cvolist}[1][2.25cm]{\setlength{\pwd {#1}\enumerate} {\endenumerate \aftergroup\ignorespacesafterend\vspace{-1.5em}} That way I can have a list in an environment (this ...
1
vote
1answer
94 views

How to enter multiple arguments in the interactive math mode

I've defined a new command in the document's preamble. For the sake of this question the following (tested!) example: \newcommand{\multipleargs}[3]{{#1}-{#2}-{#3}} Using [cmd]-M on MacOS I want to ...
2
votes
2answers
76 views

xpretocmd: Why are my arguments not working?

I just tried to keep track of my current chapter name, because I use the first letter for certain namings in my document, so I wrote this code to save it: \documentclass[12pt,a4paper]{scrreprt} \...
6
votes
2answers
189 views

Variable argument macro to define splitting polynomial

I need a macro that behaves the following: \mpoly{x}{1}{2} outputs (x+1)(x+2) \mpoly{x}{1}{2}{3} outputs (x+1)(x+2)(x+3) \mpoly{x}{1}{2}{3}{5} outputs (x+1)(x+2)(x+3)(x+5) and so on. I am not at ...
0
votes
0answers
78 views

Mathpartir: How to insert “\\” between entries with macro?

I'm using a tool to generate large amounts of LaTeX, which contain inference rules that I'm typesetting using mathpartir. Below, I've got a MWE that's very similar to the code I've got generated. ...
4
votes
2answers
127 views

Use N type for own macros

Background In LaTeX3 I’m programming some macros to store and read contents from a variable like \tl_set:Nn does. An thus I’m generating variants using the N type, which causes a warning. The warning ...
2
votes
1answer
72 views

Regex within new command to prevent making tooltips of tooltips

I'm making a document where I want the definitions of entries in the glossary to appear as tooltips. The tooltip code itself is from the answer: Can't embed hyperlink references in a tooltip ...
1
vote
2answers
64 views

why is the directory trimmed from my path argument in includegraphics?

Hi community I have a weird problem. It seems that includegraphics won't accept the entire argument, it always trims off the directory part! The argument was manipulated and concatenated in another ...
2
votes
1answer
322 views

How to pass literal comma as argument

I am using minted for code highlighting. I have defined a new minted file format, with the code \newmintedfile[plaintextfile]{text}{ ... breakafter=<values to break lines on>, ... }...
4
votes
4answers
545 views

Detect no argument in \newcommand

I wonder if there is a way to create a command which can discriminate when there is an argument or not. I don't mean empty argument, I mean no argument at all. Here an example \newcommand{\mycommand}...
2
votes
1answer
93 views

Using greek characters in commands' arguments without braces

First I want to make clear that I'm a LaTeX beginner, so I'll be detailed because I just have no clue about the origin of my problem. I'm using TeXstudio 2.12.6 I'll provide context: I have been ...
0
votes
1answer
107 views

How to know all the optional arguments of Latex commands\environments? [duplicate]

For external packages CTAN provides the needed documentation, however, for built-in Latex commands I am not aware of any proper documentation except for The (not so) short introduction to Latex which ...
2
votes
2answers
117 views

Using a line number reference as an argument for footnote

The \footnote{text goes in here} command takes an optional argument for numbering, so if I want to skip straight to footnote #5 or override the default numbering, I can do that: \documentclass{...
1
vote
1answer
65 views

Bugs in conditional structure in a newcommand definition with optional arguments

I am trying to create a new command for add a caption and/or the label to an equation. The not optional parameter is for the text of the equation and first optional parameter is for the label, the ...
2
votes
2answers
92 views

Probably a gdef-expansion problem, but how to solve?

Trying to integrate the answer of this post it into my real code, I face the error Argument of \timedelta@i has an extra } when calling the proposed method. Upto now, I've not been able to fix it. ...
2
votes
2answers
78 views

Probably just another gdef-expansion problem

In continuation of the post, I try to make the following (simplified) code to work. \timedelta uses 2 arguments. Using a \gdef as the first argument is Ok. Using a \gdef as the second argument is Nok....
2
votes
2answers
465 views

How can I make a list with variable parameter size inside of a custom environment?

I have a custom environment that I am using as part of a template. Right now this is the code for the template file. %----------------------------------------------------------- % customtemplate....
0
votes
1answer
71 views

Macros with 0, 1 or 2 arguments

Is it possible to build a macro accepting 0, 1 or 2 arguments ? Why ? I want to have the following functionalities. \exercice will print Exercice alone. \exercice{2} will print Exercice (2 pts). \...
1
vote
1answer
179 views

expandafter and csname

I was recently looking for the creation of commands that use the name of another command and I recently discovered \expandafter and \csname instructions. I manage to create simple one using these ...
2
votes
1answer
246 views

\IfNoValueTF - How to force “no value” if there (are brackets but there) is no value for an argument

This code uses LaTeX3, the xparse-package and in particular the \IfNoValueTF command as explained in Will Robertson's answer to the OP "Different command definitions with and without optional argument"...
2
votes
1answer
88 views

Print counter received as argument

I'm trying to print a counter whose name I receive in the argument #1. I tried \the#1, which doesn't work and also tried the solution given in this answer, which gives me the error "You can't use \let ...
1
vote
1answer
380 views

Passing arguments to LuaLaTeX with LuaSQL [duplicate]

I am using LuaLaTeX with LuaSQL and I have two files which are test.tex and test.lua. When I compile with lualatex test.tex, first test.lua is ran and it reads user values from my database for rows ...
1
vote
2answers
86 views

How to reference a node's anchor by optional parameter (#2) inside a style when that node is referenced by parameter (#1) itself?

I have a style (POSITION) that references a node by parameter \documentclass{standalone} \usepackage{tikz} \usetikzlibrary {% positioning, shapes.geometric } \tikzset {% ...
1
vote
1answer
135 views

How to pass a caption as an argument of newenvironment

I make a next newenvironment to insert the code of a tikzfigure in the document \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[spanish]{babel} \usepackage{minted} \usepackage{tkz-...
4
votes
2answers
136 views

In TeX how can I define a list of data such that I can use a numerical argument to call for one entry out of the list

I would like to be able to have a defined macro something like this: \def\testmacro[1]{[54.7],[74.1],[98.5]} Such that when I call \testmacro{2}, in a document, 74.1 is printed. Is this ...
3
votes
2answers
223 views

Using \foreach with \SplitArgument

Why does the \test command not split the argument when called from a foreach loop? \NewDocumentCommand{\test}{ >{\SplitArgument{3}{|}} m }{\printtest#1} \NewDocumentCommand{\printtest}{mmmm}{ (...
5
votes
2answers
173 views

Reading the arguments of my command and using them in the command

My question is about reading and using the arguments of a custom created command using \def. Let's say I have the command \mytestcommand and I want to read and use it's arguments (optional and ...
1
vote
1answer
166 views

Getting arguments of any LaTeX command

I do not like R and LaTeX. I simply love them. In R, I can get the arguments of any function using args(function_name) on command line. I wonder if we can get the list of all possible arguments of any ...
1
vote
1answer
83 views

Macros taking code as an argument which can access parent arguments in LaTeX 3

In Latex 3 I would like to be write a macro which takes as an argument code which can internally define a macro. How do I do this in a way that allows the code being passed to access arguments of the ...
7
votes
2answers
330 views

Understanding \@firstofone

I was looking over this answer and trying to understand the code, I am a super newbie (my second day) in LaTeX and I stuck at the following part of the code that i could not make it work in a not ...
0
votes
1answer
45 views

Only last value of a variable goes into \psfrag function

I make two calls, but it seems like only last value of \lRaise goes into the function, so both boxes are raised by -5pt: \newlength{\lRaise} \setlength{\lRaise}{-0.97pt} \psfrag{low-order}[B][][0.8]{\...
3
votes
1answer
160 views

How to create a table macro that takes more than 10 arguments

I want to create a macro that creates several tables. In the example below, the command that creates the tables \chungeltable will use one argument for each column in the table (More than 10 columns). ...
3
votes
1answer
114 views

Environment with optional argument configuration in TeX4ht

I am tried to create configure the below environment with optional argument in TeX4ht \newenvironment{proof}[1][Proof]{\textit{#1}:\ \ignorespaces} {} MWE \documentclass{...
10
votes
1answer
188 views

Omitting argument in command definition

Sometimes I define model commands (\foo in the example below) and then particular commands based on that model (\fool in the example below). However, I am not entirely sure I am using the correct ...
4
votes
2answers
149 views

\def'ed plain-text argument behaves differently from plain text

So this is my example, closely related to Remove extra curly braces. Apart from my application, trying to line-break the labels in the margin even if they do not have spaces in them, I am trying to ...
1
vote
1answer
152 views

Command with argument and several results inside command (inside command…)

I want to reuse a command that performs the same type of action (a specific parsing of the incoming expression) inside the other command, which should form the contents of the document and can also ...
7
votes
2answers
372 views

Handling _ (underscores) in a macro's comma-separated list of arguments

Context: I created a "\citep-like" macro. I use it in the body of my document to refer to some code found in appendix. My macro takes a comma-separated list as input, and prints each element of the ...
7
votes
3answers
934 views

Biggest depth of a character in a string

I need to find depth of a string, for this end i would like to loop over the string and ask for depth of every character. I ask for depth like this: \dimen=\fontchardp\expandafter\font`\a And loop ...
3
votes
2answers
138 views

how to expand a keyval argument

I'm trying to expand a value for an argument which will be the range of pages included in the document, but I can't figure out how to do that. At first, I was getting ERROR: Missing = inserted ...
1
vote
1answer
386 views

How to globally define different task bar colors in a gantt chart?

I've been working with this gantt chart example here. I would like to add user specific colore bars. Essentially, I don't want to have to type bar/.append style={fill=green} into every new bar command....
9
votes
4answers
642 views

How to write a macro that takes a variable number of arguments

I am trying to make a new command called \com which can do the following: If no argument is provided to \com, $\com$ produces the symbol $\lambda$. If one argument is provided, e.g. $\com{f}$, the ...
6
votes
2answers
787 views

One `\newcommand` for inserting figures differentiating two cases with/without captions

I have written the following two \newcommand for inserting figures with or without a caption, respectively. % for fig with caption: #1: width/size; #2: fig file; #3: fig caption \newcommand{\...