I'm writing a class which I can call myclass
. I try to define the following commands for changing the text colors (text, section, etc.):
\RequirePackage{xcolor}
\newcommand{\setsectioncolor}[1]{\color[#1]}
\newcommand{\sectioncolor}{}
\newcommand{\setsubsectioncolor}[1]{\color{#1}}
\newcommand{\subsectioncolor}{}
\newcommand{\setsubsubsectioncolor}[1]{\color{#1}}
\newcommand{\subsubsectioncolor}{}
\newcommand{\settxtcolor}[1]{\color{#1}}
\newcommand{\txtcolor}{}
The problem is that I don't know how to define \sectcolor
, etc. and could really use some help. I will try to explain what I want to do with these commands.
I would like to redefine section, etc. using \sectcolor
:
\renewcommand{\section}{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\headingfont\Large\bfseries\sectioncolor}}
\documentclass[]{}
myclass
define\section
and\subsection
? For theset
commands you probably want something like\colorlet{sectcol}{#1}
rather than a macro\sectcol
although it isn't very clear how you're planning to use things.\setsectioncolor
:\newcommand{\setsectioncolor}[1]{\renewcommand{\sectioncolor}{\color{#1}}}
. And your (re)definition of\section
with\sectioncolor
should then work as expected (assuming you've also defined\headingfont
as well which, by the way, should probably follow\Large\bfseries
so that\headingfont
would add to the default style).