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
1answer
154 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
122 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
107 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
181 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
186 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
808 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? ...
1
vote
0answers
120 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
133 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
165 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
953 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
209 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
430 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
459 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
163 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{ > { ...
7
votes
3answers
481 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
155 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
175 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 ...
10
votes
2answers
530 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
413 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 ; ...
-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 ...
1
vote
1answer
300 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
157 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
433 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
505 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 ...
5
votes
1answer
351 views

Equivalent of \@afterheading for LaTeX3

I want to define an environment with LaTeX3 where I can supress the indention in the first line. For LaTeX2e you can use \@afterindentfalse\@afterheading. The example use this combination. But I want ...
12
votes
1answer
292 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? ...
1
vote
1answer
900 views

MacTeX 2011, Xetex and Tex Live Utility

I tried several times to play with XeLaTeX (being used to "classical" LaTeX) but since I installed MacTeX 2011 and updated it with TeX Live Utility, I got that kind message : ...
5
votes
1answer
220 views

How can I place a marginnote inside a description (or other list environment)

I have a macro (defined with the xparse package) that creates a marginnote. It works as I would like when prepended to normal paragraph text: \NewDocumentCommand\dates{m g}{% \IfNoValueTF{#2} ...
5
votes
1answer
206 views

Splitting on new lines using \SplitList

What do I pass to \SplitList to get it to split the string on a new line? I've tried \n and \r, but neither of those work. The code I used was \documentclass{article} \usepackage{xparse} ...
3
votes
1answer
580 views

Undefined control sequence with xparse

I just installed the texlive-latex3 package and tried running pdflatex on the following (copied directly from another question posted here): \documentclass{article} \usepackage{xparse} \ExplSyntaxOn ...
8
votes
2answers
2k views

xparse: Define new command with multiple optional parameters

I'd like to define a new command with optional parameters using the xparse package. Please consider the following example: \documentclass{minimal} \usepackage{xparse} ...
10
votes
2answers
290 views

How do I pass an expanded optional argument using expl3/xparse?

I have a command defined using xparse syntax: \DeclareDocumentCommand \foo { O{} m } {} Inside some other command (say, \bar), I want to call this command. The calling command (\bar) has to ...
0
votes
1answer
908 views

XeTeX fails with undefined control sequence in texlive 2012/dev

I'm using XeTeX, and I'm trying to compile a document using the following command: xelatex mydoc.tex I'm getting the following error: ...
2
votes
1answer
875 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 ...
6
votes
2answers
351 views

How can I create an oddly-delimited macro, using xparse?

I have a partial version of this macro working, without xparse, but I needed to tweak it and it got too unwieldy, so I'm trying to use xparse instead. It's admittedly a farfetched macro, but I'm ...
5
votes
1answer
310 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, ...