Questions tagged [arguments]

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

Filter by
Sorted by
Tagged with
5
votes
3answers
77 views

How to change value of an argument (e.g. #1) such that any reference to it (the argument, #1) would expand to the new value?

I was wondering how to change #1, based on its value, to something else such that any #1 that follows the change would contain the modified value, not the original value (passed to the macro from ...
0
votes
1answer
41 views

How can I pass an argument to a command defined and called in a .cls file using another command called in a .tex and defined in the previous .cls?

I am building a résumé on which I would like to list the languages I speak and my level in each one of them. To present the levels, I wish to use skill dots. I want to obtain a structure similar to ...
6
votes
2answers
285 views

Issue with Expansions of Nested Macros

I am trying to incorporate membership checking macros by marmot and Phelype Oleinik (thanks to both of them for their neat solutions) into an argument of another macro: \singleBox{\...
1
vote
2answers
62 views

Formal term for LaTeX shorthand

It is possible in LaTeX to write expressions like \frac12, which should be equivalent to expressions like \frac{1}{2}. Is there a formal term for the first form of notation?
3
votes
2answers
41 views

Nested keyval proper parsing

I have two families of keyval arguments, and two functions, and I want them to behave like on toy MWE below. \documentclass{article} \usepackage{xkeyval} \usepackage{xparse} \makeatletter \define@...
2
votes
1answer
32 views

Calling a Macro as Argument of Another Macro

How can I call a macro in an argument of another macro? I am having difficulty running the following LaTeX code. I used \fpeval to be able to process floating-point numbers. \documentclass[tikz, ...
2
votes
2answers
52 views

How to undefine a command with arguments?

I am trying to define \d as \delta in mathmode, but apparently \d is defined as a dot below and it needs an argument: \d{a} would give an a with a dot below. How can I do this? Here are the packages I ...
0
votes
1answer
30 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 ...
3
votes
1answer
51 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 ...
0
votes
1answer
45 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 ...
3
votes
3answers
76 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 ...
7
votes
3answers
271 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
237 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
198 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
24 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
125 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
69 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 ...
16
votes
3answers
576 views

\NewDocumentCommand: Why can't I put args on an own line?

I encountered a peculiarity concerning \NewDocumentCommand arguments. In a case where I had real long names in the arguments, I wanted to put them each on its own line. The first ones are OK, the 2 ...
2
votes
2answers
270 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[...
12
votes
1answer
246 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
143 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
370 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
174 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
48 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
211 views

LyX | change macro argument order

In LyX, is it possible to change the order of required and option arguments of a macro? I want to make the option argument come after the required argument in this macro. If it's possible, how can I ...
2
votes
1answer
129 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
99 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
39 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
167 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
129 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{...
5
votes
2answers
151 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 ...
7
votes
2answers
181 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 ...
3
votes
0answers
53 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
223 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
106 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
133 views

LaTeX Nesting \verb in \section

Why is \section{\verb|mySec|} invalid LaTeX code.
2
votes
1answer
78 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
84 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 ...
6
votes
1answer
195 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
120 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
84 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
70 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
101 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
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
373 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
152 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{\...