All Questions
147
questions
1
vote
1
answer
52
views
Expanding Variables to Input as Arguments for Macro
I have an issue when trying to use variables in a command (\ResearchModule). I read up to 8 lines from a text file and have them set to elements of an array (using code thanks to egreg!), with \...
0
votes
1
answer
68
views
Getting the Maximum Width of a List of Items
I'm trying to write a command to get the maximum width of a (comma separated) list of items, for example \myLengthCommand{lorem,ipsum,lorem ipsum} should return the width of the text "lorem ipsum&...
2
votes
1
answer
50
views
`already defined` error with scoped newcommand
I want to make it easier on myself to write large commands
like this by "naming" the arguments.
I did this:
% Define the command for vector projection with named arguments
\...
1
vote
1
answer
78
views
Defining a Set of Keys in Terms of Another Set of Keys
If I have 2 macros, one inside the other, while the top-most one has a bit more parameters, I would like to be able to set the top-most macro's keys as an extension of the bottom one, something ...
1
vote
2
answers
88
views
Is it possible to name macro (`\newcommand`) parameters and do math with them?
I'm new to creating commands in LaTeX, and I would like to do something like adding a more helpful name inside my command, as I do calculations with it; while also doing some math with said parameter. ...
3
votes
1
answer
111
views
"unexpected $ after $$" and "unclosed $$ found at $" errors with inline math inside display mode
I am trying to define a new command for different types of homomorphisms. The command is:
\newcommand{\Hom}[2][]{%
\operatorname{Hom}_{\textnormal{#1}}\left({#2}\right)%
}
The outputs of this ...
4
votes
3
answers
203
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 ...
4
votes
4
answers
254
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 ...
-1
votes
1
answer
72
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 ...
14
votes
1
answer
682
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 ...
4
votes
3
answers
409
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 ...
1
vote
1
answer
71
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,...
2
votes
2
answers
74
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 ...
2
votes
4
answers
882
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?
2
votes
1
answer
90
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 ...