I try to write a little package for my personal use. For this I use kvoptions. Now I have to give a string to one of the options which contains \\ but this fails with: undefined control sequence. \let \reserved@e.
My texfile looks like this:
\documentclass{scrlttr2}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[myoption={Street\\City}]{mypackage}
\begin{document}
\begin{letter}{some name}
\opening{Dear ...}
\closing{Regards ...}
\end{letter}
\end{document}
And the content of the .sty-file:
\ProvidesPackage{mypackage}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=mypackage
,prefix=mypackage@
}
\DeclareStringOption[]{myoption}[]
\ProcessLocalKeyvalOptions*\relax
\setkomavar{fromaddress}{\mypackage@myoption} %just for example
In reality I do more than just that with myoption but I need it to accept \\ in the string. This is the only problem. As long as I don't use \\ in the strings everything works fine. I can use a default for the option like this:
\DeclareStringOption[Other street\\Other city]{myoption}
Inside of the .sty but the moment I want to enter another value for myoption containing \\ it fails. How is it possible to allow such characters in the options?
EDIT: added the \ProcessLocalKeyvalOptions
\ProcessLocalKeyvalOptions*, but that's not the solution – Jan 07 '17 at 19:02\\dies in the package loading code before kvoptions can see it.) You'd have to load a package that redefined\usepackagebefore you used an option in this way – David Carlisle Jan 07 '17 at 19:07\let\\\relaxbefore the package load (and put it back afterwards) – David Carlisle Jan 07 '17 at 19:12\let\\\relaxmyself. Thanks a lot, it works now! You might put this as an answer so I can accept it as one. – Skillmon Jan 07 '17 at 19:16