Powersem to load book or report class

Pascal Kockaert <[email protected]> Fri, 28 Feb 2003 10:14:25 +0100
Newsgroups gmane.comp.tex.texpower.user
Message-ID <[email protected]>
Hi to everybody on the list, and especially to Stephan.

My aim is to produce dynamic presentations with powersem/TeXpower,
while at the same using the "article mode" of seminar to produce
notes. In this mode, each slide is turned into a figure (a float)
which is included in the text.

The default and only choice of underlying class with seminar is
"article" (which is not to be confused with the article option to
obtain slides included in the text).

I would like to produce notes with the underlying book class. This
is why I tried to hack a little bit the seminar class so that it
loads book instead of article. This done, I had a look at the
powersem.cls code and noticed that everything is already there,
but to use the KOMAscript class.

I have modified these definitions in order to be able to choose
between article (default), book, report and scrartcl classes.

The changes that I made are included at the end of this message.

In the original version of powersem.cls, I did not understand why
you load the article classe like this:
     \oldLC@PS[#2]{article}
In this case, the options are, in fact, the name of the class, which is 
"article".
I also modified the command to load any class with options: \oldLC@PS[#1]{#2}.
Maybe there was a reason to load any class with \oldLC@PS{#2}.

As I want to be able to use the article mode, I had to comment the line 
saying \portraittrue.
Do you really need to impose this mode? I know that it is useful to have 
\portraittrue to
correctly select the page dimensions. I do this in my seminar configuration 
file, by the lines:
\@ifclassloaded{seminar}
   {  \ifarticle
       \edef\special@paper{\the\paperwidth,\the\paperheight}%
      \fi}{}%

I think that it would significantly extent the power of powersem, if you
decided to allow for the choice of other classes, like book,
report etc.

In addition, I wanted to ask you if it is necessary to force the
portrait mode when loading the seminar class. This mode is not
designed to be used with the article mode (though both options can
be combined).

Thank you for reading to this point, and many thanks for your work
on TeXpower.

Pascal Kockaert

%------------------------------------------
% My changes to load book instead of article
%     (option classbook,classreport)
%-------------------------------------------

[A]



%--------------------------------------------------------------------------------------------------------------
% The KOMA option tells powersem to load scrartcl (from the KOMA suite of 
document classes) instead of article.

\newboolean{KOMA@PS}
\DeclareOption{KOMA}{\setboolean{KOMA@PS}{true}}

becomes

%--------------------------------------------------------------------------------------------------------------
% The (\cl@ss@PS=book, KOMA, report) option tells powersem to load 
\cl@ss@PS instead of article.

\newboolean{class@PS}
\setboolean{class@PS}{false}
\DeclareOption{KOMA}       {\setboolean{class@PS}{true}\def\cl@ss@PS{scrartcl}}
\DeclareOption{reportclass}{\setboolean{class@PS}{true}\def\cl@ss@PS{report}}
\DeclareOption{bookclass}  {\setboolean{class@PS}{true}\def\cl@ss@PS{book}}




[B]



%--------------------------------------------------------------------------------------------------------------
% Now we need to hack a little to make seminar load scrartcl instead of 
article (if the option KOMA was given).

\ifthenelse{\boolean{KOMA@PS}}
{%
   \def\article@PS{article}

% Make \PassOptionsToClass and \LoadClass use scrartcl...

   \let\oldPOTC@PS=\PassOptionsToClass
   \def\PassOptionsToClass#1#2{\edef\cls@PS{#2}\ifx\article@PS\cls@PS\oldPOTC@PS{#1}{scrartcl}\else\oldPOTC@PS{#1}{#2}\fi}
  }
{}

% Furthermore, seminar redefines \paperheight and \paperwidth, saving their 
value in \sem@paperheight and
% \sem@paperwidth. We undo this so the paper dimension calculation of 
typearea can be used.

\let\oldLC@PS=\LoadClass
\renewcommand{\LoadClass}[2][]%
{%
   \edef\cls@PS{#2}%
   \ifx\article@PS\cls@PS
     \let\paperheight\sem@paperheight\let\paperwidth\sem@paperwidth
     \ifthenelse{\boolean{KOMA@PS}}{\oldLC@PS[#1]{scrartcl}}{\oldLC@PS[#2]{article}}
     \portraittrue
    \else
     \oldLC@PS{#2}%
   \fi
   }%


becomes

%--------------------------------------------------------------------------------------------------------------
% Now we need to hack a little to make seminar load \cl@ss@PS instead of 
article (if the option bookclass,reportclass or KOMA was given).

\ifthenelse{\boolean{class@PS}}
{%
   \def\article@PS{article}

% Make \PassOptionsToClass and \LoadClass use \cl@ss@PS...

   \let\oldPOTC@PS=\PassOptionsToClass
   \def\PassOptionsToClass#1#2{\edef\cls@PS{#2}\ifx\article@PS\cls@PS\oldPOTC@PS{#1}{\cl@ss@PS}\else\oldPOTC@PS{#1}{#2}\fi} 
%%%PK
  }
{}

% Furthermore, seminar redefines \paperheight and \paperwidth, saving their 
value in \sem@paperheight and
% \sem@paperwidth. We undo this so the paper dimension calculation of 
typearea can be used.

\let\oldLC@PS=\LoadClass
\renewcommand{\LoadClass}[2][]%
{%
   \edef\cls@PS{#2}%
   \ifx\article@PS\cls@PS
     \let\paperheight\sem@paperheight\let\paperwidth\sem@paperwidth
     \ifthenelse{\boolean{class@PS}}{\oldLC@PS[#1]{\cl@ss@PS}}{\oldLC@PS[#1]{article}} 
%%%PK
%%%PK%%%    \portraittrue
    \else
     \oldLC@PS[#1]{#2}% %%%PK
   \fi
   }%



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf