%%
%% This is file `gamebook.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gamebook.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2011 by A. Miede, http://www.miede.de
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3 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.3 or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{gamebook}
    [2011/11/29 v1.0 Style for gamebooks/interactive novels]
\RequirePackage{ifthen}
    \newboolean{@debug}
    \newboolean{@drafting}

\DeclareOption{debug}{\setboolean{@debug}{true}}
\DeclareOption{draft}{\setboolean{@drafting}{true}}
\ProcessOptions\relax
\RequirePackage{fancyhdr}
\RequirePackage{extramarks}
\newcommand{\gbheadtext}{Gamebook}
\newcommand{\gbheader}{%
\pagestyle{fancy}%
\renewcommand{\sectionmark}[1]{\markboth{\thesection}{\thesection}}%
\fancyhead{}% clear all header fields
\fancyhead[LO,RE]{\small\gbheadtext}
\fancyhead[RO,LE]{\small\ifthenelse{\equal{\firstleftmark}%
{\leftmark}}{\leftmark}{\firstleftmark~--~\leftmark}}%
}
\newcommand{\gbdebug}[1]{\protect{\ifthenelse{\boolean{@debug}}%
{~\texttt{\scriptsize(#1)}}{\relax}}}
\newcommand{\gbdebugx}[1]{\protect{\ifthenelse{\boolean{@debug}}%
{\marginpar{\texttt{\scriptsize(#1)}}}{\relax}}}
\RequirePackage{titlesec}
\titleformat{\section}[block]{%
\centering\bfseries}{\fbox{\thesection}}{1em}{\relax}
\newcommand{\gbsection}[1]{\section{\label{#1}}\gbdebugx{#1}}
\newcommand{\gbturntext}{turn~to~}
\newcommand{\gbturn}[1]{\gbturntext{\bfseries\ref{#1}}\gbdebug{#1}}%\fbox
\newenvironment{gbtabbing}
  {\setlength{\topsep}{0pt}%
  \setlength{\tabbingsep}{0pt}%
   \setlength{\partopsep}{0pt}%
   \tabbing}%
  {\endtabbing}

\newcommand{\gbvillain}[5]{%
\hfill\begin{gbtabbing}%
\hspace{\parindent}\= Sehr sehr langer Name %
\= Sehr langer Skill + Wert \= Sehr langer Skill + Wert \kill%
\> \textsc{#1} \> #2~#3 \> #4~#5 \\%
\end{gbtabbing}%
}%
\RequirePackage{enumitem}
\newlist{gbturnoptions}{itemize}{1}
\setlist[gbturnoptions]{%
leftmargin=\parindent,labelindent=\parindent,label=} % noitemsep
\newcommand{\gbitem}[2]{\item #1\hfill\gbturn{#2}}
\ifthenelse{\boolean{@drafting}}{%
    \RequirePackage{draftwatermark}%
     \SetWatermarkLightness{0.9}
\SetWatermarkScale{.5}
\SetWatermarkText{Draft}
\RequirePackage{scrtime} % time access
\PassOptionsToPackage{draft}{prelim2e}
\RequirePackage{prelim2e}
\renewcommand{\PrelimWords}{\relax}
\renewcommand{\PrelimText}%
{\footnotesize[\,\today\ at \thistime\,]}}{\relax}
\endinput
%%
%% End of file `gamebook.sty'.
