Questions tagged [newdocumentcommand]
Use this tag for specific problems of using NewDocumentCommand
34 questions
3
votes
4
answers
191
views
Command with `^^` and `__` as exponent optional arguments
In the following toy example, I would like to use __ and ^^ instead of - and .. Is it possible?
\documentclass[varwidth, border = 3pt]{standalone}
\NewDocumentCommand{\hyperseq}{ m e_ e^ e- e. }{%
$...
0
votes
2
answers
87
views
Treat first paragraph after non-floating figure[H] just as you would after section (without using \noindent) [closed]
For my LaTeX documents, everything is just a linear collection of elements. Paragraph, followed by a table, followed by a paragraph, followed by a list, followed by a paragraph, followed by a figure, ...
1
vote
0
answers
68
views
hyperref: wrapper around \href is fails to compile when placed in the argument of another command
Adapting from https://tex.stackexchange.com/a/448977/383565, I constructed my own version of \blink. But, it doesn’t work in captions, unlike the base \href:
\documentclass[a4paper, 11pt]{book}
\...
3
votes
2
answers
163
views
How to \relax a command already created with \NewDocumentCommand?
It is possible to recreate document commands created with \newcommand if they are \relaxed between the \newcommands. Such already created (with \newcommand) commands can even be recreated by \...
3
votes
3
answers
190
views
Custom total points command
Consider the following MWE:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Arial}
\usepackage{tabularx}
\NewDocumentCommand{\printtotalpoints}{ }
{
\par\addvspace{\...
5
votes
2
answers
170
views
\StrSubstitute does not work with arguments passed in a verbatim manner
Goal
I am attempting to redefine an existing command (\mintedinline) which takes a verbatim argument. I need to format this argument such that it can be passed to an outside program for processing; ...
0
votes
1
answer
63
views
Multiple errors in NewDocumentEnvironment. Fixing the errors breaks the output. Missing $ Inserted, Braced quantifier '{' cannot be followed by 'c'
I can see that one of the errors is fixed by putting $$ around the \c{ll/rrparenthesis}, but when I do this the output stops working (my custom spacing disappears). I also really do not understand how ...
4
votes
2
answers
207
views
Is there a better way to implement `\ifblank` condtion check when there are multiple option arguments with default values in a command definition
This question arose while responding to another inquiry on SE Tex. Currently, there is no practical application for this, but I want to be prepared in case I encounter a similar situation when ...
3
votes
4
answers
336
views
Define a command with keys as arguments AND allow the default values depend on each other
Is there a way to define a command\foo taking a key list as its argument AND have the following feature:
The default values of some of the keys (saying, b and c) rely on some other keys (saying, a).
...
2
votes
1
answer
106
views
NewDocumentCommand returns `-NoValue-` where there should be the inputted parameters
I am trying to define a command using \NewDocumentCommand because I want there to be two optional parameters. This is what I tried (after begin{document}):
\NewDocumentCommand{\game}{e{\adv} e{\Pi}}{\...
3
votes
2
answers
129
views
How to capitalize first letter of NewDocumentCommand command result
I'm trying to implement a function to show image. The first parameter is path to image, the second is caption text. The second parameter is optional, when not present it should be equal to file ...
3
votes
2
answers
224
views
Wrapping the Tasks Command in a New Environment
I am trying to remap the \task to a new command that can take multiple arguments (noting that \NewTasksEnvironment can be used to change \task to \item, but this is not what I am trying to fix here).
...
2
votes
2
answers
200
views
Build a new command "newsymbol" with NewDocumentCommand
I want to create a new command \newsymbol, which functions like \newcommand, but with the difference that math is ensured. I also have another reason, why I want to define this new command, namely so ...
2
votes
2
answers
123
views
Supplying data to hyperref's pdfauthor: different command types give different results
The hyperref package allows a list of authors to be assigned to the pdfauthor option. For example, this works for me
\hypersetup{ pdfauthor={Me, Bobby McGee} }
The two authors are recognised in the ...
4
votes
1
answer
224
views
Using command defined with \NewDocumentCommand in TikZ
I’m trying to use a command defined using \NewDocumentCommand in a tikzpicture environment and cannot resolve an error. Here’s a minimal example of what I’m trying to do:
\documentclass{article}
\...
-3
votes
1
answer
88
views
Passing keys to \lenest:nn
Is it possible to pass keys to \lenes:nn ?
\documentclass[a4paper,12pt]{article}
\ExplSyntaxOn
\cs_new_protected:Nn \lenes:nn
{
\str_case:nn {#1}
{
{mig}
{ \geometry { ...
-1
votes
1
answer
73
views
Include font size specification to a command
I would like to include the specification of the font size (\huge \large \normalsize) in the key-value specification.
\documentclass[a4paper,12pt]{article}
\ExplSyntaxOn
\tl_new:N \l_hlov_tipoa_tl
...