Skip to content
Snippets Groups Projects
vl-arbeitsanweisung.cls 8.44 KiB
Newer Older

\NeedsTeXFormat{LaTeX2e}[1999/12/01]
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\ProvidesClass{vl-arbeitsanweisung}
    [2018/05/15 v1.0a Dokumentenklasse (RN/PTB)]
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax
\PassOptionsToPackage{headinclude,usegeometry}{typearea}
,twoside
,fontsize=12pt% ???
Rolf Niepraschk's avatar
Rolf Niepraschk committed
,headings=small
,toc=bibliographynumbered
,captions=oneline
Rolf Niepraschk's avatar
Rolf Niepraschk committed
,captions=tableheading
%,origlongtable
\RequirePackage[%
paper=a4paper,
headheight=16mm,
Rolf Niepraschk's avatar
Rolf Niepraschk committed
marginparsep=2mm,
marginparwidth=12mm,
Rolf Niepraschk's avatar
Rolf Niepraschk committed
inner=22mm,
%right=16mm,
textwidth=172mm,% 172+22+16=210
Rolf Niepraschk's avatar
Rolf Niepraschk committed
textheight=228mm,
top=20bp,
headsep=10mm,
Rolf Niepraschk's avatar
Rolf Niepraschk committed
footskip=25mm,
]{geometry}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\setlength{\footheight}{18.5pt}

\renewcommand*\maketitle[1][1]{%
  \begingroup
  \centering \noindent\usekomafont{title}
    \Large \@title \par \bigskip\medskip
  \endgroup
}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage[main=ngerman,english]{babel}
\RequirePackage{tabularx}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage{graphicx}
\let\ptb@endtabularx=\TX@endtabularx
\RequirePackage{xltabular}
\RequirePackage{amsmath,threeparttable,tabto,grffile}
\RequirePackage{pdflscape,picture,trimspaces,url,varwidth,placeins}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage{zref-totpages,booktabs,array,pdfpages}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage{longtable,siunitx,ragged2e,ifxetex,ifluatex,relsize}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\keepXColumns
\RequirePackage{siunitx-PTB}
\let\ptb@tempdima=\@clnwd
\let\ptb@tempdimb=\@clnht
\let\ptb@tempdimc=\@dashdim

\newcommand*\ptb@Devision{}
\newcommand*\ptb@Department{}
\newcommand*\ptb@WorkingGroup{}
\newcommand*\ptb@Object{}
\newcommand*\ptb@Ident{}
\newcommand*\ptb@Edition{}
\newcommand*\ptb@Date{}
\newcommand*\ptb@tempa{0}
\ifxetex
  \def\ptb@tempa{1}%
\else
  \ifluatex
    \def\ptb@tempa{1}%
  \fi
\fi

\ifcase\ptb@tempa % pdfTeX
  \input{vl-aa-old-engines.clo}
\or               % XeTeX oder luaTeX
  \input{vl-aa-new-engines.clo}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage[
,final=true
,babel=true
]{microtype}

\RequirePackage[autostyle=true,babel=once,german=guillemets,maxlevel=3]{csquotes}%
\defineshorthand{"`}{\openautoquote}%
\defineshorthand{"'}{\closeautoquote}%
\MakeAutoQuote{»}{«}% Alt Gr + y / Alt Gr + x
\MakeAutoQuote{}{}% Alt Gr + v / Alt Gr + b

\newcommand*\Devision[1]{\xdef\ptb@Devision{\trim@spaces{#1}}}
\newcommand*\Department[1]{\xdef\ptb@Department{\trim@spaces{#1}}}
\newcommand*\WorkingGroup[1]{\xdef\ptb@WorkingGroup{\trim@spaces{#1}}}
\newcommand*\Object[1]{\xdef\ptb@Object{\trim@spaces{#1}}}
\newcommand*\Edition[1]{\xdef\ptb@Edition{\trim@spaces{#1}}}
\RequirePackage{tocstyle}
\usetocstyle{allwithdot}
\settocfeature{raggedhook}{\raggedright}% verhindert auch Trennung
\settocfeature{pagenumberbox}{\makebox[1.5em][r]}
\settocfeature{entryhook}{\overfullrule=\z@}
\BeforeStartingTOC[toc]{\microtypesetup{protrusion=false}}
\AfterStartingTOC[toc]{\microtypesetup{protrusion=true}}
\addtokomafont{caption}{\small}
\addtokomafont{captionlabel}{\bfseries\sffamily}
\setcapindent{1em}

\AtBeginDocument{%
  \edef\ptb@Ident{\ptb@Department-AA-\ptb@Object}%
  \edef\ptb@Date{\@date}%
  \date{}%
}

\newcommand*\ptb@rulewidth{.4mm}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\RaggedRight\arraybackslash}X}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand\varbox[2][\linewidth]{%
  \begin{varwidth}{#1}\nointerlineskip\strut#2\strut\end{varwidth}\strut}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand\varboxC[2][\linewidth]{\varbox[#1]{\Centering#2}}  
\newcommand*\ptb@head@even{%
  \begin{picture}(0,0)
    \linethickness{\ptb@rulewidth}%
    \put(0,-2.5mm){\line(1,0){\textwidth}}%
  \end{picture}
  \normalfont\sffamily\bfseries\large
  PTB\hfill Qualit\"atsmanagement-Arbeitsanweisung\hfill\ptb@Ident 
Rolf Niepraschk's avatar
Rolf Niepraschk committed
}
\newcommand*\ptb@head@odd{%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  \begin{picture}(0,0)
    \linethickness{\ptb@rulewidth}%
    \put(0,-2.5mm){\line(1,0){\textwidth}}%
  \end{picture}
  \normalfont\sffamily\bfseries\large
  \ptb@Ident \hfill Qualit\"atsmanagement-Arbeitsanweisung \hfill PTB
Rolf Niepraschk's avatar
Rolf Niepraschk committed
}
\newcommand*\ptb@first@foot{%
  \raisebox{-4bp}[0pt][0pt]{% 
    \let\TX@endtabularx=\ptb@endtabularx
    \normalfont\sffamily\tiny\extrarowheight=.3\baselineskip
    \arrayrulewidth=\ptb@rulewidth \extratabsurround=0pt %
    \renewcommand\tabularxcolumn[1]{m{##1}}%
    \begin{tabularx}{\textwidth}[b]{@{}|C|C|C|c|c|c|@{}} \firsthline
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Erstellt: \\
      Abteilung~\ptb@Devision, Fachbereich~\ptb@Department \\
      AG~\ptb@WorkingGroup}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Geprüft: \\ Leiter~\ptb@Department  \\~}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Genehmigt: \\ QMV-\ptb@Devision \\~}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Ausgabe-Nr.: \\ \ptb@Edition\\~}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Kurzbezeichnung: \\ \ptb@Ident\\~}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Seite von Seiten \\ \thepage~von \ztotpages\\~}
    \tabularnewline

    &&&&& \tabularnewline
    &&&&& \tabularnewline

      am:~\dotfill
    &
      am:~\dotfill
    &
      am:~\dotfill
    &
    && \tabularnewline \lasthline
    \end{tabularx}%
  \endgroup
  }%
}
\newcommand*\ptb@foot@even{%
  \begingroup
    \let\TX@endtabularx=\ptb@endtabularx
    \normalfont\sffamily\tiny\extrarowheight=.3\baselineskip
    \arrayrulewidth=\ptb@rulewidth \extratabsurround=0pt %
    \renewcommand*\tabularxcolumn[1]{m{##1}}%
    \begin{tabularx}{\textwidth}[b]{@{}|C|C|C|C|C|@{}} \firsthline
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Erstellt: \\ Abteilung~\ptb@Devision, Fachbereich~\ptb@Department}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Ausgabe-Nr.: \\ \ptb@Edition}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Datum: \\ \ptb@Date}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Kurzbezeichnung: \\ \ptb@Ident}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Seite von Seiten \\ \thepage~von \ztotpages}
    \tabularnewline \lasthline
    \end{tabularx}%
  \endgroup
}
\newcommand*\ptb@foot@odd{%
  \begingroup
    \let\TX@endtabularx=\ptb@endtabularx
    \normalfont\sffamily\tiny\extrarowheight=.3\baselineskip
    \arrayrulewidth=\ptb@rulewidth \extratabsurround=0pt %
    \renewcommand*\tabularxcolumn[1]{m{##1}}%
    \begin{tabularx}{\textwidth}[b]{@{}|C|C|C|C|C|@{}} \firsthline
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Seite von Seiten \\ \thepage~von \ztotpages}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Kurzbezeichnung: \\ \ptb@Ident}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Datum: \\ \ptb@Date}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Ausgabe-Nr.: \\ \ptb@Edition}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      \varboxC{Erstellt: \\ Abteilung~\ptb@Devision, Fachbereich~\ptb@Department}
    \tabularnewline \lasthline
    \end{tabularx}%
\RequirePackage[manualmark,draft=false]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\cehead{\ptb@head@even}
\cohead{\ptb@head@odd}
\cefoot{\ptb@foot@even}
\cofoot{\ifnum\c@page=\@ne\ptb@first@foot\else\ptb@foot@odd\fi}
\setkomafont{pageheadfoot}{\normalfont\normalsize}
% Kompaktere Listen
\RequirePackage{enumitem}
\setlist{leftmargin=*}
\setlist[1]{labelindent=1em}
\renewcommand{\floatpagefraction}{.9}
\renewcommand{\textfraction}{.1}
\renewcommand{\topfraction}{.9}
\renewcommand{\bottomfraction}{.5}
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{1}
\setcounter{totalnumber}{5}
\renewcommand{\dbltopfraction}{.8}
\renewcommand{\dblfloatpagefraction}{.6}
% Einzelne Abbildungen nicht auf dem leeren Blatt zentrieren.
\@fptop=0pt %
% TODO: nach  siunitx-PTB.sty ???
\sisetup{% Formatierung von Maßzahlen (z.B. Spaltentyp "S" in Tabellen)
  ,retain-zero-exponent=true
  ,retain-unity-mantissa=true
  ,add-decimal-zero=true
  ,add-integer-zero=true
  ,zero-decimal-to-integer=false
}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\addtokomafont{title}{\sisetup{detect-weight=true, detect-family=true}}
\addtokomafont{disposition}{\sisetup{detect-weight=true, detect-family=true}}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RedeclareSectionCommand[
,tocindent=3em
,tocnumwidth=3.5em
]{section}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage{marginnote}
\DeclareRobustCommand\note{%
  % Normalform = Horizontale Notiz;
  %   #1 = vertikale Verschiebung (ohne Einheit: Anzahl Zeilen)
  % Sternform = Um 90 Grad gedrehte Notiz;
  %   #1 = Breite (ohne Einheit: Anzahl mm, ohne Angabe: 3\marginparwidth)
  \@ifstar{\@tempswatrue\note@i}{\@tempswafalse\note@i}%
}

\newcommand*\note@i[1][\z@]{%
  \note@ii[#1]%
}

\newcommand*\note@ii{}
\def\note@ii[#1]#2{%
  \begingroup{}
    \if@tempswa
      \unitlength=1mm\relax
    \else
      \unitlength=\baselineskip
    \fi
    \@ovro#1\unitlength
    \if@tempswa
      \@ovri=\ifdim\@ovro=\z@ 3\marginparwidth\else\@ovro\fi
      \@ovro=\z@
      \def\x{\rotatebox[origin=c]{90}{\makebox[0pt][c]{%
        \parbox{\@ovri}{\baselineskip=0pt\RaggedRight\hspace{0pt}#2}}}}%
    \else
      \def\x{\baselineskip=0pt\RaggedRight\hspace{0pt}#2}%
    \fi
    \overfullrule=\z@
    \marginnote{\x}[\@ovro]%
  \endgroup
  \ignorespaces% problematisch!
}
% Für Parameter #1 Angabe mit und ohne Einheit ermöglichen.
\picture@redefine\note@ii{[&1]}

\renewcommand*\marginfont{\normalfont\normalsize\itshape\color{red}}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\emergencystretch=3em % 

\raggedbottom
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\AtBeginDocument{\setkeys{Gin}{draft=false}}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage{nameref}
\RequirePackage[final]{hyperref}