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

learn more… | top users | synonyms

4
votes
0answers
86 views

Alternate lefthand/righthand width and check odd page in tcolorbox

I am creating a new environment using the tcolorbox package in the define options pos=t,b,r,l and lwidth and rwidth for margins, using the scheme key=value of pgfkeys. My idea is to create two new ...
8
votes
1answer
29 views

Collecting environment content with support for xparse arguments

I'm trying to create an environment which uses xparse style arguments but I have to be able to use the whole environment content in the environment definition, e.g. as an argument. Ideally I'd like ...
4
votes
1answer
72 views

Create a package with optional mode and key values

I'm trying to create a package with three options as follows: \usepackage[swpl]{mypack} swpl option provides the environment \begin{myexample}[forced bracketed options]...\end{myexample} ...
6
votes
2answers
83 views

Nested indentation with xparse

this is my first question, so any help is appreciated. I want to achieve an indentation effect as shown in the image: Which can be obtained as follows: \begin{itemize} \item $a$ ...
0
votes
0answers
16 views

Texstudio: Autocompletion of xparse commands

I have defined a new command using xparse, but the command doesn't show up in the autocomplete. Furthermore the definition of the command is in red: The command is working, but it just doesn't show ...
6
votes
3answers
114 views

Define a \dots-aware command

edit: changed the MWE to show the problem with french babel So, I was wondering about in TeX.sx and came upon this question How do magic \dots work in amsmath?, I wanted to do the same thing (have a ...
4
votes
1answer
38 views

Expand macro into xparse \SplitList macro

I had help making a macro to process a list of arguments separated by ; into an itemize environment. To achieve this, xparse was used. When I tried to wrap the lists of arguments in a macro, nothing ...
1
vote
1answer
42 views

tabular operators in a custom environment code?

My question concerns the combination of the tabular environment and the \DeclareDocumentEnvironment command (from the xparse package). How do I set up an environment that contains in its code some of ...
2
votes
0answers
30 views

Experimenting with l3box and l3skip's dim variables

Note: The following MWE has no significance in use or further application of any kind rather than just for experimenting with the packages explicitly written on the question title. ...
5
votes
0answers
26 views

Comparing last character(s) of the output of \ref to manipulate output [duplicate]

I am trying to write a command that will replace \ref in a special way. It will add some text next to the number based on the last character(s) of the number \ref outputs. I will try to explain this ...
10
votes
2answers
127 views

Changing \newcommand into xparse \NewDocumentCommand

I would like to change the \newcommand \shcpoint into an xparse \NewDocumentCommand. How can I achieve this? \newcounter{totalpoints} \regtotcounter{totalpoints} \newcommand{\shcpoint}[1]{% ...
2
votes
1answer
30 views

Mix value and key/value with xparse

Following an earlier question I switched to xparse. Now I am sitting in a compatibility trap and try to allow old and new stuff at the same time. The point of origin is the infamous macro with two ...
5
votes
2answers
66 views

How can I achieve \verb like behavior with an xparse argspec?

How can I use a previously scanned token as an argument to u{} in an xparse argspec? \documentclass{article} \usepackage{xparse} \NewDocumentEnvironment {some-cool-env} {D<>{\stopscan} u{#1}} ...
6
votes
2answers
85 views

Three-way optional argument in xparse

I am trying to programme a command in x parse that has one optional argument, but which can behave in three ways in the following situations: a) no argument specified, b) optional argument specifies a ...
5
votes
1answer
101 views

Forcing the first choice of an newtcblisting environment

I have created a new environment based on "tcblisting" from package "tcolorbox" is code (MWE) is as follows: \documentclass[10pt]{article} \usepackage{tcolorbox} ...
4
votes
1answer
49 views

xparse command with just optional argument fails

I am trying to define a command with xparse that takes an optional argument but no mandatory argument. The optional argument is a number, which works fine with a single digit but not with more. The ...
1
vote
0answers
63 views

frame in NewDocumentEnvironment

With beamer frames, this does not work. \newenvironment{itemframe}[1]{ \begin{frame}{#1} \begin{itemize} }{ \end{itemize} \end{frame} } Adding fragile, environment=itemframe as an ...
36
votes
2answers
540 views

How “safe” is it to use LaTeX3 (l3packages, l3kernel)?

Are l3kernel and l3packages present in most of the LaTeX distributions? Are they "stable enough"? I am asking this because I am preparing a .tex document for a client. I have found convenient to use ...
8
votes
1answer
86 views

Optional arguments: xparse vs. xargs

To implement a macro that takes one or more optional arguments that do not have to be placed in the first position, xargs can be used as well as xparse. The latter seems to have more recent updates ...
3
votes
1answer
93 views

Xparse macro with optional parameter breaks value for PGF foreach

I write a document class and want to execute something a certain number of times, depending on a user-defined quantity. So I thought I'd use a foreach loop from PGF together with accessor macros: ...
6
votes
1answer
94 views

NewDocumentCommand-defined command in bookmark

I have a scenario where xparse's \NewDocumentCommand has a regression compared to any alternative I know, including ones defining robust commands. So I'm avoiding \NewDocumentCommand in this case, but ...
2
votes
1answer
92 views

How can I pass optional arguments as optional arguments?

I have the following environments which are being used in my document. As you can see, a lot of unnecessary complexity is being added by my arcane optional argument handling using \IfValueTF. Is there ...
6
votes
1answer
63 views

Behavior of xparse and “token”-type argument

Please consider the following example: \documentclass{minimal} \usepackage{xparse} \NewDocumentCommand{\f}{tx}{\IfBooleanTF{#1}{true}{false}} \begin{document} \f{x} \f[x] \f x \end{document} ...
10
votes
1answer
140 views

Processing a sequence of pairs

I want to process a list of pairs like this: {{a1,b1},{a2,b2},{a3,b3}} where the first items in each pairs are distinct. So, for each pair of those {ai,bi} I would need the following data: ...
4
votes
0answers
55 views

xparse with underscore and optional argument

I need a macro which handles its input as follows: \foo A > #2 = A \foo{A} > #2 = A \foo(B) > #3 = A (round brackets) \foo_m A > #1 = m, #2 = A \foo_m{A} > #1 = m, #2 = A \foo_m(B) > #1 = m, #3 = B ...
7
votes
1answer
81 views

Filling a table by iterating over a sequence produces an orphan cell

I'm trying to fill a table with content that is stored in a sequence by a custom command. \documentclass{article} \usepackage{xparse} \usepackage{expl3} \ExplSyntaxOn \seq_new:N \my_sequence ...
5
votes
1answer
63 views

Using filecontents inside of xparse

I'm trying to reproduce this using xparse: \begin{filecontents}{sections/autogen/somefile.tex} % Line to auto-produce \begin{myotherenvironment} Do lots of stuff \end{myotherenvironment} ...
7
votes
1answer
123 views

Removing strange vertical space after first (customized) \item

I have a custom environment properties (that is almost ready for release to Github) that works like so: \begin{properties} \item[no max in reals] \forall a \in \Re, \exists b \in \Re : a < b ...
5
votes
2answers
78 views

How can I refer to an absent value in expl3?

The xparse package has a concept of -NoValue-, a kind of '\null' token used to represent the absence of any value (where \null would probably be considered a value). If I would like to manually use ...
6
votes
1answer
94 views

Is there something like a scope of \NewDocumentCommand?

Following along the line of my (confused) post on xparse and expl3, but this time hopefully with no typos or missing characters, I've devised a small package just to check a l3keys-based definition ...
4
votes
1answer
108 views

Dazzled and confused about xparse and LaTeX3 Booleans

I'm just starting my journey with LaTeX3/expl3, and although fascinated by the great work that the LaTeX3 team is doing, and by the enormous difference it brings about with respect to "classical" ...
10
votes
2answers
118 views

Is it possible to use \index{\command} inside a \DeclareDocumentCommand?

So I've been writing a book of sorts where I've used xparse to create some commands and environments. Now, when the thing is almost done, I realised a index would be great to have! One of the ...
4
votes
1answer
86 views

Using xparse-defined command inside table

This is a followup to this question, I'm wondering why using my tline command below will not compile \documentclass{article} \usepackage{xparse,tabu} \usepackage[table]{xcolor} ...
3
votes
1answer
116 views

Using tabu/tabularx inside xparse NewDocumentEnvironment

My question seems very similar to this, but with tabu instead of tabular*. In fact, switching the options in that example causes the failure I see here. \NewDocumentEnvironment {trace} {} {% ...
5
votes
0answers
75 views

What are best practices when augmenting and building on the keys provided by someone else's package

The situation is one where I'm developing my own commands and environments which build on the commands and environments provided by another package: for ease of talking let's call this other package ...
3
votes
1answer
90 views

Generalizing macros with LaTeX3

I'm trying to increase my LaTeX3-fu, but I'm getting an error about encountering printed output before the document begins. I'm trying to generalize How to get the section title by section number?. ...
4
votes
3answers
949 views

DeclareDocumentEnvironment: missing control sequence inserted — \inaccessible

I'm setting up a skeleton CV package for a friend for him to customize, and I'd like to make it as user-friendly as possible. To effect this, I'm using keyval and xparse. ...
8
votes
2answers
218 views

xparse and key value arguments

I'm trying to learn how to do macros. I want to use xparse as it seems the most powerful tool. I also want named arguments, as numbered arguments make me, as a programmer, uncomfortable. I had some ...
8
votes
1answer
111 views

Can I temporarily supress xparse's log messages?

I know that I can suppress all those annoying xparse logging messages about redefining commands using the log-declarations=false package option. I find that I can do this after xparse has been loaded ...
6
votes
4answers
125 views

How can I capture both superscripts and subscripts after a macro

This question piggy-backs on the answer to Capture a macro's subscripts/superscripts by the macro by egreg. I'm attempting to use the xparse package to create some macros and I'd rather not have ...
9
votes
3answers
152 views

Test whether last letter of a string is upper case or not

I would like to define a command that will behave according to the nature of the last character fed it. But I'm having difficulty just getting the components of my command to work. I thought I could ...
15
votes
3answers
227 views

Defining Extensible macros

Question: For a macro that has only one parameter, are there any issues with defining it as follows: \NewDocumentCommand{\MyMacro}{% s% #1 = starred variant (*** unused as of yet ...
5
votes
2answers
114 views

Expl variable assignments not behaving as I expect

I don't get what I'm doing wrong here. Neither of the commented lines work as the uncommented version does. \begin{filecontents}{silly.tex} This is just a test. \end{filecontents} ...
3
votes
1answer
78 views

Recursive Multiple subscripts and superscripts with xparse (Modified Version)

How can I modify the command below to obtain a version (of the question: recursive multiple subscript and superscript with xparse) which does not stack the sub/superscripts horizontally but moves all ...
4
votes
2answers
77 views

“hiding” \par from a tabular

I want to use a macro to write a line of a tabular. As part of this macro, there is an argument that isn't set in the tabular, but is saved for later use. This unused argument should be allowed to ...
9
votes
2answers
154 views

recursive multiple subscript and superscript with xparse

How can I define a new command with xparse, something like this: \NewDocumentCommand\tensorkor{ m >{\SplitList{,}}o >{\SplitList{,}}o } { ????? } that i can execute $ ...
8
votes
2answers
303 views

Package xparse \SplitList last token

I need to create a macro to render lists with a variable number of arguments (1+), e.g. \mylist{1,2,3} should expand to $\tilde{1}$--$\tilde{2}$--$\tilde{3}$. I'm trying to use xparse and \SplitList, ...
5
votes
1answer
64 views

How to redefine \str_if_eq:xxTF for backward compatibility

I just updated all the packages for TeXLive 2012 today and it appears that \str_if_eq:xxTF has been deprecated. How do I define a macro so that I can use the latest TeX Live but still be able to run ...
4
votes
1answer
86 views

Reusing the current argument's number with xparse

I read in xparse's documentation that \l__xparse_current_arg_int referred to "the number of the current argument being set up". I'm having trouble understanding how to access and use it, however. For ...
8
votes
2answers
186 views

Automating table creation

I have the following table that I need to recreate quite a few times Due to its size and complexity (yes, I am a tex novice) I am looking into ways of automating the creation of said table. I try ...