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

2
votes
1answer
57 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
85 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
117 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
112 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
112 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
263 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
121 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
124 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
256 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
94 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
331 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
698 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
113 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
160 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
176 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
474 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 ...
2
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
477 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
88 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
148 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
272 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
119 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
167 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
158 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
125 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
145 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
115 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
102 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
164 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
183 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
667 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
182 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? ...
1
vote
0answers
113 views

xparse regression? Unable to create environment with single optional argument [closed]

I've created a custom environment for displaying code examples in a beamer presentation (for an introductory LaTeX couse no less), but compiling my "old" code suddenly results in an error. According ...
2
votes
1answer
116 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 ...
5
votes
1answer
153 views

blank lines break xparse or ifthen macro

Leaving blank line break simple macro but % terminating it fixes it. WTH is going on? I know one is suppose to use % BUT I can't have any blank lines in the macro without it complaining. A blank line ...
13
votes
3answers
830 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 ...
4
votes
1answer
198 views

Change \baselinestretch using xparse in TeX Live 2012

Is there a preferred way to change \baselinestretch using the xparse package included in TeX Live 2012? (I believe this is xparse version 3570, dated 2012/04/23.) If I run latex -output-format pdf ...
6
votes
3answers
390 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 ...
9
votes
1answer
418 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: ...
4
votes
1answer
157 views

Weird xparse issue involving splitlist

\DeclareDocumentCommand\test{o}{\IfNoValueOrEmptyTF{#1}{No value or empty!}{-#1-}} works, but when we try to use a split list the NoValueOrEmpty test fails: \DeclareDocumentCommand\test{ > { ...
6
votes
3answers
403 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] ...
8
votes
1answer
147 views

On pitfalls of robust commands

These days, I’m more and more defining robust commands, e.g., using \newrobustcmd (etoolbox package) or \NewDocumentCommand (xparse package). Robust commands seem advantageous to me in many respects ...
1
vote
0answers
169 views

how to create a fully-expandable environment [closed]

I know DeclareDocumentCommand from the package xparse. I am wondering if there is a version for environment ? I could also imagine a trick based on : declare the environment with ...
8
votes
2answers
444 views

Why using a backslash in command definitions?

I want to know the reasoning behind the (La)TeX inferface for defining commands with leading backslashes. I see why a backslash has to be used to call (expand) a command (macro), but I do not ...
4
votes
2answers
367 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 ; ...
-11
votes
2answers
974 views

Stringified commands to macros sequence

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 ...
1
vote
1answer
284 views

xparse bug in optional arguments (simply not working)? [closed]

The follow code returns -NoValue- instead of 3 It seems I'm wrong in that I thought xparse took a single argument and parsed it instead of all the arguments of a macro. \documentclass[11pt]{book} % ...
2
votes
1answer
153 views

xparse recursion and/or special numeric specifications

I need to parse a "commands" where each command is is a string of letters and numbers: a34b56c32alpha Does xparse have any way to deal with the numbers? I would like to specify it with something ...
4
votes
4answers
365 views

Writing a multiple option command for a package

I am a newbie at LaTeX programming, so please be patient. :-) I am writing a .sty file which I want to include a command \dan which is overloaded with three separate versions depending on whether ...
7
votes
1answer
446 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 ...