0

I have a custom .cls file which passes the parameters of the \documentclass to a4paper.

In this .cls file, I have (from the top),

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2000/1/01 v0.1
   LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}

I would like to modify here so that if draft is present, then removes twoside that book (I assume) option passes and replace it with oneside.

7
  • see tex.stackexchange.com/a/240128/2388. There is also the ifdraft package. Commented Jun 9, 2022 at 18:58
  • nice, this answers the second part of the question! Thank you!!
    – Tom
    Commented Jun 9, 2022 at 19:07
  • @UlrikeFischer So does this mean that if I set \overfullrule=0 before loading of some package, then draft mode isn't applied on those packages? If so, that is not a good design (in a sense that it isn't obvious for anyone).
    – Tom
    Commented Jun 9, 2022 at 20:09
  • depends on what these packages are doing. They could implement their own option code. Commented Jun 9, 2022 at 20:36
  • @UlrikeFischer Yeah okay. But \ifdim\overfullrule>0pt does not work for .cls because this need to happen before \overfullrule is overwritten... whmmm
    – Tom
    Commented Jun 9, 2022 at 21:38

1 Answer 1

0

I got it.

All I had to do was to put this

\DeclareOption{draft}{\PassOptionsToClass{oneside}{\baseclass}\PassOptionsToClass{draft}{\baseclass}}

after

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2000/1/01 v0.1
   LaTeX document class]
\def\baseclass{book}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .