Questions tagged [xparse]

A high-level package from the LaTeX3 project that provides a powerful mechanism for defining new commands with various types of arguments.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

How to write this xparse code more elegantly?

I'm currently trying to write a command using xparse, which translates into \A \A{Test} \mathbb{A} \mathbb{A}(Test) Also the full functionality of paired delimiters should work (\A[\Big]{Test} or \A*...
2
votes
1answer
37 views

Accessing sqlite3 with xparse (under XeLaTeX)

I was very happy when I read egreg's 2019 Addendum about how to launch a shell script from LaTeX and grab the output. But when I tried to use it to connect with a SQLite database, I got a LaTeX3 error....
7
votes
1answer
89 views

Problem when using the specifier `b` of `xparse` with tabulars

Edit: Phelype Oleinik has opened an issue in the bug tracker of LaTeX3 for that issue: https://github.com/latex3/latex3/issues/839 The following code provides an error. \documentclass{article} \...
6
votes
2answers
259 views

xparse creates infinite loop

this MWE creates on my machine a infinite loop. Can someone explain to me why? \documentclass{article} \usepackage{booktabs,xparse} \NewDocumentCommand\hlineX{ m O{0pt} O{#2} }{% \...
1
vote
1answer
59 views

A row of CSV data is not saved after checking for its emptiness and existence

Following up this answer and the ensuing discussion, \getRow is expected to check the existence and emptiness of the target row of a CSV data, then save that row columns to another macro. In other ...
0
votes
0answers
33 views

Problem with \par in argument of a macro defined with \NewDocumentCommand [duplicate]

In following MWE, \newcommand is used to create \myFoo macro which just forwards its unique argument, then \NewDocumentCommand is used to create \myBar with the same behavior. The former accepts \par ...
2
votes
1answer
123 views

xparse: How to conditionally get a warning or error when retrieving empty or non-existent CSV data?

Following up this great answer of reading a CSV file and saving it, I need to have the following: A compilation-halting error is required when I try to index into a non-existent row or column since ...
1
vote
1answer
69 views

Storing a CSV row columns in a list/array and indexing into it

Following up this answer, how to extend the code of its second method to store each row value columns in a list or array and be able to index into it? In other words, I need another macro (along with \...
1
vote
2answers
68 views

Insert verbatim content inside a NewDocumentEnvironment

I work on an environment for setting up exercises with zero or more associated hints. If I try to insert verbatim content in the body of the exercise, the latex interpreter hangs without specifying an ...
-2
votes
2answers
67 views

How create/redefine document command where command name is variable?

This question connected with question about tagging of sections. I found solution,how to do it,but i dont know,how create/redefine document command,if command is argument of some other command. When i ...
0
votes
1answer
39 views

key_define option

Consider the following MWE: \documentclass[letterpaper]{article} \usepackage{l3draw} \ExplSyntaxOn %---------------------------------------------------------------------------------------- % ...
1
vote
1answer
116 views

How do I convince the l3 team that g-type arguments are necessary? [closed]

I claim that g-type xparse arguments are strictly necessary and should be supported directly in the LaTeX kernel, rather than being officially deprecated as they are right now. If you disagree with me,...
1
vote
1answer
60 views

Column color and l3colors

Consider the following MWE: \documentclass{article} \usepackage[table]{xcolor} %\usepackage{l3color} %\usepackage{colortbl} %\usepackage{l3draw} \definecolor{sampleredexpl}{RGB}{21,71,158} %\...
9
votes
2answers
195 views

Using the \int_step_function

Consider the following MWE: \documentclass[letterpaper]{article} \usepackage{l3draw} \ExplSyntaxOn \NewDocumentCommand{\miconcentric}{ O{0.08ex} } { \mathicon_concentric_circles:n { #1 } } ...
3
votes
1answer
45 views

Cannot use 'macro parameter character #' in horizontal mode error with xparse and pgfkeys

I have the following not working code, where I'm trying to replace the standard \title command with one that sets a pgf key and then calls back to the original standard command. \documentclass{article}...
2
votes
1answer
52 views

Key values using l3keys (pencil symbol)

Consider the following MWE: \documentclass[letterpaper,11pt]{article} \usepackage{l3draw} \ExplSyntaxOn \dim_new:N \l__pencil_dim \fp_new:N \l__pencil_linethickness_fp \cs_new_protected:Nn \...
1
vote
2answers
63 views

Problem after an update to TeX Live 2020 from 2018

The following command works fine with a TeX Live 2018, but after I have updated to TeX Live 2020, I have this error. I can't find what is the problem : ! Missing \endcsname inserted. <to be read ...
0
votes
0answers
38 views

Using l3draw to recreate \cplus

Consider the following MWE: \documentclass{article} \usepackage{amsmath} \usepackage{l3draw,xparse} \ExplSyntaxOn %--------------------------------------------------------- \box_new:N \...
0
votes
0answers
38 views

\hrulefill and \dotfill

The LaTeX2e sources defines \dotfill and \hrulefill as follows: Interestingly, I noticed that in the multicolrule package, the author makes use of TeX primitives defined in L3 syntax as follows: Of ...
2
votes
1answer
38 views

Declaring sum globally

Consider the following MWE: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\shcpoint}{ m } { \azetina_shcpoint:n { #1 } } \NewDocumentCommand{\printtotal}{ } { \...
0
votes
0answers
46 views

Vertical skips in paragraphs in L3

Consider the following: TeX features some macros for fixed-length spacing. \smallskip Inserts a small space in vertical mode (between two paragraphs). \medskip Inserts a medium space in vertical mode ...
7
votes
2answers
176 views

L3 equivalent to ifcase

Consider the custom code of date showing the month and year only: \def\shccustomdate{% \ifcase \month \or January\or February\or March\or April\or May\or June\or July\or August\or September\or ...
4
votes
1answer
69 views

Can this code be more compact?

I have a number of commands with the same structure as this one and I'm wondering whether or not the code can be compacted to avoid having to type the E_{K and K_{\symup{trans} twice each. I don't see ...
3
votes
1answer
41 views

bad alignment when using xparse, tabularx and enumerate

I want to extract this piece of code into an environment \begin{table}[H] \begin{tabularx}{\textwidth}{lX} \toprule \textbf{a} & a \\ \midrule \textbf{b} & b \\ \midrule \...
3
votes
2answers
53 views

Is there a way to step through two lists of arguments pairwise? [duplicate]

Is there a way to write a macro that steps through two lists of arguments pairwise, like what Python's zip function does? For example, I'd like to write a macro like this (using xparse because that's ...
3
votes
1answer
48 views

Brackets, braces and no-boundary variables conflicting in theorem environment

I'm making a theorem called exercise which I want to be able to be defined in the following ways: \begin{exercise} ... % Regular exercise with numbering from other exercises \begin{exercise}[...
1
vote
0answers
53 views

Beamer: Uncover underbrace & overbrace weird behaviour

I recently needed to cover some over- and underbrace and found a solution here: Beamer: Uncover underbrace However, I was not 100% satisfied with the offered solutions, in particular, my goal was to ...
0
votes
1answer
40 views

xparse / wrapfigure: \intextsep doesn't affect the output when set inside a \NewDocumentEnvironment

For the following, why does \setlength{\intextsep}{#5} inside \NewDocumentEnvironment{mywrapfigure} not have any effect on the output, which makes me have to use \setlength{\intextsep}{0pt} locally ...
3
votes
2answers
34 views

Unwanted space after \NewDocumentCommand vs. \newcommand [duplicate]

I am trying to markup certain words in my text and automatically commit them to the index, with the option to modify the index entry. The \newcommand approach was not satisfying, as I did not manage ...
1
vote
0answers
103 views

Creating a custom list environment using expl3 (no enumitem) [closed]

I've read a lot of times that you shouldn't reinvent the wheel, but sometimes you have to. I'm trying to create an enumerate style mylist environment, based on the base list environment provided by ...
0
votes
1answer
41 views

Help with xparse \newcommand

I have some images that I need to cut it up, and some to cut it down. I implemented a single solution using two \newcommand that worked, but I look for one compact solution using xparse that did not ...
2
votes
1answer
55 views

How to use expl3 command \str_case:nnF

Could someone please explain how xparse-expl3 command \str_case:nnF works by an example? Are str and case important here? Please avoid long (text) answers. I think if you explain the basics, I can ...
3
votes
2answers
85 views

How to look up a cell value of a multi-column csv file?

Following up this answer, how can I have an optional argument of the command \getValue that specifies the column in which I look up the cell value so that it has the following syntax? \getValue\<...
0
votes
0answers
32 views

Parsing macros found in user inputs

I am trying to parse macros that are found within user inputs for my custom draw package. As an example suppose a user wants to set multiple quantities to have the same index. Currently I offer the ...
1
vote
2answers
37 views

Arbitrary order xparse e type arguments (embellishments)?

Can I use xparse e-type arguments to redefine how subscripts and superscripts work for a command (e.g., make \mybeta put all sub/super scripts in parens)? I tried defining \NewDocumentCommand{\...
0
votes
0answers
23 views

expl3 minted environment with optional arguments won't compile without optional arguments

I was trying to create a "code" environment based off of this answer of egreg's. Only problem is, I'm getting unexpected behavior that I can't figure out how to debug. I tried to boil it ...
1
vote
1answer
34 views

Trivial mistake (syntac) with RenewDocummentCommand vs newdocument commant

I had this : \let\otitle\title \renewcommand\title[2] {\otitle{#1 \\ \bigskip \large #2\\ \bigskip}} worked fine, modified it to this (xparse): \RenewDocumentCommand\title{m m} {\otitle{#1 \\ \...
0
votes
1answer
29 views

empty control sequence in \NewDocumentCommand

In the code below, \csname ... \endcsname and \cs_if_exist_use:c inside \NewDocumentCommand do not behave as expected. \documentclass{article} \usepackage{xparse} \expandafter\def\csname test 1\...
0
votes
0answers
16 views

Shuffle questions and generate answer keys using xparse

The following code was originated by @egreg and then modified by @cgnieder to be compatible with tasks package. It is very helpful thank to both, but now I'm curious that is there anyway to set the ...
1
vote
0answers
30 views

beamer xparse: optional argument - changing order

Following https://stackoverflow.com/questions/1812214/latex-optional-arguments I am trying to produce a command that prints a text and optionally sends an argument to a command (well, a time code ...
1
vote
0answers
49 views

Why can I not have space around an argument to \IfValueTF unless inside \ExplSyntaxOn…\ExplSyntaxOff?

This is similar to a previous question (Spaces around Boolean argument to \IfValueT gives -NoValue-) but the answer to that one involved a math mode character and its catcode, whereas in this question ...
-1
votes
1answer
32 views

How to set horizontal alignment inside a custom environment, based on one of the parameters

So with this code using xparse : \NewDocumentEnvironment{figwcommentary}{O{0.45} m m} { \adjustbox{valign=t} {\begin{minipage}{#1\textwidth} #2 \end{minipage} } } { \adjustbox{valign=t,right=0.5\...
3
votes
1answer
42 views

How to understand the “v-type” argument error described in xparse package documentation?

I'm getting myself familiar with the LaTeX3 new way of composing a customized command using the xparse package. However, I don't quite understand what does this line means from the documentation: v ...
2
votes
2answers
32 views

Latex3 sum of array terms

I have used expl3 to sum the terms of a given array, however as you can see the procedure is quite cumbersome. Is there a more elegant way to do the same thing? \documentclass{article} \usepackage{...
1
vote
1answer
36 views

Creating a key/option for examwsolns to globally set the default solution width

Following-up this answer, I would like to 1- have a key/option for the package that sets the default width. For example, something like \usepackage[default-width = outer]{examwsolns} 2- understand ...
4
votes
2answers
280 views

Specific command to have a number of dots chosen by the user

Starting from this simple code, \documentclass[12pt]{article} \usepackage{amsmath} \begin{document} \[\begin{pmatrix} a \\ b\\ \ldots \ldots \end{pmatrix} \] \end{document} my question is: Isn't ...
0
votes
1answer
56 views

Spaces around Boolean argument to \IfValueT gives -NoValue-

This code compiles correctly as long as I don't put spaces around arguments #3 and #4 in the definition of \vec. I can't find anything about this in the xparse documentation, and I have been under the ...
0
votes
0answers
32 views

Define a new command to wrap \cref

I am typesetting an MCQ exam paper. There are a few questions where there exists a block of information, and the student is prompted to use that information to answer several questions that follow, ...
4
votes
1answer
61 views

Environment with key-value options using expl3

I am new to expl3 and would like to create an environment with various key-value arguments. At the moment I am struggling to detect weather a key was set or not. \documentclass{article} \usepackage{...
0
votes
0answers
25 views

Iterate over comma separated values and optional argument [duplicate]

I would like to adapt this answer of another post for one optional argument but my MWE is just a M(not)WE. \documentclass{article} \usepackage{xparse} \newcommand\test[2]{#1+#2\par} \ExplSyntaxOn ...

1
2 3 4 5
11