All Questions
196
questions
1
vote
1
answer
122
views
Macro with verbatim argument
Is it possible to define a macro \foo such that it can accept verbatim code like: \foo{cos(16 % 2)} without interpreting them as latex code first? I know I can use an environment for that, but I ...
4
votes
4
answers
369
views
\def vs xparse \NewDocumentCommand with delimited arguments
Based on my previous question I noticed (IMHO) that it is not so easy to make macros with delimited arguments with xparse instead plain-TeX's \def. As far as I know the LaTeX way - \newcommand -
has ...
3
votes
5
answers
224
views
\NewDocumentCommand with delimited arguments
How can the following command be implemented with \NewDocumentCommand?:
\def\bracket<#1|#2>{
\left\langle #1 \right|\left. #2 \right\rangle
}
MWE
\documentclass[]{article}
\def\bracket<#...
4
votes
4
answers
113
views
Nested SplitList Problem for quick expansion
I'm thinking whether I can write a new command for quick inserting any number of small groups of vectors in vector space. Here is what I want:
$\basis{x; u; v}$
will automatically resolve to:
$x_1, \...
3
votes
1
answer
131
views
Add aliases for command while defining command
I'd like to have a command \NewDocumentCommands which allows for multiple commands to be defined at once using the same definition. For example:
\NewDocumentCommands { \powerset, \Powerset, \PowerSet }...
1
vote
1
answer
38
views
Command color not working with the name of a color built through macros
Consider the following code and especially the command \nicecolorname which builds the name of a color following the pattern ["nice"][shade][hue]. In its current name, the command \color is ...
0
votes
1
answer
49
views
Custom command in \NewDocumentCommand documentation
I'm seeing a rather unexpected result with \NewDocumentCommand. Suppose I have a custom-defined command \mybold{}, like this:
\NewDocumentCommand{\mybold}{m}{\mathbf{#1}}
Or \oybold[]:
\...
3
votes
1
answer
79
views
Redefining \input with itself leads to unexpected behaviour
I am trying to intercept calls to \input and branch of functionality for some filetypes. However, I have run into the following strange error:
Consider the M(n)WE given below, where the macro \input ...
0
votes
1
answer
49
views
Number rows of table in decimal and hexadecimal with multiple counters
TL;DR My code to automatically number a table with two running counters in decimal and zero-padded hexadecimal (using the fmtcount and array packages) is not working.
I'm trying to automatically ...
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,...
0
votes
1
answer
80
views
Using \NewDocumentCommand to redefine a table rule [duplicate]
I was trying to redefine an old command \lightrule with the new syntax from xparse.
When I try to use \newlightrule unexpectedly it displays Misplaced \noalign error.
Minimal Working Example and ...
1
vote
3
answers
94
views
Using Macro Inside Description List Label
I made a macro using xparse for formatting the month with optional day and year. Except the appended optional argument doesn't work inside a description label for the description list---unless I ...
2
votes
1
answer
67
views
How to add rows to a table via a command
I'd like to do something very similar to this question here:
Add Rows to Table With Macro
However, I cannot get it to work with my case of a version log table created with the tabularray package and ...
3
votes
2
answers
205
views
LaTeX3: elegant way to forward arguments (tokens, star, embelishments) to another command
I struggle to define elegantly a LaTeX3 command and forward its arguments (notably stars, tokens, embellishments) to another command. I guess I might be able to make it work using \expandonce or alike,...
1
vote
1
answer
77
views
Can you not pass argments to commands using keys?
I use my own LaTeX preamble for university, so I am fairly used to creating macros using tools such as xparse. However, I am unsure why I cannot do something that will choose between two images on my ...