3

I am writing a package in which I want to define an option myvalues in such a way that

\usepackage[myvalues={10,11}]{mypackage}

would execute \mycommand[10]{11} and

\usepackage[myvalues=11]{mypackage}

would execute \mycommand{11}.

I know how to define an option with just one value using xkeyval package

\DeclareOptionX{myvalues}{%
  \mycommand{#1}%
  }

but I am not sure how to extend it to behave as described above with two arguments.

Glen Brown
  • 31
  • 1
  • 1
    Can you provide a complete minimal example showing your entire usage? – Werner Dec 27 '17 at 06:07
  • 2
    I’ve been staring at your comment for a while. I think you should apologize. – egreg Dec 27 '17 at 07:27
  • 1
    About the minimal example: the site is full with XY-questions. Depending on what your commands should do, it’s quite likely that better ways to accomplish your needs can be suggested. To begin with, something like myvalues=[10]11 might be simpler to implement and to use. – egreg Dec 27 '17 at 07:33
  • The easiest solution is to use the xstring package to parse the comma delimited string. – John Kormylo Dec 27 '17 at 16:26
  • It seems clear to me what you are asking (two example inputs, and the corresponding outputs). I know that PGF/Tikz have some keys with multiple arguments. pgfkeys can be used independently of PGF/Tikz, so you might have some luck with that, but I'm not sure if it natively supports multiple arguments or if it is a Tikz extension that allows you to create such keys. – Suzanne Soy Feb 09 '19 at 11:54

0 Answers0