Skip to content
Snippets Groups Projects
kalibrierschein.cls 12 KiB
Newer Older

\setcounter{errorcontextlines}{100}
\newcommand*\ks@location{Berlin}
\newcommand*\ks@kalType{KK}
\newcommand*\ks@layout{-0000}
\newcommand*\ks@langs{ngerman,main=english}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{kalibrierschein}
  [2019/02/15 v0.3b Dokumentenklasse (RN/PTB)]
\DeclareOption{BS}{\def\ks@location{Braunschweig}}
\DeclareOption{BLN}{\def\ks@location{Berlin}}
\DeclareOption{KK}{\edef\ks@kalType{\CurrentOption}}
\DeclareOption{IK}{\edef\ks@kalType{\CurrentOption}}
\DeclareOption{2015}{\edef\ks@layout{-\CurrentOption}}
\DeclareOption{german}{\def\ks@langs{english,main=ngerman}}
\DeclareOption{ngerman}{\def\ks@langs{english,main=ngerman}}
\DeclareOption{de}{\def\ks@langs{english,main=ngerman}}
\DeclareOption{english}{\def\ks@langs{ngerman,main=english}}
\DeclareOption{en}{\def\ks@langs{ngerman,main=english}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax
\PassOptionsToPackage{paper=a4,pagesize,twoside=false,headinclude}{typearea}

% Wegen bug in fontspec v2.4a
%\RequirePackage{fixltx2e}

\LoadClass[%
,fontsize=11pt
,headings=small
,numbers=enddot
,parskip=half
]{scrartcl}

%\RequirePackage{showframe}

\RequirePackage[\ks@langs]{babel}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage[autostyle=true,german=guillemets,maxlevel=3]{csquotes}%
\RequirePackage{iflang}
\IfLanguageName{ngerman}{%
  \newcommand*\ks@draftName{Entwurf}%
  \AtEndOfClass{\shorthandon{"}}
  \defineshorthand{"`}{\openautoquote}
  \defineshorthand{"'}{\closeautoquote}
}{%
  \newcommand*\ks@draftName{Draft}%
\MakeAutoQuote{»}{«}
\AtEndOfClass{%
  \@ifpackageloaded{inputenc}{}{%
    \catcode`=\active
    \catcode`=\active
  }%
}

\def\huge{\@setfontsize\huge{20.26}{25.3}}
\def\large{\@setfontsize\large{12.17}{14.2}}
\def\tiny{\@setfontsize\tiny\@viipt\@viiipt}

\raggedbottom% ???


\RequirePackage{textcomp}
%%%\RequirePackage[standard-baselineskips]{cmbright}
%%%\RequirePackage[math]{iwona}
%%%\RequirePackage[math]{kurier}
%%%\RequirePackage{lxfonts}
% 1 %\RequirePackage{arevmath}



%\let\celsius=\relax \let\ohm=\relax
%\RequirePackage{gensymb}



%%%\RequirePackage[T1,small]{eulervm}

%%%\RequirePackage{ziffer}

\RequirePackage{tabularx}
\let\ks@TX@endtabularx=\TX@endtabularx
\newcommand*\origTabularx{%
  \let\TX@endtabularx=\ks@TX@endtabularx
}
\RequirePackage{ltablex}\keepXColumns{}
\setcounter{LTchunksize}{100}

\PassOptionsToPackage{final}{graphicx}
\RequirePackage{eso-pic,graphicx,booktabs}
\RequirePackage{zref-totpages}

\newif\ifXeOrLua \XeOrLuafalse
\RequirePackage{ifxetex,ifluatex,ifpdf}

\ifxetex% XeTeX
  \XeOrLuatrue
\else
  \ifluatex% LuaTeX
    \XeOrLuatrue
  \else
    \ifpdf% pdfTeX
    \else% TeX+dvips
    \fi
  \fi
\fi

\RequirePackage{amsmath}

\ifXeOrLua% XeLaTeX oder luaLaTeX

\typeout{#### XeLaTeX oder luaLaTeX}
%\RequirePackage[no-math]{fontspec}
\RequirePackage{unicode-math}
\setmainfont{texgyreheros}[
  Ligatures=TeX,
  Extension=.otf,
  UprightFont=*-regular,
  BoldFont=*-bold,
  ItalicFont=*-italic,
  BoldItalicFont=*-bolditalic.otf]
\setsansfont{texgyreheros}[
  Ligatures=TeX,
  Extension=.otf,
  UprightFont=*-regular,
  BoldFont=*-bold,
  ItalicFont=*-italic,
  BoldItalicFont=*-bolditalic.otf]
\setmathfont{Asana-Math.otf}[math-style=ISO,bold-style=ISO]% damit sind Einheiten kursiv
\setmathfont{texgyreheros-regular.otf}[range=\mathup,Scale=MatchLowercase]
\setmathfont{texgyreheros-italic.otf}[range=\mathit,Scale=MatchLowercase]
\setmathfont{texgyreheros-bold.otf}[range=\mathbfup,Scale=MatchLowercase]
\setmathfont{texgyreheros-bolditalic.otf}[range=\mathbfit,Scale=MatchLowercase]
\setmathfont{texgyreheros-regular.otf}[range=\mathsfup,Scale=MatchLowercase]
\setmathfont{texgyreheros-italic.otf}[range=\mathsfit,Scale=MatchLowercase]
\setmathfont{texgyreheros-bold.otf}[range=\mathbfsfup,Scale=MatchLowercase]
\setmathfont{texgyreheros-bolditalic.otf}[range=\mathbfsfit,Scale=MatchLowercase]
\setmathfont{texgyreheros-regular.otf}[range=\mathpunct]
\setmathfont{Asana-Math.otf}[range=\int]
% (Ulrike): )als letztes immer einen
% richtiger Mathfont, damit diverse Werte korrekt gesetzt werden.
% Wirklich nötig?

\RequirePackage{newunicodechar}
\newunicodechar{^^^^202f}{\,}% 'NARROW NO-BREAK SPACE' (\u202F, 8239)
\newunicodechar{^^^^2009}{\,\hspace{0pt}}% 'THIN SPACE'
\newunicodechar{^^^^00ad}{\-}% 'SOFT HYPHEN'
\newunicodechar{^^^^2207}{{\setmathfont{Asana Math}^^^^2207}}% 'NABLA'

%%% TODO: ^^^^ unschädlich machen für pdflatex

\else

\typeout{#### pdfLaTeX}

\RequirePackage{fix-cm}% ???
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\DeclareUnicodeCharacter{202F}{\,}
\DeclareUnicodeCharacter{2009}{\,\hspace{0pt}}
\DeclareUnicodeCharacter{22C5}{\cdot}
\DeclareUnicodeCharacter{03B8}{\theta}
\RequirePackage[scale=1]{tgheros}
%%%\RequirePackage[scaled=1]{helvet}
\renewcommand*\familydefault{\sfdefault}
%%%\newcommand*\mathfamilydefault{\familydefault}
%%\newcommand*\math@sfdefault{\sfdefault}

\RequirePackage{sfmath}

\fi

%%%\RequirePackage{babel}
%\RequirePackage{gensymb} %% ???
%\let\ks@celsius=\celsius
%\let\celsius=\relax
%\let\ohm=\relax
%\RequirePackage{siunitx}
%\let\celsius=\ks@celsius

\iffalse
\AtBeginDocument{%
  \RequirePackage[babel=once,german=guillemets]{csquotes}
  \defineshorthand{"`}{\openautoquote}
  \defineshorthand{"'}{\closeautoquote}
}
\fi

\RequirePackage[neverdecrease]{paralist}
\let\itemize\compactitem
\let\enditemize\endcompactitem
\let\enumerate\compactenum
\let\endenumerate\endcompactenum
\let\description\compactdesc
\let\enddescription\endcompactdesc
\pltopsep=\medskipamount
\plitemsep=\smallskipamount

\newcommand*\ks@PTB{Physikalisch-Technische Bundesanstalt}
\newcommand*\ks@BSuB{Braunschweig und Berlin}

\RequirePackage{picture}
\RequirePackage[manualmark]{scrpage2}

\let\@tempdimd=\@clnwd
\let\@tempdime=\@clnht
\let\@tempdimf=\@dashdim

\newcommand*\ks@tempa{}
\newcommand*\ks@tempb{}
\newcommand*\ks@tempc{}
\newcommand*\ks@tempd{}
\newcommand*\ks@tempe{}

\newtoks\ks@tab
\newcommand*\ks@colSpec{}

\newcommand*\ks@add[1]{%
  \ks@tab\expandafter{\the\ks@tab#1}%
}

\newcommand*\ks@addTabLine[1]{%
  \def\@tempc{}%  
  \@for\@tempa:=#1\do{%
    \edef\@tempb{\noexpand\ks@tab\noexpand\expandafter{%
      \the\noexpand\ks@tab\@tempc\@tempa}}%
    \@tempb
    \def\@tempc{\noexpand&}% \noexpand hier unnötig, aber ...
\newcommand*\ks@getColSpec[2]{%
  \let#2=\@empty
  \@for\@tempa:=#1\do{%
  \ifx#2\@empty
    %\def#2{l}%
    \def#2{X}%
\newcommand*\ks@printDevicesTable[3]{% #1 = width, #2 = 1. offset, #3 = 2. offset
  \ks@tab{}%
  \ks@getColSpec{\ks@type}{\ks@colSpec}%
  \edef\@tempa{\noexpand\begin{tabularx}{#1}[t]{@{}\ks@colSpec @{}}}%
  \ks@tab\expandafter{\@tempa}%
  \ks@addTabLine{\ks@manufacturer}%
  \ks@add{\tabularnewline[#2]}%
  \ks@addTabLine{\ks@type}%
  \ks@add{\tabularnewline[#3]}%
  \ks@addTabLine{\ks@serialNo}%
  %%\ks@add{\ks@serialNo}%
  %%\ks@addCommaItems{\ks@serialNo}% ???
  \ks@add{\end{tabularx}}%
  \begingroup
    \tabcolsep=1em %
    \origTabularx
    %\showthe\ks@tab
    \the\ks@tab
  \endgroup
}

\defpagestyle{headings}%
{%        Kopf
  %(OLL,OLD)% Linie
  {\pagemark\hfill}% Gerade Seiten
  {\hfill\pagemark}% Ungerade Seiten
  {% Einseitig
  }
  %(\textwidth,.8pt)% Linie
}%
{%        Fuss
  %(OLL,OLD)% Linie
  {}% Gerade Seiten
  {}% Ungerade Seiten
  {% Einseitig
    \ks@foot
  }
  %(ULL,ULD)% Linie
}

\newcommand*\ks@foot{}

\input{\ks@kalType\ks@layout.clo}% Titelseiten- und Layout-Definition

\newcommand*\ks@type{%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  Typ des Ger\"ates}
\newcommand*\type[1]{\xdef\ks@type{\trim@spaces{#1}}}

\newcommand*\ks@manufacturer{Namen der Hersteller}
\newcommand*\manufacturer[1]{%
  \xdef\ks@manufacturer{\trim@spaces{\detokenize{#1}}}%
}

\newcommand*\ks@object{%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  Name des Ger\"ates, kurze Charakterisierung}
\newcommand*\object[1]{\xdef\ks@object{\trim@spaces{#1}}}

\newcommand*\ks@applicant{%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  Name des Auftraggebers, Stra\ss e, Firmensitz}
\newcommand*\applicant[1]{\long\gdef\ks@applicant{#1}}
\newcommand*\ks@serialNo{XXX,YYY}
\newcommand*\serialNo[1]{%
  \xdef\ks@serialNo{\trim@spaces{\detokenize{#1}}}%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand*\ks@refNo{YYY-ZZZZZZZZ}
\newcommand*\refNo[1]{\xdef\ks@refNo{\trim@spaces{#1}}}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand*\ks@calibMark{YYY-XXXXXXX}
\newcommand*\calibMark[1]{\xdef\ks@calibMark{\trim@spaces{#1}}}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand*\ks@referenceMark{YYY-XXXXXXX}
\newcommand*\referenceMark[1]{\xdef\ks@referenceMark{\trim@spaces{#1}}}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand*\ks@calibDate{????-??-??}
\newcommand*\calibDate[1]{\xdef\ks@calibDate{\trim@spaces{#1}}}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\newcommand*\ks@certificateDate{????-??-??}
\newcommand*\certificateDate[1]{\xdef\ks@certificateDate{\trim@spaces{#1}}}

\newcommand*\ks@byOrder{Peter Silie}
\newcommand*\byOrder[1]{\xdef\ks@byOrder{\trim@spaces{#1}}}

\newcommand*\ks@examiner{Ellen Bogen}
\newcommand*\examiner[1]{\xdef\ks@examiner{\trim@spaces{#1}}}

\newcommand*\ks@missingEntries{1}
\newcommand*\missingEntries[1]{\xdef\ks@missingEntries{\trim@spaces{#1}}}

\newcolumntype{C}{>{\centering\arraybackslash}X}

\newcommand\resultTable[3][]{%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  %\begingroup
  \@tempcntb=\numexpr(\@tempcnta-1)*2 %
  \@tempdimc=\dimexpr (\textwidth - \@tempcntb\tabcolsep) / \@tempcnta %
  \@tempcntb=\@tempcnta
  \def\@tempa{}%
  \loop\ifnum\@tempcnta>\z@
    %%%\edef\@tempa{\@tempa S[table-column-width=\the\@tempdimc]}% ???
    \edef\@tempa{\@tempa r}%
    \advance\@tempcnta\m@ne
  \repeat
  \edef\@tempa{\noexpand\begin{longtable}{@{}\@tempa @{}}}%
  \expandafter\ks@add\expandafter{\@tempa}%
  \ks@add{\\\toprule}%
  \ifx\relax#1\relax\else
Rolf Niepraschk's avatar
Rolf Niepraschk committed
    \ks@add{\multicolumn{\the\@tempcntb}{@{}c@{}}{#1}\\\toprule}%
  \ks@add{\bottomrule\end{longtable}}%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  %\endgroup
}

\newcommand*\printFirstPage{%
  \thispagestyle{empty}%
  \AddToShipoutPicture*{\ks@printFirstPage}%
  \mbox{}\clearpage
  \global\let\ks@printFirstPage\@empty
  \global\let\printFirstPage\@empty
}

\newcommand*\printLastPage{%
  \clearpage
  \global\let\ks@foot=\ks@@foot
  \ks@lastPage
}

\newcommand*\printResultTable{%
    \LTleft=\fill \LTright=\fill
  %\sisetup{table-format=1e+2,retain-zero-exponent,table-parse-only=false}%
    \sisetup{retain-zero-exponent,%table-figures-exponent=1,%
      table-number-alignment=center,
      table-text-alignment=center,
      table-format=1.6e+1,
      table-align-exponent,
      table-parse-only=true}%
}

\newcommand*\ks@applicant@table{%
  \begingroup
    \let\ks@tempa=\\%
    \let\\=\relax
    \ks@tab{}%
    \expandafter\@tfor\expandafter\ks@tempb\expandafter
      :\expandafter=\ks@applicant\do{%
      \expandafter\edef\expandafter\ks@tempb\expandafter{%
        \expandafter\trim@spaces\expandafter{\ks@tempb}}%
      \ifx\ks@tempb\@empty\else
        \expandafter\ks@add\expandafter{\ks@tempb\tabularnewline[.3ex]}%
      \fi  
    \let\\=\ks@tempa
    \begin{tabular}[t]{@{}l@{}}%
      \the\ks@tab
    \end{tabular}%
  \endgroup
}

Rolf Niepraschk's avatar
Rolf Niepraschk committed
    \AddToShipoutPictureBG{%
      \AtTextCenter{%
        \makebox(0,0)[c]{\resizebox{\textwidth}{!}{%
          \rotatebox{54.7}{%
            \textnormal{\textsf{\textbf{%
              \color{lightgray}\ks@draftName}}}}}}%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
      }%
  }{%
    \ifnum\number\ks@missingEntries>0 %
      \AddToShipoutPictureBG{%
        \AtTextCenter{%
          \makebox(0,0)[c]{\resizebox{\textwidth}{!}{%
            \rotatebox{54.7}{%
              \textnormal{\textsf{\textbf{%
                \color{lightgray}Fehler:~\ks@missingEntries}}}}}}%
        }%
      }%
    \fi  
  }
}

\RequirePackage[
% factor=1500
% ,verbose=true
,final=true
% ,letterspace=100
,babel=true
]{microtype}

\emergencystretch=1em %
\pagestyle{headings}

\renewcommand\section{%
  \@startsection{section}% name
  {1}% level
  {\z@}% indent
  {-3ex \@plus -.5ex \@minus -.2ex}% beforeskip (abs.!)
  {.6ex \@plus.2ex}%   afterskip
  {\ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
    \setlength{\parfillskip}{\z@ plus 1fil}\fi
    \raggedsection\normalfont\sectfont\nobreak\size@section}%
}

\endinput
%%
%% End of file `kailbrierschein.cls'.

sudo cp $(kpsewhich --var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf

sudo fc-cache -fsv

mkluatexfontdb --force --verbose=-1 -vvv