Account Options

  1. Sign in
Google Groups Home
« Groups Home
Message from discussion auf vorhandensein der option "draft" pruefen
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Heiko Oberdiek  
View profile  
 More options Dec 28 1999, 3:00 am
Newsgroups: de.comp.text.tex
From: oberd...@ruf.uni-freiburg.de (Heiko Oberdiek)
Date: 1999/12/28
Subject: Re: auf vorhandensein der option "draft" pruefen
On Mon, 27 Dec 99 22:55:42 +0100, m...@dream.kn-bremen.de (Martin

Schroeder) wrote:
>In <3867CD41.37D30...@wimmer.net> Thomas Wimmer <tho...@wimmer.net> writes:
>>Wie lautet die Bedingung (bei benutzung des ifthen-paketes), wenn
>>ich auf Vorhandensein der Option "draft" bei \documentclass pruefen
>>will ?

>Ein Blick in classes.dtx verr"at, da"s die draft-Option nur die
>\overfullrule setzt. Es wird kein Schalter definiert, der dann abgefragt
>werden kann. Man k"onnte aber nat"urlich leicht eine Package bauen, die
>eine Draft-Option hat, die einen entsprechenden Schalter setzt...

%%% cut %%% ifdraft.sty %%% cut %%%
% File:        ifdraft.sty
% Version:     1999/12/29 v1.0
% Author:      Heiko Oberdiek
%
% Function:    Switch for option draft.
%
% Copyright:   Copyright (C) 1999 Heiko Oberdiek.
%
%              This program may be distributed and/or modified under
%              the conditions of the LaTeX Project Public License,
%              either version 1.1 of this license or (at your option)
%              any later version. The latest version of this license
%              is in
%                http://www.latex-project.org/lppl.txt
%              and version 1.1 or later is part of all distributions
%              of LaTeX version 1999/06/01 or later.
%
% Use:         \usepackage{ifdraft}
%              \ifdraft{<draft case>}{<final case>}
%
% History:     1999/12/28 v1.0: first public release
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{ifdraft}[1999/12/28 v1.0 Switch for option draft
(HO)]
\newif\if@draft
\DeclareOption{draft}{\@drafttrue}
\DeclareOption{final}{\@draftfalse}
\ProcessOptions
\newcommand*{\ifdraft}{%
  \if@draft
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}

\endinput
%%% cut %%% ifdraft.sty %%% cut %%%

%%% cut %%% test1.tex %%% cut %%%
\documentclass[draft]{article}
\usepackage{ifdraft}
\ifdraft{%
  \typeout{*DRAFT=TRUE*}%

}{%

  \typeout{*DRAFT=FALSE*}%
}

\begin{document}
\end{document}
%%% cut %%% test1.tex %%% cut %%%

>Oder tief in den Eingeweiden des LaTeX-Kernels w"uhlen, um Optionen
>abzufragen...

Wenn der Klassennamen bekannt ist, kommt man noch mit moderaten
Internas aus (funktioniert so aber nur vor \begin{document} wegen
\@onlypreamble\@ifclasswith):

%%% cut %%% test2.tex %%% cut %%%
\documentclass[draft]{article}
\makeatletter
\newcommand*{\ifwithdraft}[1]{%
  \@ifclasswith{#1}{final}\@secondoftwo{%
    \@ifclasswith{#1}{draft}\@firstoftwo\@secondoftwo
  }%

}

\makeatother
\ifwithdraft{article}{%
  \typeout{*DRAFT ON*}%
}{%

  \typeout{*DRAFT OFF*}%
}%

\begin{document}
\end{document}
%%% cut %%% test2.tex %%% cut %%%

Eine naechste Variante kommt ohne Klassennamen aus, verwendet aber
dafuer schon tiefere Internas (ebenfalls so nur vor \begin{document}
verwendbar):

%%% cut %%% test3.tex %%% cut %%%
\documentclass[draft]{article}
\makeatletter
\newcommand*{\ifoptiondraft}{%
  \expandafter
  \@if@pti@ns\expandafter{\@classoptionslist}{final}%
    \@secondoftwo{%
      \expandafter
      \@if@pti@ns\expandafter{\@classoptionslist}{draft}%
        \@firstoftwo\@secondoftwo
    }%

}

\makeatother
\ifoptiondraft{%
  \typeout{*DRAFT ON*}%
}{%

  \typeout{*DRAFT OFF*}%
}%

\begin{document}
\end{document}
%%% cut %%% test3.tex %%% cut %%%

Viele Gruesse
  Heiko <oberd...@ruf.uni-freiburg.de>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.