Code: Select all
\documentclass{article}\usepackage[color]{myown}\begin{document}some text \ldots\end{document}
Code: Select all
if color then\newcommand\headcol{\color{red}}...else\newcommand\headcol{\color{black}}...
Code: Select all
\documentclass{article}\usepackage[color]{myown}\begin{document}some text \ldots\end{document}
Code: Select all
if color then\newcommand\headcol{\color{red}}...else\newcommand\headcol{\color{black}}...
NEW: TikZ book now 40% off at Amazon.com for a short time.
Thanks, I already had given that a look, but found some difficulty in getting what I wanted. I have now some MWE which gives me the error. It might be due to my improper understanding of the option processing in a style/package file.Johannes_B wrote: you could have a look at »LaTeX2e for Class and Package writers«.
Code: Select all
\documentclass[svgnames,x11names]{article}\usepackage[color]{myown}\begin{document}Hello.\end{document}
Code: Select all
\NeedsTeXFormat{LaTeX2e}[1999/12/01]%\ProvidesPackage{myown}[2012/12/18]%\RequirePackage[a5paper,body={10cm,17cm},headheight=15.2pt,centering]{geometry}\RequirePackage[a5,center,off]{crop}\RequirePackage{fancyhdr,comment}\RequirePackage[final]{graphicx}\RequirePackage{tocloft,eqlist,enumitem,pifont,setspace,calc}\RequirePackage{tikz,tfrupee,titlesec,paralist,textcomp,everyshi}\RequirePackage{hyperref}%\DeclareOption{color}{%% Color\newcommand{\CHPCOL}{Firebrick3}\newcommand{\RTITLCOL}{Blue}\newcommand\LOGO{logo-col}}\DeclareOption{%% Mono\newcommand{\CHPCOL}{black}\newcommand{\RTITLCOL}{black}\newcommand\LOGO{logo}}\ProcessOptions\relax
Code: Select all
pdflatex test.tex...(/home/software/texlive/2012/texmf-dist/tex/latex/hyperref/hpdftex.def(/home/software/texlive/2012/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))! Undefined control sequence.\GenericError ...#4 \errhelp \@err@ ...l.27? xNo pages of output.
Code: Select all
\DeclareOption{mono}{%% Mono\newcommand{\CHPCOL}{black}\newcommand{\RTITLCOL}{black}\newcommand\LOGO{logo}}
Tried that and got the same error. My understanding of the DeclareOption* was that it would be, sort of, default behaviour if nothing is mentioned on \usepackage line.cgnieder wrote:You're simply missing the option name for your second option. I guess it should read:
Code: Select all
Code, edit and compile here:\DeclareOption{mono}{%% Mono\newcommand{\CHPCOL}{black}\newcommand{\RTITLCOL}{black}\newcommand\LOGO{logo}}
Code: Select all
\ExecuteOptions{color,mono}
Code: Select all
\errorcontextlines=999
Code: Select all
\GenericError ...\endgroup\ds@mono ->\newcommand {\CHPCOL }{black}\newcommand {\RTITLCOL }{black} \ne...\@forloop ...e #5\def #4{#2}\ifx #4\@nnil \else #5\@iforloop #3\@@ #4{#5}\fi...\@for ...fter \@forloop #2,\@nil ,\@nil \@@ #1{#3}\fi\reserved@a ...name ds@\CurrentOption \endcsname }\edef \CurrentOption {#1}l.28 \ExecuteOptions{color,mono}? xNo pages of output.
Then you used a differentmas wrote:Tried that and got the same error.
sty
file than the one you posted because it works there (I tried it before I answered). Code: Select all
\usepackage[color,mono]{myown}
\newcommand
so you'd get Code: Select all
! LaTeX Error: Command \CHPCOL already defined.
It was the same thing except for the addition of \errorcontextlines=999 which I had included to get a detailed error message.cgnieder wrote: Then you used a differentsty
file than the one you posted because it works there (I tried it before I answered).
I thought it was a bit obviousMaybe you can elaborate a bit on what it is you're trying to achieve?
NEW: TikZ book now 40% off at Amazon.com for a short time.