Questions tagged [arguments]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
45 views

Processing separated list of separated lists

Is it possible to create function foo that takes list of arguments and this argument is also a list, e.g. to require the following semantics \foo[x:1,z,y:2], i.e. it takes three comma separated ...
3
votes
3answers
74 views

Allow Optional Delimited Params To Appear In Any Order (EASILY) (e.g. \REset[s](X){e}=\REset(X)[s]{e})

My package rec-thy has a number of macros that allow the optional specification of both a stage (as part of a stagewise approximation) as well as a relativization. I've adopted the convention that ...
0
votes
1answer
36 views

A question about arguments to a LaTeX macro

Several weeks ago, I asked a question about a LaTeX macro to insert an image in a document using an IF statement. The solution worked perfectly. Now I have a similar issue. I have the following ...
7
votes
3answers
270 views

How to test if argument is a single space?

I am currently writing a document, that sometimes requires me to alternate the colors of the letters in a sentence. I thought it would be easy to find a way to create a macro that does that, but I've ...
7
votes
3answers
235 views

Macro that takes any latex code as an argument

So I am thinking of creating a macro that takes any latex code as an argument. For example, \newcommand\purp[1]{\color{purple} #1} I hoped that this macro would make any latex code inside of \purp ...
5
votes
2answers
195 views

Use second argument for optional first argument if not provided in macro

I'm trying to construct a command with one optional and one mandatory argument and I'd like the default if the optional argument is not provided to be #2. Why does this not work? (error: Illegal ...
1
vote
0answers
19 views

Passing arguments to longfbox in BeforeBeginEnvironment

I defined a \BeforeBeginEnvironment for lstlisting and added a default \begin{longfbox}[...] definition. What I want is to pass some custom arguments to \begin{longfbox}[...] defined in \...
0
votes
1answer
99 views

cite not working with 2 arguments

I want to include a reference with text before the citation in parentheses, like so: "(e.g., Brautigam & Bell, 1995)". I have to use the \cite command, because it's a journal template with strict ...
1
vote
1answer
68 views

Is there option in any IDE to display available options for specific function?

Does any IDE support feature to show all available arguments for specific function? For example instead just showing circle(nothing) like this: To show something like this (similar like Visual Studio ...
2
votes
2answers
263 views

How do you write a macro that takes arguments containing paragraphs?

I'm trying to write a macro that takes arguments containing paragraphs. If you write a normal macro and one of its arguments contains a paragraph, it will break: \documentclass{article} \usepackage[...
0
votes
1answer
29 views

Pseudocode argument management: best way to deal with many arguments

In latex pseudocode, if you have function calls inside another function with many arguments, lets say more than 4, would you still put the arguments everywhere, omit them or use some kind of ...
12
votes
1answer
232 views

About the definition of textcolor

I was curious and found the following definition for the macro textcolor defined in the package xcolor: \def\textcolor#1#{\@textcolor{#1}} \def\@textcolor#1#2#3{\protect\leavevmode{\color#1{#2}#3}} ...
1
vote
0answers
26 views

Macros passing arguments of different data types [duplicate]

I'm new to LaTeX and quite impressed with this program! So, I'm willing to concede not being entirely certain that the issue I'm having has to do with data types, or just using \includegraphics{} ...
2
votes
2answers
137 views

Invoking \input without arguments/parameters

I am wondering what the effect is of invoking \input without any arguments/parameters followed by an empty line: Code: .... \input ....
2
votes
1answer
305 views

What is this \newcommand argument? [duplicate]

\newcommand*{\name}[1][C]{% I have come very familiar with \newcommand however, I came across this line of code and i do not know what the [C] is for.
3
votes
2answers
171 views

For the life of me I can't find the runaway argument here — but then I'm very new to all this

\documentclass[11pt, oneside]{article} \usepackage{geometry} \geometry{a4paper} \usepackage{graphicx} \usepackage{amssymb} \usepackage{arydshln} \usepackage[table]{xcolor} \usepackage{pifont} \begin{...
0
votes
1answer
46 views

Problem calling \creflabelformat from a command

I'm using the cleveref package with some customizations, using \creflabelformat. Because cleveref should be the last package to load, and because the customization commands should come after cleveref ...
2
votes
1answer
125 views

Using exam question counter as an argument

I am trying to use the exam class to create a study guide for my students that has all of the answers at the end of the document. I would like to have the answers automatically labeled by question ...
5
votes
1answer
96 views

Strange error for passing parameter to forestset to draw tree

I am trying to draw a simple probability tree, where the probabilites could sometimes be fraction or decimals., this means, I will have to adjust the spacing. So I tried the below code. This produces ...
3
votes
1answer
37 views

Variable expanding inside BibLaTeX \addbibresource

I am working with a custom class provided by my university for the typesetting of thesis. The class automatically includes BibTex references in the document. I want to modify the class to make it work ...
2
votes
1answer
156 views

Sine squared with parentheses for argument

I have a number of trig functions raised to some powers, and the arguments are often different from just t \sin^2{\frac{2\pi}{T}t} for example Now, I would like to get the argument to be in ...
4
votes
2answers
127 views

Formatting phonenumbers with phonenumber-package and macros as argument (expand-problem)

I try to use the phonenumbers-package to format phonenumbers. As argument I want to use a macro (in the actual document the macro will be defined with pgfkeys!) What I tried so far: \documentclass{...
7
votes
2answers
179 views

How to define a comma separated list of arguments for includegraphics

I have a large set of pictures, and I want to apply predefined settings to each using the optional argument of the \includegraphics macro from the graphicx package. I would like to define the ...
5
votes
2answers
149 views

Plain LuaTeX: Detecting if displaymath is ended by $$ or \Ustopdisplaymath

In the TeX Book (chapter dirty tricks) there is mentioned a way to left align displaymaths. https://arxiv.org/macros/cp-aa.tex A macro \displaysetup whose argument is delimited by $$ is used. So it ...
3
votes
0answers
52 views

Duplicating a new line in a new command

I'm trying to write a new command which will duplicate the last line. I don't want the content duplicated. I just want the template for the last line line duplicated so I can enter new data to the new ...
2
votes
2answers
53 views

Error when using command as parameter for an other command

I want to use 2 seperate commands to first execute a calculation on a number and then displaying the number with plus or minus using following code. When trying to run it I get various errors. I ...
7
votes
1answer
218 views

Optional args for TikZ style

I have a defined a TikZ style "midcircle" that decorates a path with, say, a small circle in the middle (with the decorations.markings library, setting "pos=0.5"). E.g. \draw (0,0)edge[midcircle](1,0)...
1
vote
1answer
103 views

LaTeX Grammar and Nesting Rule

Is there any grammar and rule describing the allowed nestings and combinations and the allowed format of the arguments in LaTeX? E.g. \section{\verb|mySec|} \section{\begin{huge}mySec\end{huge}} \...
2
votes
1answer
70 views

How to add an argument to a \cline-like macro?

I want utility macros that allow me to change (a) the thickness and/or (b) color of \hlines or \clines in tabulars. I want to do so without redefining \arrayrulewidth but rather by modifying the ...
3
votes
1answer
79 views

How to pass tikz code as an argument?

I want to prepare an environment to show a view of a display and use some tikz code as an optional argument to mark some things on it. The first "screen" shows result with hardcoded nodes but I need ...
2
votes
1answer
123 views

LaTeX Nesting \verb in \section

Why is \section{\verb|mySec|} invalid LaTeX code.
6
votes
1answer
191 views

Why does \renewcommand{\A}{\B} change the value of \C? when \A, \B, and \C are arguments?

I'm very puzzled by the effect of a \renewcommand with two macros as arguments that appears to affect the value of a third macro. This all occurs within a command to which all three macros are passed ...
1
vote
2answers
109 views

Fractions and counters in a \foreach list of pairs

I'm trying to create a macro that will take a list of pairs as an argument in order to draw a pie chart. I'm trying to make it so that portions of the pie are specified as a fraction less than 1. Here'...
3
votes
1answer
83 views

TikZ PGF - Minus sign being interpreted as a unit of measure

I'm trying to write a macro that draws a number line given a number of tick marks to use. However, there are a couple of spots in the code where I try to do arithmetic using the argument of the ...
4
votes
1answer
65 views

tikz : Specify a percent parameter in a path

I am trying to define a style to draw a bend line from one shape's south to another shape's west \documentclass[border=5mm, convert, usenames, dvipsnames]{standalone} \usepackage{tikz, pifont, xcolor}...
4
votes
2answers
100 views

Define macro whose argument is a word

I need to define a macro whose argument is the next word (the first character after the word should be a blank space, the end of the line, or a punctuation mark from . , : ; ! ?. For example, let's ...
2
votes
2answers
68 views

latex table variable/optional many arguments

I would like to create a new tabular environment that allows me to add n (1-10) arguments without adding extra columns (such that both examples below work). Here is my code: \documentclass{article} ...
0
votes
1answer
96 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
69 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
369 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
139 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
482 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
60 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
46 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
50 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 ...
2
votes
2answers
69 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} \...
1
vote
1answer
86 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 ...
6
votes
2answers
184 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
68 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. ...