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

9
votes
1answer
461 views

Wrapping \cmidrule in a macro

In my earlier solution for Multivariate polynomial long division using LaTeX I had wrapped \cmidrule in a macro as its syntax alowing to shorten the end points was not standard: ...
12
votes
1answer
293 views

Text being output when none should be

I am confused as to why the MWE below produces any black text. As the code is below, the output is: However, if you comment out the \IfStrEq line then it works fine and the black text goes away? ...
9
votes
2answers
175 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 $ ...
9
votes
1answer
138 views

Using an array environment inside an xparse command

I would like to define a macro for optimization problems. My attempt is given below. I am wondering why \optimizationproblema works, but \optimizationproblemb does not (I get a "misplaced alignment ...
7
votes
4answers
151 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 ...
-14
votes
2answers
1k views

Stringified commands to macros sequence [closed]

First, what is the proper terminology for a "string" in TeX/LaTeX that is an argument for a macro? e.g., \macro{somestring} Obviously somestring is a token, set of tokens, string, argument, etc. I ...
7
votes
3answers
500 views

xparse empty arguments

I have defined a command using xparse as \DeclareDocumentCommand\mymacro{o o o} and I want to call it with various numbers of arguments (up to 3) \mymacro, \mymacro[test][two], \mymacro[][][test] ...
36
votes
2answers
572 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 ...
16
votes
3answers
252 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 ...
13
votes
3answers
988 views

Latex dynamic macro definition

I am trying to dynamically define variables. What I want to do is be able to define a person in the following way \definePerson{MrTestKey}{Mr Test}{0400 000 000}{mr@test.com} and then subsequently ...
3
votes
1answer
298 views

How to paramerize a tikz chain picture with list of nodes

I want to draw several tikz picture like these ones, but with different numbers of nodes in each row and arrows between the top and bottom row between different nodes. e.g and etc. I want to ...
8
votes
1answer
124 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 ...
8
votes
1answer
511 views

Use the s (star) argument with \NewDocumentEnvironment

Would it be possible to use the s argument specifier of xparse in \NewDocumentEnvironment so that we get an environment an a starred version of it? Actually it works, but the star goes to the wrong ...
7
votes
1answer
125 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 ...
6
votes
3answers
447 views

\NewDocumentCommand with constructed csname

In the spirit of my previous questions Defining \xthinspace: Thin space only if not followed by certain characters and Ellipses & Correct Space Factor, I’m trying to define a generic \xspace-like ...
4
votes
2answers
183 views

xparse verbatim with newline

I'm trying to define a simple command using xparse and it's verbatim argument: \DeclareDocumentCommand\macro{v}{#1} but see ! LaTeX error: "xparse/verbatim-newline" ! ! Verbatim argument of ...
2
votes
1answer
40 views

Float(s) lost in newly defined environment (possible \vbox/\hbox problem)

The following gives me LaTeX Error: Float(s) lost. I saw on Lost float in exam class that this might have to do with the \vbox. Replacing it with an \hbox gives Something's wrong--perhaps a missing ...
14
votes
1answer
843 views

How to transpose a table in expl3

I've been very impressed with xparse and expl3, and have written a wonderful document command using \ProcessList that takes a comma separated list and turns it into a (basically) 1 column table. ...
8
votes
2answers
363 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, ...
7
votes
2answers
93 views

Redefine \newcommand to insert code at start and end of custom macros

I would like to be able to insert code into the definitions of my custom macros, without having to modify each macro definition. This seemed like a simple case of redefining \newcommand, but this ...
6
votes
1answer
99 views

Conflict between xparse and pstricks: pstricks doesn't believe xparse function is defined

I want to create a pspicture with a variety of parameters which are interdependent. I'm using expl3 for the interface. But I get an error when I try to use \getr Error: /undefined in \getr Operand ...
5
votes
2answers
146 views

Define a New Macro via a Macro Using xparse Syntax

I am trying to set up a macro that defines a macro that is to be executed only once. With what I learned from Define a Macro via Macro if Given Macro is not defined I can do that via the ...
5
votes
2answers
74 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}} ...
5
votes
2answers
120 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} ...
5
votes
1answer
155 views

Increasing nesting level for parameters and global xparse macros?

This is kind of a double question but closely connected in my case. Inspired by http://tex.stackexchange.com/a/55769/14159 I tried to make an improved version which allows additional parameters for ...
5
votes
1answer
124 views

Providing optional (unused) parameter to macro along with \tikzmark introduces spurious space

In my overkill solution to Enclose an entry in an enumerate list in parentheses there is spurious space at the beginning of some (not all) uses of \SpecialItem. I have narrowed it down to the MWE ...
5
votes
1answer
316 views

Using \IfNoValueTF within a TikZ style specification.

In an answer to Flushing PGF commands and local variable Matthew had suggested using \IfNoValueTF within a TikZ \node specification to determine the text. This solution works great for me. However, ...
4
votes
2answers
130 views

Nesting custom `xparse` environments

I've defined two simple environments with xparse. Problem is when I try to nest todominute environment inside minutes environment: \documentclass[a4paper, 10pt]{article} \usepackage{polski} ...
4
votes
2answers
419 views

Passing multiple arguments from ProcessList (xparse) to a macro. Result to be used in tabular

I am making a macro that will take user input of a grading scheme and place it into a tabular environment. I would like the syntax to be as simple as possible and decided on: \tabulate{ eval1,%1 ; ...
3
votes
1answer
122 views

Xparse macro not working when \obeylines is in effect

This is the most strange and hard-to-debug situation I have encountered in latex. When \obeylines is in effect, it seems that macros with optional argument defined by xparse will have some trouble. ...
3
votes
1answer
146 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} {} {% ...
2
votes
1answer
136 views

xparse: \NoValue gone -> how to check multiple NoValues now?

I used to have a definition like the following to check if all optional arguments were missing: \NewDocumentCommand \question {o o o m} { \bool_if:nTF { \str_if_eq_p:nn { \NoValue } { #1 ...
2
votes
1answer
892 views

Define a custom align, and align* environment

I would like to redefine both the align and \align* environments such that the first line is shifted up to line up with the list identifier. I attempted to adapt the solution provided at Starred ...