Generalexpl3 for dummies - internal function arguments

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
erwann
Posts: 75
Joined: Thu Aug 25, 2016 2:24 am

expl3 for dummies - internal function arguments

Post by erwann »

How would I expl3-ify the following code? Can I specify an internal function like 'cs_new:Npn my_foo #1|#2* ....'? I tried, it doesn't seem like it.

Code: Select all

\documentclass{minimal}
\usepackage{xparse}

\ExplSyntaxOn

\def\@foo#1|#2*{
	(#1)(#2)
}

\NewDocumentCommand \foo
{u{|}u{*}}
{
\@foo#1|#2*
}

\ExplSyntaxOff

\begin{document}

\foo a|b* % (a)(b)

\end{document}
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

expl3 for dummies - internal function arguments

Post by cgnieder »

Such so-called “delimited” arguments would count as weird (w):

Code: Select all

\documentclass{article}
\usepackage{xparse}
 
\ExplSyntaxOn
 
\cs_new_protected:Npn \mypackage_foo:ww #1|#2*
  { (#1)(#2) }
 
\NewDocumentCommand \foo {u{|}u{*}}
  { \mypackage_foo:ww #1|#2* }
 
\ExplSyntaxOff
 
\begin{document}
 
\foo a|b* % (a)(b)
 
\end{document}
site moderator & package author
Post Reply