LaTeX forum ⇒ Generalexpl3 for dummies - internal function arguments Topic is solved

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

expl3 for dummies - internal function arguments

Postby erwann » Thu Mar 01, 2018 10:36 pm

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.

  1. \documentclass{minimal}
  2. \usepackage{xparse}
  3.  
  4. \ExplSyntaxOn
  5.  
  6. \def\@foo#1|#2*{
  7. (#1)(#2)
  8. }
  9.  
  10. \NewDocumentCommand \foo
  11. {u{|}u{*}}
  12. {
  13. \@foo#1|#2*
  14. }
  15.  
  16. \ExplSyntaxOff
  17.  
  18. \begin{document}
  19.  
  20. \foo a|b* % (a)(b)
  21.  
  22. \end{document}
x_86 / Linux Mint 18.3 / texlive 2015.20160320-1ubuntu0.1 / TeXworks 0.5r1361 (Debian)

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Fri Mar 02, 2018 6:00 pm

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

  1. \documentclass{article}
  2. \usepackage{xparse}
  3.  
  4. \ExplSyntaxOn
  5.  
  6. \cs_new_protected:Npn \mypackage_foo:ww #1|#2*
  7. { (#1)(#2) }
  8.  
  9. \NewDocumentCommand \foo {u{|}u{*}}
  10. { \mypackage_foo:ww #1|#2* }
  11.  
  12. \ExplSyntaxOff
  13.  
  14. \begin{document}
  15.  
  16. \foo a|b* % (a)(b)
  17.  
  18. \end{document}
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “General”

Who is online

Users browsing this forum: No registered users and 8 guests