[texhax] need name of variable containing value of documentclass

Susan Dittmar Susan.Dittmar at gmx.de
Tue Oct 4 16:41:05 CEST 2011


Try with the following (untested):

Quoting Fehd, Ronald J. (CDC/OCOO/ITSO) (rjf2 at cdc.gov):
> > I would like to add the chapter command to the beginning of the file
> > when the doc is being input in the documentclass=book
> 
> \documentclass[10pt]{refrep}
> \newcommand\DocClass{refrep}
> 
> added \usepackage{ifthen}
> 
> after testing this
> at the beginning of the chapters
> 
> \ifthenelse{\equal{\DocClass}{refrep}}{%
> \chapter[\DocTitleShort]{\DocTitle}%
> }{\relax}%
> 
> and adding this to each part:
> 
> \ifthenelse{\equal{\DocClass}{refrep}}{%
> \part[\DocTitleShort]{\DocTitle}%
> }{\relax}%
> 
> I saw that I could make a macro:
> 
> \newcommand\addsectioning[1][chapter]{%
> \ifthenelse{\equal{\DocClass}{refrep}}%
> {\#1[\DocTitleShort]{\DocTitle}}{\relax}}%

{\csname #1\endcsname[\DocTitleShort]{\DocTitle}}{\relax}}%

\#1 will be read as first \#, then 1, which is not what you expected.

Hope that helps,

	Susan


More information about the texhax mailing list