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

5
votes
0answers
76 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
96 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
1k 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
263 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
119 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
139 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
158 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 ...
16
votes
3answers
242 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
116 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
86 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
81 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
169 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
340 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
91 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
198 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 ...
0
votes
1answer
138 views

wrap listings package - Problem with verbatim argument

I would like to define a command that wraps a lstlisting environment in some other environments (esp. a minipage). I understand that working with verbatim arguments is a difficult task. I tried the ...
4
votes
1answer
95 views

Problems with xparse and enumerate

I am trying to get the following document to work \documentclass[10pt]{article} \usepackage{enumitem} \newcounter{foo} \newcounter{bar}[foo] \addtocounter{foo}{1} \usepackage{xparse} ...
2
votes
1answer
62 views

How to make xparse play nicely inside another command?

I'm trying to define a command that inserts a space at the end if necessary, and then a starred version of the same command which does not include a space at the end. I suspect that the problem has ...
3
votes
2answers
92 views

How to avoid unwanted Spaces in \NewDocumentEnvironment?

I tried to make my own "quote"-Environment and I wanted the first Letter to be bold and a little bit bigger than the rest. As \lettrine doesn't work the way i wanted, i tried to code it on my own. ...
2
votes
1answer
129 views

smartdiagram 0.2 / xparse / Kubuntu

I have a package dependency problem on Kubuntu 12.10. I have installed Texlive2012 from the known ppa. The brandnew "smartdiagram 0.2" package has a dependency for xparse. This package does not exist ...
6
votes
1answer
114 views

\def variables with xparse and other questions about variables

I'm writing a documentation for a REST API. So there's very much information that has to get repeated. So I'm trying to figure out a few things: Consider the following code: ...
2
votes
1answer
131 views

How to define a function with undefined number of arguments to draw bytefield with variable number of bitbox?

I have to draw lots of bytefield with different number of bitbox with different shapes. For that I define 3 functions: mybytefield that takes a variable number of arguments (using xparse with ...
3
votes
1answer
292 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 ...
5
votes
1answer
133 views

Switch on number of arguments given to a macro

I want to define a macro that does different things depending on the number of (optional) arguments given to it. Is this possible? How? \documentclass{standalone} \usepackage{xparse} ...
9
votes
1answer
134 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 ...
1
vote
0answers
274 views

compile error as xparse fails because it requires expl3 after 2013 update of texlive [closed]

I updated texlive to 2012 release. However, when I try to compile example code, which I obtained from here, my attempt fails. \documentclass[tikz,border=2bp]{standalone} ...
6
votes
1answer
97 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
1answer
390 views

Optional argument within another optional argument in biblatex \cite

What is the right way to define a macro with an optional argument that can be called within the <postnote> optional argument to biblatex \cite? The last two \cite below don't work. (Unless ...
6
votes
1answer
894 views

How to convert to odt using xparse and mk4ht oolatex

Both tex4ht and htlatex compile documents with package xparse. But mk4ht oolatex doesn't. Running it on a document as simple as: \documentclass{article} \usepackage{xparse} \begin{document} a ...
4
votes
1answer
130 views

Commands from xparse inside functions created by \cs_new:Npn?

Is it okay to put commands from xparse inside functions created by \cs_new:Npn instead of \NewDocumentCommand? Would that be a confusion of programming levels? The example below works but I was ...
4
votes
1answer
179 views

Compile error with MWE using pgfkeys, beamer, xparse and \includegraphics

First, please apologize the vague title, but I do not understand the problem enough to give a more exact title. The following MWE does not compile with a missing \endcsname inserted error around ...
3
votes
1answer
186 views

How to map optional arguments to functions?

What is the right way to map each optional argument to a function that applies a specific style to it? In the example below, optional arguments are typeset in bold face preceded by a colon. But I ...
4
votes
2answers
582 views

New command and the corresponding star counterpart with xparse

The following works as expected: \newcommand{\engl}[2]{#1 (en. \textsl{#2})\index{en-ro}{#2}} However, what I want to achieve would be a * version of it which only adds to the indices, without the ...
3
votes
0answers
2k views

Using mdframed: can't install xparse.sty [closed]

I have a latex document which uses the mdframed package (OBS: I can successfully compile it on another system). I installed the mdframed package (through tlmgr install mdframed) but when I try to ...
11
votes
1answer
550 views

Suppress xparse message “Redefining document command”

I am trying to suppress messages of the form: ************************************************* * LaTeX warning: "xparse/redefine-command" * * Redefining document command \MyMacro with arg. spec. ...
1
vote
0answers
103 views

xparse \DeclareDocumentEnvironment does not print arguments in the end code section [closed]

I've been trying to create a custom environment for writing up my journal in LaTeX, but can't seem to get xparse to work right. When I use the code: \documentclass{article} \usepackage{xparse} ...
4
votes
1answer
173 views

Extra space after new command using xparse

I was trying to write a macro that could take either one of two arguments and produce different outputs for both cases. For that, I used to package xparse. Here is the macro I wrote: ...
2
votes
1answer
292 views

Redefine existing command

My question is whether I can redefine an existing command for example \multicolumn and make the required arguments optional, without loosing the content of multicolumn? Another option would be to get ...
4
votes
2answers
127 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} ...
1
vote
1answer
190 views

Using \SplitArgument with r() arguments in xparse

I have been experimenting with using the xparse package for custom document macros with a Markdown-like syntax. For example, I used to write \cut{x}{P}{Q} to produce . With the help of xparse, I ...
8
votes
1answer
163 views

TikZ path doesn't work with xparse generated macro

I am trying to use TikZ together with a macro that I defined via \NewDocumentCommand (for multiple optional arguments), but it doesn't behave as expected. TikZ is giving up on the path instead of ...
3
votes
1answer
135 views

Passing environment to \luatexluaescapestring fails

Can anyone explain why the macro \makequesone below fails and/or suggest a fix? The verbatim option works (as in the MWE) but I would like the content of the argument to be able to contain relatively ...
5
votes
1answer
151 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
120 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 ...
0
votes
1answer
106 views

Defect of measuring into the count of alphabet width

Question: Why in the example below I get (with CM at 10pt) \alphabet=342.93138pt and \myalphabetwidth=342.6536pt why I have this difference between the two measures? What is the more correct? ...
4
votes
2answers
175 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 ...
1
vote
0answers
185 views

Extraneous text from \NewDocumentEnvironment (corrupted TeXLive2012 ?) [closed]

I seem to be getting spurious text (red text) containing the name of the environment, when using \NewDocumentEnvironment (blue text) to define a custom minipage environment with TeXLive2012: Things ...
14
votes
1answer
790 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. ...
3
votes
1answer
186 views

Support for the punctuation symbols into a macro for characters count

Question about this macro: Is possible to have a higher precision with this macro by adding some punctuation symbols like ,.;:?!'() into the final count of the characters? ...