Questions tagged [xparse]
Now integrated in the LaTeX kernel as {ltcmd}. Formerly, {xparse} was a package from the LaTeX3 project that provided a powerful mechanism for defining new commands with various types of arguments.
759
questions
1
vote
1
answer
44
views
Using \RenewDocumentCommand to redefine \theequation label cases incorrect referencing
Using \renewcommand solves the issue, but is this a bug in \RenewDocumentCommand?
\documentclass[11pt,openany]{book}
\usepackage{fancyhdr}
\fancypagestyle{plain}{\pagestyle{empty}}
\usepackage{...
1
vote
2
answers
68
views
Function to output array in itemize
I tried to create a single function that would output inline and function return arrays represented as clists in itemize. I didn't succeed to create such function, only separate ones.
This function ...
0
votes
2
answers
70
views
compute a scale factor for use in includegraphics
I want to compute a scale factor for use in includegraphics. I want to do this using the declarations from xparse. What I have so far (based mostly on https://tex.stackexchange.com/a/437494/293199):
...
1
vote
1
answer
40
views
TikZ, polyglossia, \footnote interference? [duplicate]
With this MWE I can either setotherlanguage{latin} or get the tikz picture to print as desired in a footnote, but I haven't figured out how to do both. Doing both causes "missing \endcsname" ...
0
votes
0
answers
34
views
Create alias of verbatim environment with optional arguments
I'd like to create an alias of the verbatim (xsim-based) environment
\begin{CacheMeCode}{tikzpicture, optional arguments}
\end{CacheMeCode}
to
\begin{tikzpicture}<optional arguments>
\end{...
0
votes
1
answer
53
views
How to create a LaTeX3 environment in paracol without delimiter issues?
I would like to turn this answer into an environment.
Therefore, I use xparse to define a LaTeX3 environment, but I am missing a little something because it creates errors.
It seems, I have issues ...
0
votes
1
answer
39
views
How to use NewExpandableDocumentCommand with a foreach inside a TikZ-matrix
Follow-up question to https://tex.stackexchange.com/a/714853/46023
I have the command
\NewExpandableDocumentCommand{\test}{O{} m}{%
\foreach[count=\no from 0] \No in {1,...,#2}{%%
\node[draw, yshift=-...
2
votes
3
answers
187
views
Find Text Between tabs [closed]
I copied a sheet from google sheet into a *.txt and want to format it to a pdf.
I could separate it with
\loop\unless\ifeof\mytextfile
\read\mytextfile to\mytextline
So I have in every loop one of ...
1
vote
1
answer
42
views
tcolorbox and ifmtarg: bad argument specification when checking for empty argument using @ifmtarg
Problem
I am trying to put a bunch of optional arguments in a new tcolorbox definition, and trying to use the ifmtarg so I can skip some optional arguments like in the following syntax:
Example 1: A ...
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, \...
0
votes
0
answers
57
views
v-type argument in \NewDocumentCommand ignores spaces
Consider the following code:
\documentclass{article}
\usepackage{listings}
\NewDocumentCommand{\hey}{v}{\lstinline|#1|\ignorespaces}
\begin{document}
\hey|a |b
\lstinline|a |b
\end{document}
Why ...
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 }...