I am trying to use kvoptions
pacakage to allow passing key options to my style file. Here is a MWE of the style file:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{test}
\newcommand{\rtitle}{TITLE}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=EL,
prefix=EL@
}
\DeclareStringOption[TITLE]{rtitle}
\ProcessKeyvalOptions*
\ifx\EL@rtitle\@empty
\PackageWarningNoLine{\@currname}{Running title is not passed to `rtitle'}
\else
\renewcommand{\rtitle}{\EL@rtitle}
\fi
\makeatletter
\def\@xfootnote[#1]{%
\protected@xdef\@thefnmark{#1}%
\@footnotemark\@footnotetext}
\makeatother
\RequirePackage{fancyhdr}
\fancyhf{}
\fancyhead[L]{\rtitle}
\pagestyle{fancy}
\endinput
Here is the tex file:
\documentclass[11pt,letterpaper]{article}
\usepackage[rtitle = {A\ TEST\ TITLE}]{test}
\begin{document}
Some random text.\footnote[*]{Some footnote with a special marker.}
\end{document}
Here is the issue. I try to simplify the style file by directly using the macro generated by \DeclareStringOption and not using \newcommand{\rtitle}{TITLE}:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{test}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=EL,
prefix=EL@
}
\DeclareStringOption[TITLE]{rtitle}
\ProcessKeyvalOptions*
\ifx\EL@rtitle\@empty
\PackageWarningNoLine{\@currname}{Running title is not passed to `rtitle'}
\fi
\makeatletter
\def\@xfootnote[#1]{%
\protected@xdef\@thefnmark{#1}%
\@footnotemark\@footnotetext}
\makeatother
\RequirePackage{fancyhdr}
\fancyhf{}
\fancyhead[L]{\EL@rtitle}
\pagestyle{fancy}
\endinput
After this modification of the style file, compiling the tex file gives an error message saying control sequence not defined.
What is wrong with directly using the macro EL@rtitle
in the fancyheader?
Thanks!
Edit: I realized that there is a conflict with the macro
\makeatletter
\def\@xfootnote[#1]{%
\protected@xdef\@thefnmark{#1}%
\@footnotemark\@footnotetext}
\makeatother
If I remove this part, then everything works fine. But, how should I fix this macro (except changing the order)? I still need to use a footnote with special marker.
.tex
file compiled normally.