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

12
votes
2answers
229 views

Xparse k argument to parse options at end of environment

I am trying to combine the solutions from How to properly use \collect@body within align environment Xparse t argument type (underscore with optional parameter) to parse optional parameters ...
3
votes
0answers
98 views

Rewriting a command using xparse for common code

I'm trying to write the documentation for script which I am working on using the packageltxdoc and docstrip. I have defined several commands using the package xparse and I would like to define a new ...
5
votes
3answers
76 views

Xparse t argument type (underscore with optional parameter)

I am not understanding how to use the t type parameter with xparse's \NewDocumentCommand. I am trying to define a macro that accepts one optional parameter, but the optional parameter is specified ...
1
vote
1answer
24 views

xparse error: “kernel/missing-colon” when defining a new command using cs_new:Nn

I'll simply show what happens: The documentclass definition is elsewhere on the file. I'm using TeXnicCenter, so interactive mode is not an option.
3
votes
1answer
64 views

Overfull \vbox caused by multirow and multiline text

I have read this question, but i just can not explain why exactly overfull happens in my case, so i ask for help. First of all, two boxes in spanned cells (that ones with rotated text) produces 4 bad ...
2
votes
0answers
26 views

How can I divide an Xparse generated list by “section-like” environments?

I mostly use the xparse library to create organized lists. Here's an MWE: \documentclass{article} \usepackage{xparse} \newcounter{quest} \newcommand{\quest}{\noindent\stepcounter{quest}{\bf Q}{\bf \...
0
votes
1answer
48 views

LaTeX DeclareUnicodeCharacter as a second argument for a macro

I want to enable the unicode modifiers for an emoji library: apple_emoji.sty: \usepackage{graphicx,amsmath,xparse} \usepackage[utf8x]{inputenc} \usepackage[export]{adjustbox} \ProvidesPackage{...
3
votes
1answer
30 views

difference between \verb and \NewDocumentCommand verb

This MWE \documentclass{article} \usepackage{xparse} \begin{document} \NewDocumentCommand{\myVerbatim}{v}{#1} \myVerbatim|This is some text, which can contain $\sin(x)$ or code or $$| \verb|...
1
vote
1answer
42 views

How to exclude math environments from string replacement?

I would like to have a command which applies another command to each line of the input. My approach is the following simple string replacement: \documentclass{article} \usepackage{xstring,xparse} \...
1
vote
3answers
94 views

Multiple Choice Questions with xparse package

Please I want to modify the following codes corresponding a multiple choice tabular for obtain a result as in the below image. \documentclass{article} \usepackage{tikz} \usepackage{xparse} \...
3
votes
1answer
31 views

Luacode in NewDocumentEnvironment problem

I want to put some systematic code at beginning and at the end of a luacode environment. Why this doesn't work. \documentclass{article} \usepackage{xparse,luacode} \NewDocumentEnvironment{LTG}{% ...
1
vote
1answer
39 views

New style of \answergrid :

Can you please help me to get the following style in the below image by using the code: \answergrid : Thanks!
4
votes
2answers
97 views

Why is text turning white (possible scope leak?) after page break and listings + tcolorbox + xelatex?

I had a very difficult time pinning this problem down, because it only exists when certain page-breaking conditions occur. Problem Text after environment mysteriously turns white under some ...
2
votes
1answer
23 views

Count number of elements in predefined list

Consider the following example: \documentclass{article} \usepackage{xparse} % http://tex.stackexchange.com/a/246924/15874 \ExplSyntaxOn \NewDocumentCommand{\countlist}{m}{\clist_count:n{#1}} \...
6
votes
2answers
76 views

counter in TOC fails when using xparse command instead of LaTeX2e command

Here I define a custom sectioning command, \Unit, which prints a numbered subject heading and adds it to the table of contents. If I use \newcommand for the command that creates the numbered label, ...
2
votes
0answers
35 views

Automatically colour previously defined strings of text (for strings with spaces &/or punctuations) [duplicate]

Main question Answers to the question Automatically colour previously defined strings of text show how to colour pre-defined strings of text, but all those pre-defined strings are without spaces and ...
15
votes
1answer
186 views

Biblatex is zeroing Bob! Is Biblatex incompatible with titling, Memoir and more?

Consider the following Minimal Working Example (MWE): \documentclass{article} \usepackage{xparse,titling} \NewDocumentCommand\makethis { } {% {\LARGE\theauthor\bigskip\par} } \author{Bob} \...
0
votes
0answers
29 views

TeX Live: xsparse and l3kernel. [duplicate]

My Tex Live installation is up-to-date. I ran tlmgr update --all today (2016-03-31). However, I get many errors on documents that used to compile just fine. It seems to boils down to xsparse.sty ...
2
votes
2answers
43 views

When defining a new macro inside a new macro (in xparse) how do I make the internal map long?

I would like to use a DeclareDocumentCommand in order to be able to define a different command (using arguments from the first). I would like to make the internal arguments long. Here is the code I ...
0
votes
0answers
198 views

Package xparse Error: Support package l3kernel too old. } [duplicate]

I am using a thesis template here : https://github.com/kks32/phd-thesis-template . I use texstudio and Mktek compiler. whatever i do i keep getting an incredible amount of errors starting with this ...
4
votes
1answer
269 views

Latest xparse/amsmath update doesn't work well in align

The following minimal example doesn't compile when the optional argument to \macro is used: \documentclass{article} \usepackage{xparse,amsmath} \NewDocumentCommand{\macro}{o}{A\IfValueT{#1}{(#1)}}% ...
1
vote
0answers
47 views

siunitx: Problems with xparse after update on 2016-03-31 [duplicate]

Dear community members, after today's (2016-03-31) update of packages via TexLive Utility severe problems with siunitx showed up on Mac OS 10.10.5 + TexShop. siunitx calls xparse, which then outputs ...
4
votes
1answer
57 views

Strange error message due to xparse and \newenvironment

I get the following strange error when I compile my document: ! Incomplete \ifcase; all text was ignored after line 256. <inserted text> \fi l.256 \foo[ 0]{|...
1
vote
0answers
18 views

transform variable-content to verbatim-like representation inside a newcommand (used then as optional argument)

I spend 8 hours in solving this, made some progress but now face the enormous difficulties with verbatim stuff in latex. Any help would be great! My aim: the todonotes package offers an inline option,...
5
votes
1answer
69 views

expl3 par and sequences

Having been exploring expl3 I have been updating some of my code to it, and I ran into a interesting issue that I was not predicting. I get a strange error that I think is from trying to store ...
4
votes
1answer
53 views

XParse: Command, which creates a command

SE, lately I'm playing around with expl3 and xparse a little and I encountered following problem: I want to create a command which creates a new command -- similar to this post. This is not as hard, ...
16
votes
2answers
124 views

What is the simplest way to extract a URL from a .bib entry for use in \href{}{} (probably using Biblatex)?

I am trying to define a new macro with the following syntax: \citeimg*{<bibkey>} The unstarred form should simply produce \citeauthor{<bibkey>}, \citetitle{<bibkey>}, \citeyear{&...
16
votes
1answer
510 views

Learning to use xparse

I'm learning to use xparse to build commands with optional arguments. But I'm having problems: I want to make a command called \topcat with output: \mathcal{O} if no argument is specified \mathcal{...
1
vote
0answers
49 views

xparse verbatim argument removing multiple space

I am trying to define a command, using xparse that take as input some verbatim code and cite it using listing. However, the eventual multiple white spaces or tabulations at the beginning of a lines ...
2
votes
4answers
103 views

Programming a step function- part2

Based on a macro given by egreg in this question: Programming a step function I obtain a program which tests in which interval is a number \alpha, between the numbers bone, btwo, bthree, bfour. I use ...
5
votes
3answers
125 views

Problem with subscripts in custom xparse commands from foreign files

When compiling this code: \documentclass{article} \usepackage{testPackage} \usepackage{xparse} \NewDocumentCommand{\foo}{mm}{#1_{#2}} \begin{document} $\foo A i$, $\fooT A i$ \end{document} ...
3
votes
1answer
43 views

How to manipulate items of a SplitList while processing?

I've defined a new macro using xparse and expl3 to generate a set of two lists. The idea was to have a macro with the same output as an old macro which was very user unfriendly because I had to write ...
3
votes
1answer
45 views

Creating a command that concatenates an input string token by token

Using (first of all) xparse I want to create a command like this: \DeclareDocumentCommand{\c}{ s > { \SplitList { ; } } r""} { % do something } It basically should just do the following: ...
1
vote
1answer
61 views

How can I use resizebox within a custom environment (or is there a better way to scale an environment's contents)?

I'd like to create a custom environment that automatically expands my syntactic trees to a specific width. I am using the xparse LaTeX3 syntax for my environments. Relevant Snippet: I would like to ...
0
votes
1answer
38 views

xparse: missing space after document command expansion [duplicate]

I'm having a problem with the below code. It's the smallest I could make the example. I'm working on a document with an index of persons, and have for this purpose created a command for each person. ...
0
votes
0answers
25 views

NewDocumentEnvironment causes extra row [duplicate]

When I use NewDocumentEnvironment of xparse and place a table to be inside this environment, I get an extra row at the end. Same code does not cause extra row in standard newenvironment. Is there a ...
7
votes
1answer
132 views

LaTeX3 best practice: using newed commands within package code

I'm quite new to LaTeX programming and currently looking into LaTeX3 and how to write a small ExplClass. This class should provide an allcaps command that I defined as follows: \RequirePackage{expl3,...
17
votes
2answers
227 views

How to \let an xparse defined command?

Let \example be an xparse defined command, which takes one optional and one mandatory argument. The definition of \example cannot be modified (e.g. because it comes from a third-party package). The ...
5
votes
2answers
108 views

Build table in new command results in too long vertical lines

I am trying to build a table inside a LaTeX 3 command. A MWE: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\createTable}{ m m }{ \begin{tabular}{|c*{#2}{|c}|} ...
1
vote
1answer
33 views

Detecting empty key values when key is provided

I believe I am looking for a LaTeX3 type syntax solution to more appropriately detect a missing argument. To me I would have expected key={} to be a valueless, blank, or empty argument key. After ...
2
votes
1answer
35 views

Redefinition of \- (discretionary hyphen): does not apply to a minipage?

I would like to redefine \- (discretionary hyphen) as part of several shortcuts for arrows, like \-> = \rightarrow or \<- = \leftarrow, especially useful for the often used equivalence arrow \&...
3
votes
3answers
204 views

Is it possible to use includegraphics with relative path with subfolder, inside subfiles?

My question is a followup question of this: Is it possible to use includegraphics with relative path inside subfiles? I have my images in sub/image folder. I want automatically add 'sub/images' path ...
3
votes
1answer
68 views

Producing expandable environments with only optional arguments with LaTeX3 syntax

I am trying to create a new document environment to complete the assembly of a table (simplified for MWE) but I am having a problem combining an expandable environment with an optional only argument. ...
10
votes
2answers
250 views

Workaround how to use expl3 functionality in tikz

What I want to do I want to create a command \planfigur{<edges>}{<angles>} which draws a triangle using TikZ. \planfigur should have 2 mandatory arguments, which let me specify edges and/...
1
vote
1answer
57 views

xparse command definition vs \newcommand [duplicate]

Maybe my question is too broad, but I'd really like to know: what is best to use (and why) between xparse command definition (e.g. \NewDocumentCommand) and LaTeX "standard" definitions (e.g. \...
3
votes
2answers
89 views

Turnstile with Mathcal: missing \endcsname inserted

I was using the turnstile package and xparse package to use turnstile efficiently. But from one point, I was keep getting an error message, and found that \not{\sdtstile{\mathcal{S}}{}} was the ...
1
vote
2answers
113 views

How can I use a LaTeX3 variable as a path in includegraphics (solving the expansion problem)?

This problem is driving me nuts. I'd like to change the includegraphics path depending on some conditions. It seems simple, right? I already read the answers to this question: Passing image path to \...
2
votes
1answer
105 views

When using \IfEq to compare strings, is it one of those times when I should use an expandable xparse command?

I recently asked How can I migrate commands and environments from LaTeX2e to LaTeX3? [XeTeX] While that question is good, the answer is likely quite complex and would take a some time to effectively ...
2
votes
0answers
166 views

How can I migrate commands and environments from LaTeX2e to LaTeX3? [XeTeX]

Sometimes forcing consistency makes things much easier to maintain. The motto "keep it simple" comes to mind. xparse offers the most bang for your buck when it comes to defining commands with various ...
1
vote
1answer
49 views

XParse doesn't recognize some of my variables

Based on the comments from my last question have I tried to create a new command using \NewDocumentCommand. However, it wont recognize some of the optional arguments - they just get printed as is. Any ...