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

4
votes
1answer
43 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
36 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
107 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>}, ...
1
vote
0answers
31 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
97 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
108 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
34 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
42 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: ...
16
votes
1answer
361 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 ...
0
votes
1answer
29 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
23 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
100 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: ...
17
votes
2answers
172 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
64 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
27 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
25 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
112 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
59 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. ...
1
vote
1answer
41 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
55 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 ...
0
votes
2answers
96 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
57 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 ...
1
vote
1answer
47 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 ...
2
votes
0answers
147 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 ...
3
votes
2answers
64 views

Using comma separated list input to call appropriate command

I imagine this has to be asked somewhere but I've been searching for a while with no luck, so if there is an answer feel free to just direct me there. I have a series of functions that all do ...
1
vote
1answer
38 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 ...
7
votes
1answer
109 views

Has LaTeX3 syntax possibly changed since this question was last answered

I am adapting the LaTeX3 answer in this question: http://tex.stackexchange.com/a/61603 But I can't get the original MWE answer to compile using xelatex. I have renamed the variables, but the error ...
2
votes
0answers
40 views

Access xparse's \BooleanTrue via latex3 expl3

I'm implementing a command with xparse's boolean token processing \NewDocumentCommand{\op}{s o t' t. t^ g}{ % Here I need to check for % (#3 || #4 || #5) && !(#3 && #4 ...
4
votes
1answer
53 views

The DeclareTotalTCBox command (tcolorbox package)

In the manual of tcolorbox package, the author Thomas Sturm gives the syntax of \DeclareTotalTCBox command as `\DeclareTotalTCBox[init options]{\name}{specification}{options}{content}` What ...
2
votes
2answers
168 views

How do environments work?

As far as I understand, when I specify \newenvironment{env}{ start }{ end } what LaTeX actually does is to define two macros \env -> start \endenv -> end so that \begin{env} middle ...
6
votes
1answer
49 views

Is it possible to have optional argument and mandatory one with brace using xparse?

I am trying to stress xparse and find something I tried which is not documented anywhere. This code snippet is not compiling and I do not get why. \documentclass{article} \usepackage{xparse} ...
6
votes
2answers
45 views

Why can you not skip lines in document when providing optional environment parameters with xparse?

Is it intentional that you cannot skip lines when using optional environment parameters with LaTeX3's xparse? It seems that you can skip lines with mandatory parameters. Compare ...
2
votes
2answers
139 views

Specifying <file> parameters in \includegraphics statement

The \includegraphics statement works well if the file is specified as in the \includegraphics statement in the code below. If however specified through the macro \myPicspath as in the commented-out ...
2
votes
1answer
72 views

Line breaks introduced in database export as extra lines in table

I am automating the producing of tex files using an access database with many different types of fields. One, a memo field that will contain an itemized list i.e. visible tex including \begin{itemize} ...
2
votes
1answer
107 views

Combine code from two LaTeX 3 answers

I'n trying to combine the code from the answers "Sum of finite series using LaTeX 3" and "Reducing fraction using LaTeX 3" to automatically calculate a finite sum as either the numerator or ...
3
votes
1answer
68 views

Renewenvironment minipage with xparse

I want to redefine the minipage environment which has several optional parameters. The default renewenvironment allows only a single optional argument. Therefore, I try to use the xparse package which ...
4
votes
2answers
75 views

How to change a \NewDocumentCommand-based \cite command to accept biblatex-style arguments?

Over at How to quote encyclopedia articles differently from books, magazines, etc. with Biblatex?, I was greatly helped with a macro which solved the question as it was asked. I'd now like to change ...
6
votes
1answer
234 views

What is the difference between \NewDocumentCommand and \DeclareDocumentCommand?

These commands are part of the LaTeX3 Project xparsepackage. This question is to satisfy curiosity… From xparse documentation released on 25 Nov 2014: \DeclareDocumentCommand will always create ...
3
votes
1answer
78 views

Is it possible to use {} as delimiter for an optional xparse argument?

I'm redefining beamer blocks to use tcolorboxes. I want to make the title optional, but want to keep the curly braces. How can I achieve this? I tried this: \documentclass{article} ...
1
vote
1answer
24 views

Combine mdframed, xparse and cleveref

Inspired by this post: Typesetting a definition, I wanted to define some fancy theorem-like environments. Contrary to the examples given in this post, I need a definition environment with a counter ...
3
votes
0answers
53 views

wrap around task environment not working

I am trying to create an environment wrapping a task environment (from the tasks package). To build the new environment I am using the xparse package. \documentclass{article} \usepackage{xparse} ...
2
votes
2answers
122 views

Check options in \newcommand or \NewDocumentCommand?

I'm trying to implement a custom command that is called like this: \mycommand[hello][world]{mandatory1}{mandatory2} OR: \mycommand[hello,world]{mandatory1}{mandatory2} However, I can't figure ...
8
votes
1answer
114 views

xparse's \DeclareDocumentEnvironment gives error on already-defined environment

I'm trying to redefine an existing environment subfigure defined by the subcaption package. To do this, I'm using xparse's DeclareDocumentEnvironment since that's suppose to declare a new environment ...
5
votes
1answer
80 views

Conflict between NewDocumentEnvironment and enumerate

I have the following document: \documentclass{article} \usepackage{enumerate} \usepackage{xparse} \newcounter{probctr} \NewDocumentEnvironment{prob}{o} {% \par \addvspace{.15in}% ...
3
votes
1answer
91 views

How to define a command that defines another command?

I have a command defined with xparse that looks like this: \NewDocumentCommand{\ME}{sogd<>}{\added[id=ME,remark={#1}]{#2}} (for the full code see Passing complicated argument patterns to a ...
1
vote
1answer
67 views

Missing \endcsname in xparse

I am trying to make my own class, with options for referencing. Short quotes work absolutely fine, but when it gets to longer quotes, for some reason, I get errors. essay.tex: ...
3
votes
1answer
72 views

Extending xparse for new arguments

I was looking for a way of grabbing sub and superscripts as optional arguments to a command in xparse. That is, \foo_{a}^{b} would receive a as an optional argument and b as another optional argument. ...
4
votes
1answer
74 views

pgfpositionnodelater with nested \tikz environments (Issue with PGF 2.1 -> 3.0 upgrade)

I'm trying to use \pgfpositionnodelater to create and measure nodes before placing them. (Their size influences where they should be placed) This works fine until I try to use \pgfpositionnode later ...
4
votes
1answer
75 views

How can I use the ampersand (&) as a delineator for tabs in LaTeX3 (expl3)/xparse syntax?

This idea evolved from the question: How can I get a count of the optional arguments with xparse? Problem I cannot get the ampersand to function as a delineator (for tab stops) inside the ...
3
votes
2answers
29 views

Trying to use collcell.sty with an optional argument

I'm trying to use collcell.sty with xparse. If I have macro with an optional argument, using it with collcell.sty does not seem to pick up the optional argument. For example: \documentclass{article} ...