% \iffalse meta-comment
%
% Copyright (c) 2013 Johannes Rosenberger
%
% This work may be distributed and/or modified under the
% conditions of a BSD Style License (see file 'LICENSE').
%
% This work consists of the files wsemclassic.dtx and wsemclassic.ins
% and the derived file wsemclassic.cls.
%
% \fi
%
% \iffalse
%
%<*cls>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{wsemclassic}
    [2013/08/27 v1.0.1 document class for bavarian school w-seminar papers, based on report]
%</cls>
%
%<driver>\ProvidesFile{wsemclassic.drv}
%
%<*driver>
\documentclass[a4paper,11pt]{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription

\usepackage[noindex]{dox}
\usepackage{hypdoc,colordoc}
\usepackage{hologo}
\usepackage[left=30ex, top=3cm, bottom=3cm]{geometry}

\usepackage{marginnote}
\let\marginpar=\marginnote

\newcommand{\wsemclassic}{\textsf{wsemclassic}}
\newcommand{\report}{\textsf{report}}

\doxitem{Package}{ttpackage}{Packages Used}
\doxitem{Option}{option}{Options}

\newcommand{\describeoption}[3]{
  \noindent
  \\
  \hypertarget{udoc.opt.#1}{\DescribeOption[noindex=false]{#1 \textrm{\itshape #2}}}
  \marginpar{\\ \texttt{#3}}
  \hspace{-1.1ex}%
}

\newenvironment{hyperopt}[1]{
  \hypertarget{impl.opt.#1}{\option[noindex=false]{#1}}
}{
  \endoption
}

\newenvironment{indmacro}[1]{\macro[noindex=false]{#1}}{\endmacro}

\newenvironment{package}[1]{
  \ttpackage[noprint, noindex=false]{#1}
  \marginpar{\textsf{#1}}
}{
  \endttpackage
}
\newenvironment{noindpackage}[1]{
  \ttpackage[noprint, noindex=true]{#1}
  \marginpar{\textsf{#1}}
}{
  \endttpackage
}

\begin{document}
\DocInput{wsemclassic.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{480}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
%
% \changes{v1.0}{2013/08/27}{Initial version.}
% \changes{v1.0.1}{2013/08/27}{ctan package building bugfixes.}

%
% \GetFileInfo{wsemclassic.cls}
%
%
% \title{The \wsemclassic\ Document Class (\textsf{v1.0.1})}
% \author{Johannes Rosenberger \\
% \href{mailto:jo.rosenberger@gmx-topmail.de}{\texttt{<jo.rosenberger@gmx-topmail.de>}}}
% \date{2013/08/27}
% \maketitle
%
% \begin{abstract}
% This package provides a \hologo{LaTeXe} document class named \wsemclassic\
% for typesetting Bavarian school w-seminar papers.
% \end{abstract}
%
% \tableofcontents
%
% \input{user-doc}
%
% \StopEventually{\PrintChanges}
%
% \part{Implementation}
%
% \parindent0pt
% \begin{indmacro}{\report}
% is set to the name of the parent class. So it can be changed later easier.
%    \begin{macrocode}
\newcommand{\report}{report}
%    \end{macrocode}
% \end{indmacro}
%
%
% \section{Option processing}
%
% \begin{package}{kvoptions}
% is needed to parse key-value options:
%    \begin{macrocode}
\RequirePackage{kvoptions}

\SetupKeyvalOptions{
prefix = ws@
}
%    \end{macrocode}
% \end{package}
%
%
% Now we parse the key-value options.
% They are specified in the format \\
%
% |\Declare|\meta{Type}|Option|\oarg{default value}\marg{option name}. \\
%
% \subsection{Strictness} 
% \begin{hyperopt}{strict}
% First the strictness options.
%    \begin{macrocode}
\DeclareBoolOption[false]{strict}
\DeclareComplementaryOption{nostrict}{strict}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{stricttitle}
%    \begin{macrocode}
\DeclareBoolOption[false]{stricttitle}
\DeclareComplementaryOption{nostricttitle}{stricttitle}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{frenchspacing}
%    \begin{macrocode}
\DeclareBoolOption[false]{frenchspacing}
\DeclareComplementaryOption{nofrenchspacing}{frenchspacing}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \subsection{Format and Language}
% 
% \begin{hyperopt}{fontsize}
%    \begin{macrocode}
\DeclareStringOption[12]{fontsize}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{paper}
%    \begin{macrocode}
\DeclareStringOption[a4]{paper}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{lang}
%    \begin{macrocode}
\DeclareStringOption[german]{lang}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{plxtex}
%    \begin{macrocode}
\DeclareBoolOption[true]{plxtex}
\DeclareComplementaryOption{noplxtex}{plxtex}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \subsection{Bibliography}
% \begin{hyperopt}{bib}
%    \begin{macrocode}
\DeclareBoolOption[true]{bib}
\DeclareComplementaryOption{nobib}{bib}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{bibfile}
%    \begin{macrocode}
\DeclareStringOption[\jobname]{bibfile}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \subsection{Options Related to Used Packages}
%
% \subsubsection{\textsf{fontspec}}
%
% \begin{hyperopt}{fontspecargs}
%    \begin{macrocode}
\DeclareStringOption[quiet]{fontspecargs}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{defaultfontfeatures}
%    \begin{macrocode}
\DeclareStringOption[Ligatures={TeX, Common},
  Fractions=On]{defaultfontfeatures}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{mainfont}
%    \begin{macrocode}
\DeclareStringOption[CMU Serif]{mainfont}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{sansfont}
%    \begin{macrocode}
\DeclareStringOption[CMU Sans Serif]{sansfont}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{monofont}
%    \begin{macrocode}
\DeclareStringOption[CMU Typewriter Text]{monofont}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \subsubsection{\textsf{hyperref} and \textsf{natbib}}
%
% \begin{hyperopt}{hyperref}
%    \begin{macrocode}
\DeclareBoolOption[true]{hyperref}
\DeclareComplementaryOption{nohyperref}{hyperref}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{hyperrefargs}
%    \begin{macrocode}
\DeclareStringOption[unicode]{hyperrefargs}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \begin{hyperopt}{natbib}
%    \begin{macrocode}
\DeclareBoolOption[true]{natbib}
\DeclareComplementaryOption{nonatbib}{natbib}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{natbibargs}
%    \begin{macrocode}
\DeclareStringOption[round]{natbibargs}
%    \end{macrocode}
% \end{hyperopt}
% \begin{hyperopt}{bibstyle}
%    \begin{macrocode}
\DeclareStringOption[natdin]{bibstyle}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \subsubsection{Other Packages which Can Get Args}
% 
% \begin{hyperopt}{microtypeargs}
% Access to microtypographic features in \hologo{pdfTeX}, \hologo{XeTeX}
% and \hologo{LuaTeX}.
%    \begin{macrocode}
\DeclareStringOption[babel]{microtypeargs}
%    \end{macrocode}
% \end{hyperopt}
%
% \begin{hyperopt}{amsmathargs}
% Enhanced math.
%    \begin{macrocode}
\DeclareStringOption{amsmathargs}
%    \end{macrocode}
% \end{hyperopt}
%
% \begin{hyperopt}{titlesecargs}
% Better control over sectioning title appearance.
%    \begin{macrocode}
\DeclareStringOption[small]{titlesecargs}
%    \end{macrocode}
% \end{hyperopt}
%
% \begin{hyperopt}{geometryargs}
% Better page layout.
%    \begin{macrocode}
\DeclareStringOption{geometryargs}
%    \end{macrocode}
% \end{hyperopt}
%
% \begin{hyperopt}{fancyhdrargs}
% Easier headers and footers.
%    \begin{macrocode}
\DeclareStringOption{fancyhdrargs}
%    \end{macrocode}
% \end{hyperopt}
%
% \begin{hyperopt}{tocbibindargs}
% Makes a toc entry for the bibliography.
%    \begin{macrocode}
\DeclareStringOption[nottoc]{tocbibindargs}
%    \end{macrocode}
% \end{hyperopt}
%
%
% \subsection{Options Passed to Parent Class (\report) and Option Processing}
%
% All options not declared above are set to be passed to class \report,
% then options are processed.
%
%    \begin{macrocode}
\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{\report}}

\ProcessKeyvalOptions*\relax
%    \end{macrocode}
%
% 
% Now the |strict|(\hyperlink{udoc.opt.strict}{doc},\hyperlink{impl.opt.strict}{impl})
% option sets other related options.
%
% 
% \subsection{Making other Options \texttt{strict}}
%
% The |strict| (\hyperlink{udoc.opt.strict}{doc},\hyperlink{impl.opt.strict}{impl}) option sets other
% options to certain values, ignoring their custom values.
%    \begin{macrocode}
\ifws@strict
\renewcommand{\ws@fontsize}{12}
\renewcommand{\ws@paper}{a4}
\renewcommand{\ws@lang}{german}
\ws@frenchspacingtrue
\ws@stricttitletrue
\ws@bibtrue
\fi
%    \end{macrocode}
%
% And then the fontsize (\hyperlink{udoc.opt.fontsize}{doc},\hyperlink{impl.opt.fontsize}{impl}),
% the language (\hyperlink{udoc.opt.lang}{doc},\hyperlink{impl.opt.lang}{impl})
% and the paper size (\hyperlink{udoc.opt.paper}{doc},\hyperlink{impl.opt.paper}{impl}) are set.
% 
% If the paper size is |custom| it is not passed to \report.
%
%    \begin{macrocode}
\PassOptionsToClass{\ws@fontsize pt, \ws@lang}{\report}
\ifx \ws@paper custom \else
\PassOptionsToClass{\ws@paper paper}{\report}
\fi
%    \end{macrocode}
%
% Now the \report class (parent class) is loaded.
%    \begin{macrocode}
\LoadClass{\report}
%    \end{macrocode}
%
%
% \section{Package Loading and Settings}
%
% \begin{indmacro}{\babellang}
% When using \textsf{babel}, |ngerman| should be used instead of |german|.
% So we use this macro for \textsf{babel}.
%    \begin{macrocode}
\newcommand{\babellang}{
\ifx \ws@lang german
  ngerman
\else
  \ws@lang
\fi
}
%    \end{macrocode}
% \end{indmacro}
%
%
% \subsection{\hologo{TeX} Engine Dependent Settings}
%
% \begin{package}{iftex}
% is needed to determine which \hologo{TeX} engine we are running.
%    \begin{macrocode}
\RequirePackage{iftex}
%    \end{macrocode}
% \end{package}
%
%
% \begin{package}{inputenx}
% \begin{package}{fontenc}
% |\ifPDFTeX| only means `if not \hologo{XeTeX}/\hologo{LuaTeX}'.
% If this is true, we need \textsf{inputenx} for UTF-8 support
% and \textsf{fontenc} for T1 font support.
%
% \begin{package}{babel}
% \begin{package}{polyglossia}
% \textsf{babel} is used if we are not running \hologo{XeTeX} for which \textsf{polyglossia}
% is recommended.
% 
% \begin{package}{fontspec}
% If we are running \hologo{XeTeX} or \hologo{LuaTeX} then we use the \textsf{fontspec} package.
%    \begin{macrocode}
\ifPDFTeX
  \RequirePackage[utf8x]{inputenx}
  \RequirePackage[T1]{fontenc}

  \RequirePackage[\babellang]{babel}
  \RequirePackage[fixlanguage]{babelbib}

\else % if luatex or xelatex
  \ifXeTeX
    \RequirePackage{polyglossia}
    \setdefaultlanguage[babelshorthands, spelling=new]{german}
  \else
    \RequirePackage[\babellang]{babel}
    \RequirePackage[fixlanguage]{babelbib}
  \fi

  \RequirePackage[\ws@fontspecargs]{fontspec}
  \defaultfontfeatures{\ws@defaultfontfeatures}
\fi
%    \end{macrocode}
% \end{package}
% \end{package}
% \end{package}
% \end{package}
% \end{package}
%
% \subsection{Loading Styling Packages}
%
% 
% \begin{package}{hyperref} is used to use PDF features.
%    \begin{macrocode}
\ifws@hyperref
  \RequirePackage[\ws@hyperrefargs]{hyperref}
\fi
%    \end{macrocode}
% \end{package}
%
% \begin{package}{microtype} is used to use microtypographic features
% of \hologo{pdfTeX}/\hologo{XeTeX}/\hologo{LuaTeX}.
%    \begin{macrocode}
\ifws@plxtex
  \RequirePackage[\ws@microtypeargs]{microtype}
\fi
%    \end{macrocode}
% \end{package}
% 
% \begin{package}{amsmath}
% \begin{package}{amsthm}
% \begin{package}{amssymb}
% Use better mathematical formatting.
%    \begin{macrocode}
\RequirePackage[\ws@amsmathargs]{amsmath}
\RequirePackage{amsthm,amssymb}
%    \end{macrocode}
% \end{package}
% \end{package}
% \end{package}
%
% \begin{package}{titlesec} is used to change title formatting.
%    \begin{macrocode}
\RequirePackage[\ws@titlesecargs]{titlesec}
%    \end{macrocode}
% \end{package}
%
% \begin{package}{natbib} is needed for DIN conform bibliographies.
%    \begin{macrocode}
\ifws@natbib
  \RequirePackage[\ws@natbibargs]{natbib}
\fi
%    \end{macrocode}
% \end{package}
%
% \begin{package}{setspace} is needed for better setting of linespacing.
%    \begin{macrocode}
\RequirePackage{setspace}
\onehalfspacing
%    \end{macrocode}
% \end{package}
%
% \begin{package}{geometry} is needed for setting the page layout.
%    \begin{macrocode}
\RequirePackage[\ws@geometryargs]{geometry}
\newcommand{\setgeometry}[1]{\geometry{#1}}
\ifx \ws@paper custom \else
  \setgeometry{\ws@paper paper, scale=0.75, centering}
\fi
%    \end{macrocode}
% \end{package}
%
% \begin{package}{fancyhdr} is used for easier setting of the header/footer.
%    \begin{macrocode}
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headwidth}{\textwidth}
%    \end{macrocode}
% Now a pagestyle which displays chapters, sections and subsections in the header
% and the page number in the footer is constructed.
%    \begin{macrocode}
\fancypagestyle{wsfancy}{
  \fancyhead{}

  \newif\iffirstsection
  \firstsectiontrue

  \def\setchaptermark##1{
	  \firstsectiontrue
	  \edef\mark@chapter{##1}
	  \rhead{\mark@chapter}
  }
  \def\setsectionmark##1{
	  \edef\mark@section{##1}
	  \lhead{\mark@section}
  }
  \def\setsubsectionmark##1{
	  \iffirstsection
	  \firstsectionfalse
	  \edef\mark@section{##1}
	  \lhead{\mark@section\\\mark@section}
	  \fi
  }

  \renewcommand{\chaptermark}[1]{\setchaptermark{\chaptername~\thechapter.~~##1}}
  \renewcommand{\sectionmark}[1]{\setsectionmark{\thesection~~##1}}
  \renewcommand{\subsectionmark}[1]{\setsubsectionmark{\thesubsection~~##1}}
}
%    \end{macrocode}
% \end{package}
%
% \begin{package}{tocbibind} is needed for having a toc entry for the bibliography.
%    \begin{macrocode}
\RequirePackage[\ws@tocbibindargs]{tocbibind}
%    \end{macrocode}
% \end{package}
%
%
% \subsection{Making the Document Strict}
%
% \begin{option}{strict}
% Now that the necessary packages are loaded we can make the document |strict|.
%    \begin{macrocode}
\ifws@strict
  \setgeometry{top=2cm, bottom=2cm, left=2.5cm, right=2.5cm, a4paper}
  \titleformat{\chapter}{\normalfont\Large\bfseries}{\thechapter}{1em}{}{}

  \fancypagestyle{plain}{
    \fancyhf{}
    \chead{\thepage}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
  }
  \pagestyle{plain}
  \addtocontents{toc}{\protect\thispagestyle{empty}}
\else
%    \end{macrocode}
% Or we make it fancy.
%    \begin{macrocode}
  \pagestyle{wsfancy}
\fi
%    \end{macrocode}
% \end{option}
%
% \begin{option}{frenchspacing}
% Set frenchspacing if needed.
%    \begin{macrocode}
\ifws@frenchspacing
  \frenchspacing
\fi
%    \end{macrocode}
% \end{option}
%
%
% \section{The Titlepage}
%
% \subsection{The Caption Styles}
%
% \begin{option}{plxtex}
% If |true| use \textsf{microtype} for tracking(letter spacing),
% else use the \textsf{soulutf8} package.
% \begin{noindpackage}{microtype}
% \begin{package}{soulutf8}
%    \begin{macrocode}
\ifws@plxtex
  \newcommand{\spaced}[1]{%
  \textls[250]{\ifPDFTeX\else\addfontfeatures{Renderer=Basic}\fi#1}}
  \newcommand{\mainstyle}[1]{\Large\bfseries\textsc{\spaced{#1}}}
\else
  \RequirePackage{soulutf8}
  \newcommand{\spaced}[1]{\so{#1}}
  \newcommand{\spaced}[1]{
    {
      \def\text{#1~}
      \so\text
    }
  }
  \newcommand{\mainstyle}[1]{\Large\bfseries\textsc{\spaced{#1\,}}}
\fi
%    \end{macrocode}
% \end{package}
% \end{noindpackage}
% \end{option}
%
% Now we set the other caption styles for the title page.
%    \begin{macrocode}
\newcommand{\submainstyle}[1]{#1}
\newcommand{\subjectstyle}[1]{\textit{#1}}
\newcommand{\titlestyle}[1]{\large\textit{#1}}
%    \end{macrocode}
%
% \begin{option}{stricttitle}
% If |true|, make the main title uppercase and the title of the paper smaller.
%    \begin{macrocode}
\ifws@stricttitle
  \renewcommand{\mainstyle}[1]{\large\bfseries\MakeUppercase{\spaced{#1}}}
  \renewcommand{\titlestyle}[1]{\textit{#1}}
\fi
%    \end{macrocode}
% \end{option}
%
% \subsection{The Meta Information}
%
% \begin{indmacro}{\onlyhypermeta}
% This macro does sets PDF meta info or, if hyperref is not used, does nothing.
%    \begin{macrocode}
\ifws@hyperref
  \newcommand{\onlyhypermeta}[2]{
    \hypersetup{
      pdf#1=#2
    }
  }
\else
  \newcommand{\onlyhypermeta}[2]{}
\fi
%    \end{macrocode}
% \end{indmacro}
%
% \begin{indmacro}{\setmeta}
% This macro sets the \hologo{TeX} meta info.
%    \begin{macrocode}
\newcommand{\setmeta}[2]{
  {
    \def\@metaname{@#1}
    \expandafter\gdef\csname\@metaname\endcsname{#2}
  }
}
%    \end{macrocode}
% \end{indmacro}
%
% \begin{indmacro}{\sethypermeta}
% This macro sets the PDF and \hologo{TeX} meta info via the
% |\onlyhypermeta| and |\setmeta| macros.
%    \begin{macrocode}
\newcommand{\sethypermeta}[2]{
  \setmeta{#1}{#2}
  \onlyhypermeta{#1}{#2}
}
%    \end{macrocode}
% \end{indmacro}
%
% These macros store the
% \begin{indmacro}{\@author} author name,
%    \begin{macrocode}
\renewcommand{\@author}{Author}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@title} title of the paper,
%    \begin{macrocode}
\renewcommand{\@title}{Title}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@date} year of the abitur,
%    \begin{macrocode}
\renewcommand{\@date}{Date}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@subject} subject of the paper,
%    \begin{macrocode}
\newcommand{\@subject}{Subject}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@school} school,
%    \begin{macrocode}
\newcommand{\@school}{School}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@major} major subject (`Leitfach'),
%    \begin{macrocode}
\newcommand{\@major}{Major}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@teacher} teacher name,
%    \begin{macrocode}
\newcommand{\@teacher}{Teacher Name}
%    \end{macrocode}
% \end{indmacro}
% \begin{indmacro}{\@place} place where you write your thesis.
%    \begin{macrocode}
\newcommand{\@place}{Place}
%    \end{macrocode}
% \end{indmacro}
%
% The default values are only descriptions so that compiliation does not
% fail if one information is not specified.
%
% \begin{indmacro}{\author}
% \begin{indmacro}{\title}
% \begin{indmacro}{\date}
% \begin{indmacro}{\subject}
% \begin{indmacro}{\school}
% \begin{indmacro}{\major}
% \begin{indmacro}{\teacher}
% \begin{indmacro}{\place} These Macros can be used to set the meta info.
%    \begin{macrocode}
\renewcommand{\author}[1]{\sethypermeta{author}{#1}}
\renewcommand{\title}[1]{\sethypermeta{title}{#1}}
\renewcommand{\date}[1]{\setmeta{date}{#1}}
\newcommand{\subject}[1]{\sethypermeta{subject}{#1}}
\newcommand{\school}[1]{\setmeta{school}{#1}}
\newcommand{\major}[1]{\setmeta{major}{#1}}
\newcommand{\teacher}[1]{\setmeta{teacher}{#1}}
\newcommand{\place}[1]{\setmeta{place}{#1}}
%    \end{macrocode}
% \end{indmacro}
% \end{indmacro}
% \end{indmacro}
% \end{indmacro}
% \end{indmacro}
% \end{indmacro}
% \end{indmacro}
% \end{indmacro}
%
%
% \subsection{Set Captions}
% 
% \begin{indmacro}{\newcaption} can be used to set a caption in a certain
% language.
% 
% \emph{Only some of the captions on the title page use this yet!
% are only german!}
%
%    \begin{macrocode}
\newcommand{\newcaption}[3]{
  {
    \def\@capname{caption@#1@#2}
    \def\@dcapname##1{caption@##1@#2}
    \expandafter\gdef\csname\@capname\endcsname{#3}
    \expandafter\xdef\csname#2\endcsname{\csname\@dcapname{\ws@lang}\endcsname}
  }
}
%    \end{macrocode}
%
% Examples used here are:
%    \begin{macrocode}
\newcaption{german}{qpname}{Qualifikationsphase}
\newcaption{german}{mainname}{Seminararbeit}
\newcaption{german}{submainname}{im Wissenschaftsprop\"adeutischen Seminar}
\newcaption{german}{authorname}{Verfasser}
\newcaption{german}{majorname}{Leitfach}
\newcaption{german}{teachername}{Seminarleiter}
\newcaption{german}{closingname}{Selbstst\"andigkeitserkl\"arung}
%    \end{macrocode}
% \end{indmacro}
%
%
% \subsection{Building the Title Page}
%
% \begin{indmacro}{\placeholder} is a placeholder/form field to fill in things
% after printing.
%    \begin{macrocode}
\newcommand{\placeholder}{\rule[-.5ex]{5cm}{.4pt}}
%    \end{macrocode}
% \end{indmacro}
%
%
% \begin{indmacro}{\maketitle} is now changed to print our title page.
%    \begin{macrocode}
\renewcommand{\maketitle}{
  \begin{titlepage}
    \ifws@strict \else
      \newgeometry{left=2.5cm, right=2.5cm}
    \fi
    \setlength{\parindent}{\z@}
    \setlength{\parfillskip}{\z@\@plus1fil}
    %\setparsizes{\z@}{\z@}{\z@\@plus1fil}\par@updaterelative
    \singlespacing
    {\@school\hfill\@date\par}
    {\qpname\par}
    \vskip 7em
    \begin{center}
	    {\mainstyle{\mainname}\par}
      \vskip .5em
      {\submainstyle{\submainname}\par}
      \vskip .5em
      {\subjectstyle{\@subject}\par}
      \vskip .5em
      {\titlestyle{\@title}\par}
    \end{center}
    \vskip 10em
    \doublespacing
    \begin{tabular}{rl}
      \authorname: & \@author \\
      \majorname: & \@major \\
      \teachername: & \@teacher \\
      Abgabetermin: & \placeholder \\[1em]
      Note Seminararbeit: & \placeholder \\
      Punkte Seminararbeit (einfache Wertung): & \placeholder \\
      Punkte Pr\"asentation: & \placeholder \\
      Gesamtleistung (doppelte Wertung): & \placeholder \\
      Eintrag des Ergebnisses: & \placeholder \\[1em]
      Unterschrift des Seminarleiters: & \placeholder
    \end{tabular}
    \ifws@strict \else
      \restoregeometry
    \fi
  \end{titlepage}
  \stepcounter{page}
}
%    \end{macrocode}
% \end{indmacro}
%
% 
% \section{The Bibliography}
% 
% \begin{indmacro}{\makebib}
% \begin{option}{bibstyle}
% \begin{option}{bibfile}
% The bibliography is made using |\nobib{*}| so all entries in the bibliography
% file are printed.
%    \begin{macrocode}
\newcommand{\makebib}{
  \ifws@bib
    \nocite{*}
    \bibliographystyle{\ws@bibstyle}
    \bibliography{\ws@bibfile}
  \fi
}
%    \end{macrocode}
% \end{option}
% \end{option}
% \end{indmacro}
%
%
% \section{The Closing}
% 
% For Bavarian W-Seminar papers it is required that they contain a certain
% closing.
% \begin{indmacro}{\makeclosing}
% This closing is constructed here.
%    \begin{macrocode}
\newcommand{\makeclosing}{
 \newpage

 \setlength{\parindent}{\z@}
 \setlength{\parfillskip}{\z@\@plus1fil}
 %\setparsizes{\z@}{\z@}{\z@\@plus1fil}\par@updaterelative
 \chapter*{\protect\closingname}
 \addcontentsline{toc}{chapter}{\protect\closingname}
 {Ich erkl\"are, dass ich die Seminararbeit ohne fremde Hilfe angefertigt
 und nur die im Literaturverzeichnis angef\"uhrten Quellen und Hilfsmittel
 benutzt habe.\par}
 \vskip 2em
 {\@place, den \today\hfill\placeholder\par}
}
%    \end{macrocode}
% \end{indmacro}
%
%
% \section{\ttfamily\char92{}At\emph{(Begin\textbar{}End)}Document}
%
% \begin{indmacro}{\AtBeginDocument}
% \begin{indmacro}{\AtEndDocument}
%    \begin{macrocode}
\AtBeginDocument{\maketitle\tableofcontents}
\AtEndDocument{\makebib\makeclosing}
%    \end{macrocode}
% \end{indmacro}
% \end{indmacro}
%
% \Finale
% \endinput
%
% vim: filetype=tex shiftwidth=2 tabstop=2 expandtab