Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arguments]

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

5
votes
2answers
178 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
13 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
47 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
65 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
232 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
25 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
172 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
25 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
124 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
106 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
168 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
37 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
101 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
88 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
36 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
110 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
126 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
174 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 ...
4
votes
2answers
137 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
50 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
52 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
179 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
95 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
53 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
67 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
103 views

LaTeX Nesting \verb in \section

Why is \section{\verb|mySec|} invalid LaTeX code.
6
votes
1answer
173 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
96 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
76 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
55 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
97 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
63 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
91 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
58 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
357 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
93 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
362 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
52 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
45 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
44 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
42 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 ...
3
votes
2answers
66 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
68 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
179 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
55 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
118 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 ...
16
votes
3answers
523 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
1answer
59 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
235 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>, ... }...