Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

migrated from stackoverflow.com Jul 27 '12 at 17:08

This question came from our site for professional and enthusiast programmers.

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
add comment

2 Answers

If you load 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.

share|improve this answer
add comment

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}.
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.