I would like to know if there's a way to use a command (including custom commands created with \newcommand) as parameter/option values). I would like to do something like this

\usepackage[supporters={First line\\ Second Line}]{someotherpackage}
  • Not unless you are altering the package itself and adding your options. – Mica Jan 6 '10 at 0:23
  • Also note that package options are fully expanded, which makes them sort of impossible to use for anything like this. (Not so with keyval options, though.) – Will Robertson Jan 6 '10 at 2:58
  • Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Jul 27 '12 at 17:10
  • The original question has been edited into an entirely different one. This is not allowed! The editor should ask their own question. The initial question was about passing option values via \documentclass, not via \usepackage. – Ahmed Musa Nov 26 '12 at 11:44

If you load the xkvltxp (or kvoptions-patch or catoptions) package before \documentclass, you will be fine: you can pass commands as values of options. To load a package before \documentclass, you should of course use \RequirePackage instead of \usepackage.


Two options

  1. You can check to see if a csname is defined using \ifdef in the package, so that defining \csname as a macro before invoking \usepackage can be checked. This isn't exactly what you asked, but it should, I guess, do what you want;
  2. You can pass the name of a command as a string without the backslash (say, to \input) in the options, and then bind the command using \edef\inputcs{\def\passname#1{\csname#1\endcsname}\expandafter\passname\input}.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy