Skip to content
Snippets Groups Projects
teckids2style.sty 15.38 KiB
% Teckids e.V. — Allgemeine Vorlage, Version 2
%-
% Copyright © 2013, 2015
%	Dominik George <dominik.george@teckids.org>
% Copyright © 2014, 2015, 2017, 2018
%	Thorsten “mirabilos” Glaser <thorsten.glaser@teckids.org>
% Copyright © 2015, 2016, 2017
%	Thorsten Glaser <t.glaser@tarent.de>
% Copyright © 2015
%	Niklas Bildhauer <niklas.bildhauer@teckids.org>
% with contributions by (among others)
%	Steven B. Segletes <http://tex.stackexchange.com/users/25858>
%	Enrico Gregorio <http://tex.stackexchange.com/users/4427>
%	David Carlisle <http://tex.stackexchange.com/users/1090>
%
% Provided that these terms and disclaimer and all copyright notices
% are retained or reproduced in an accompanying document, permission
% is granted to deal in this work without restriction, including un‐
% limited rights to use, publicly perform, distribute, sell, modify,
% merge, give away, or sublicence.
%
% This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
% the utmost extent permitted by applicable law, neither express nor
% implied; without malicious intent or gross negligence. In no event
% may a licensor, author or contributor be held liable for indirect,
% direct, other damage, loss, or other issues arising in any way out
% of dealing in the work, even if advised of the possibility of such
% damage or existence of a defect, except proven that it results out
% of said person's immediate fault when using the work as intended.

% Characters requiring escaping:
% • { } # & _ % $ ⇒ quote by prepending a backslash \
% • \ → \textbackslash
% • ^ → \textasciicircum
% • ~ → \textasciitilde
% • (nbsp) → ~
% • (em dash) → \dash

\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{teckids2style}[2018/08/12 1.8 Teckids TeX/LaTeX style, second epoch]% Teχ/LᴬTᴇX

\RequirePackage{accsupp}%
\RequirePackage[utf8]{inputenc}%
\RequirePackage[british,ngerman,shorthands=off,safe=none,math=normal,main=ngerman,headfoot=ngerman,hyphenmap=other*]{babel}%
\RequirePackage[usenames,dvipsnames,table]{xcolor}%
\RequirePackage[LY1,TS1,T1]{fontenc}%
\RequirePackage{pdf14}%
\RequirePackage[paperwidth=21truecm,paperheight=29.7truecm,includehead,hmargin=1.75cm,top=0.3cm,bottom=2.2cm,headheight=1cm,headsep=0.5cm,footskip=0.8cm,marginparsep=2.5mm]{geometry}%
\RequirePackage{fancybox}%
\linespread{1.15}%
\RequirePackage[varqu,varl]{inconsolata}%
\RequirePackage{longtable}%
\RequirePackage{tabu}%
\RequirePackage{multirow}%
\renewcommand{\multirowsetup}{}%
\RequirePackage{wrapfig}%
\setlength{\intextsep}{0pt}%
\RequirePackage{intcalc}%
\RequirePackage[writefile]{listings}%
\RequirePackage{tocloft}%
\RequirePackage{float}%
\RequirePackage[totpages,user]{zref}%
\RequirePackage{calc}%
\RequirePackage{ifthen}%
\RequirePackage[noadjust]{marginnote}%
\RequirePackage{unicodedomino}%
\RequirePackage{unicodepoints}%
\RequirePackage{framed}%
\RequirePackage[export]{adjustbox}%
\RequirePackage[section]{placeins}%
\RequirePackage[pdftex,unicode]{hyperref}%

\definecolor{teckidsorangedark}{HTML}{FF6600}%
\definecolor{teckidsorangelight}{HTML}{FF9955}%
\definecolor{teckidsbluegradientlight}{HTML}{00CBFA}%
\definecolor{teckidsbluegradientdark}{HTML}{0606FA}%
\definecolor{teckidsbluestroke}{HTML}{005EBE}%
\definecolor{teckidsSTYlstbackground}{HTML}{E6E6E6}%
\definecolor{teckidsSTYlstlineno}{HTML}{444444}%
\definecolor{teckidsSTYlstmargin}{HTML}{707070}%

\newcommand{\teckidslogo}[1][10cm]{\includegraphics[width=#1]{teckids_logo}}%

\hypersetup{
	colorlinks = true,
	linkcolor = teckidsbluestroke,
	urlcolor = teckidsbluestroke,
	citecolor = teckidsbluestroke,
	pdfauthor = {Teckids e.V.}
}%

% Set default page style
\pagestyle{fancy}%
\addtokomafont{pageheadfoot}{\upshape}%
\addtokomafont{pagenumber}{\itshape}%
% Bitte gerne neudefinieren, zum Beispiel…
\newcommand{\dokumentLizenzlogo}{}%
\newcommand{\dokumentLizenztext}{%
 Freies Material unter einer Freien Lizenz\linebreak%
 Für Details kontaktieren Sie bitte den Teckids e.V.%
}%
% … hiermit:
\newcommand{\dokumentLizenzCCBYSAthreeDE}{%
 \renewcommand{\dokumentLizenzlogo}{%
  % see https://creativecommons.org/licenses/by-sa/3.0/de/
  \includegraphics[width=3cm,valign=t]{cc-by-sa}%
 }%
 \renewcommand{\dokumentLizenztext}{%
  Veröffentlicht unter der \textit{Creative Commons Namensnennung \dash\linebreak%
  Weitergabe unter gleichen Bedingungen 3.0 Deutschland} Lizenz.%
 }%
}%
\newcommand{\dokumentLizenzCCBYSAfour}{%
 \renewcommand{\dokumentLizenzlogo}{%
  % see https://creativecommons.org/licenses/by-sa/4.0/
  \includegraphics[width=3cm,valign=t]{cc-by-sa}%
 }%
 \renewcommand{\dokumentLizenztext}{%
  Veröffentlicht unter der \textit{Creative Commons Namensnennung \dash\linebreak%
  Weitergabe unter gleichen Bedingungen 4.0 International} Lizenz.%
 }%
}%
\newcommand{\dokumentLizenzLGPLorCCBYSAfour}{%
 \dokumentLizenzCCBYSAfour{}%
 \renewcommand{\dokumentLizenztext}{%
  Duallizensiert unter GNU LGPL 2.0 (oder neuer) und CC-BY-SA 4.0.%
 }%
}%
\newcommand{\dokumentLizenzMirOS}{%
 \renewcommand{\dokumentLizenzlogo}{%
  \mbox{%
   \makebox(0,0){\hspace{1em}\LARGE ✓}\hspace{2em}\makebox[0pt]{%
    \raisebox{-1.5\height}{\hspace{-0.75em}\textsc{copy}}%
   }\raisebox{-0.2\height}{\tiny\hspace{-2em}OK to}%
  }%
 }%
 \renewcommand{\dokumentLizenztext}{%
  Veröffentlicht unter der MirOS-Lizenz.%
 }%
}%
\newcommand{\dokumentLizenzMirOSorCCBYfour}{%
 \dokumentLizenzMirOS{}%
 \renewcommand{\dokumentLizenztext}{%
  Duallizensiert unter der MirOS-Lizenz und CC-BY 4.0.%
 }%
}%
\newcommand{\dokumentLizenzCCBYfour}{%
 \renewcommand{\dokumentLizenzlogo}{%
  % see https://creativecommons.org/licenses/by/4.0/
  \includegraphics[width=3cm,valign=t]{cc-by}%
 }%
 \renewcommand{\dokumentLizenztext}{%
  Veröffentlicht unter der \textit{Creative Commons \dash
  Namensnennung 4.0} Lizenz.\hspace{1cm}% (hspace is a hack)
 }%
}%
% Syntax: \teckidshdr[2017 Name,]{Dokumenttitel}
\newcommand{\teckidshdr}[2][]{%
 \fancyhf{}%
 \renewcommand{\headrulewidth}{0pt}%
 \renewcommand{\footrulewidth}{1pt}%
 \renewcommand*\pagemark{\leavevmode\usekomafont{pagenumber}\ifnum\ztotpages=1\else\thepage/\ztotpages\fi}%
 \fancyhead[L]{\leavevmode\usekomafont{pageheadfoot}\itshape\Large #2}%
 \fancyhead[R]{\leavevmode\usekomafont{pageheadfoot}\pagemark}%
 \fancyfoot[L]{\leavevmode\usekomafont{pageheadfoot}\dokumentLizenzlogo}%
 \fancyfoot[C]{\leavevmode\usekomafont{pageheadfoot}{\footnotesize%
  \textcopyright{} #1 Teckids e.V.\linebreak%
  \dokumentLizenztext%
 }}%
 \fancyfoot[R]{\leavevmode\usekomafont{pageheadfoot}%
  \includegraphics[width=4cm,valign=t]{teckids_logo}%
 }%
}%
\teckidshdr{\headmark}%

% Hurenkinder und Schusterjungen
\clubpenalty10000%
\widowpenalty10000%
\displaywidowpenalty=10000%
% Zu lange Zeilen
\emergencystretch 5em%

% Allgemeine Einstellungen

\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg}%

\unitlength=1mm%

\setlength{\parskip}{0.3cm plus 5mm minus 1mm}%
\setlength{\parindent}{0cm}%

% Extra-Befehle

\newcommand{\ankreuzen}{Bitte zum Beispiel so → \CheckedBox\hspace{0.05cm} ← ankreuzen!}%
\newcommand{\angekreuzteskaestchen}{\CheckedBox\hspace{0.1cm}}%
\newcommand{\ankreuzkaestchen}{\Square\hspace{0.1cm}}%

% Inhaltsverzeichnis
\addtocontents{toc}{\protect\thispagestyle{fancy}}%
\addtolength{\cftsubsecnumwidth}{0.5em}%
\addtolength{\cftsubsubsecindent}{0.5em}%
% default: 10pt plus 1pt
\setlength{\cftbeforesecskip}{10pt plus 4pt minus 2pt}%
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}%
% when calling, ensure blank line before and after!
\newcommand{\inhaltsverzeichnis}{%
 \hypersetup{linkcolor = black}%
 % deliberately no % at end of line!
 \tableofcontents
 \hypersetup{linkcolor = teckidsbluestroke}%
 % deliberately no % at end of line!
 \newpage
}%

% Listings

\makeatletter%
\newcounter{lstdumps}%
\setcounter{lstdumps}{0}%
\newcommand{\lstdumpname}{}%
\xdef\lstdumpsection{\@empty}%
\lstnewenvironment{lstdump}[3][]%
	{\lst@TestEOLChar{#3}%
	 \lstset{#1}%
	 \csname\@lst @SetFirstNumber\endcsname%
	 \stepcounter{lstdumps}%
	 \marginnote{{\LARGE\color{teckidsSTYlstmargin}\thelstdumps}}[4pt]%
	 \renewcommand{\lstdumpname}{ (#2)}%
	 \lst@BeginAlsoWriteFile{\jobname.lst}%
	 \ifx\lstdumpsection\@currentlabel\else%
	  \ifx\lstdumpsection\@empty%
	   \immediate\write\lst@WF{Listing dump for \jobname.tex}%
	   \immediate\write\lst@WF{}%
	  \fi%
	  \immediate\write\lst@WF{>>> (\@currentlabel) \@currentlabelname}%
	  \immediate\write\lst@WF{}%
	 \fi%
	 \immediate\write\lst@WF{-----BEGIN LISTING \thelstdumps\lstdumpname-----}%
	}%
	{%
	 \immediate\write\lst@WF{-----END LISTING \thelstdumps\lstdumpname-----}%
	 \immediate\write\lst@WF{}%
	 \endgroup%
	 \csname\@lst @SaveFirstNumber\endcsname%
	 \xdef\lstdumpsection{\@currentlabel}%
	}%
\lstnewenvironment{lstdump*}[3][]%
	{\lst@TestEOLChar{#3}%
	 \lstset{#1}%
	 \csname\@lst @SetFirstNumber\endcsname%
	 \renewcommand{\lstdumpname}{"#2"}%
	 \lst@BeginAlsoWriteFile{\jobname.lst}%
	 \ifx\lstdumpsection\@currentlabel\else%
	  \ifx\lstdumpsection\@empty%
	   \immediate\write\lst@WF{Listing dump for \jobname.tex}%
	   \immediate\write\lst@WF{}%
	  \fi%
	  \immediate\write\lst@WF{>>> (\@currentlabel) \@currentlabelname}%
	  \immediate\write\lst@WF{}%
	 \fi%
	 \immediate\write\lst@WF{-----BEGIN LISTING \lstdumpname-----}%
	}%
	{%
	 \immediate\write\lst@WF{-----END LISTING \lstdumpname-----}%
	 \immediate\write\lst@WF{}%
	 \endgroup%
	 \csname\@lst @SaveFirstNumber\endcsname%
	 \xdef\lstdumpsection{\@currentlabel}%
	}%
\lstnewenvironment{lstdumpx}[2][]%
	{\lst@TestEOLChar{#2}%
	 \lstset{#1}%
	 \csname\@lst @SetFirstNumber\endcsname%
	 \stepcounter{lstdumps}%
	 \marginnote{{\LARGE\color{teckidsSTYlstmargin}\thelstdumps}}[4pt]%
	 \renewcommand{\lstdumpname}{ [unnamed]}%
	 \lst@BeginAlsoWriteFile{\jobname.lst}%
	 \ifx\lstdumpsection\@currentlabel\else%
	  \ifx\lstdumpsection\@empty%
	   \immediate\write\lst@WF{Listing dump for \jobname.tex}%
	   \immediate\write\lst@WF{}%
	  \fi%
	  \immediate\write\lst@WF{>>> (\@currentlabel) \@currentlabelname}%
	  \immediate\write\lst@WF{}%
	 \fi%
	 \immediate\write\lst@WF{-----BEGIN LISTING \thelstdumps\lstdumpname-----}%
	}%
	{%
	 \immediate\write\lst@WF{-----END LISTING \thelstdumps\lstdumpname-----}%
	 \immediate\write\lst@WF{}%
	 \endgroup%
	 \csname\@lst @SaveFirstNumber\endcsname%
	 \xdef\lstdumpsection{\@currentlabel}%
	}%
% usage: \lstdumpesc[file]{pdf} or \lstdumpesc{bothfileandpdf}
\def\lstdumpesc{\@ifnextchar[{\lstdumpesc@two}{\lstdumpesc@one}}%
\def\lstdumpesc@one#1{\lst@WFAppend{#1}#1}%
\def\lstdumpesc@two[#1]#2{\lst@WFAppend{#1}#2}%

\lstset{
	backgroundcolor=\color{teckidsSTYlstbackground},
	breakatwhitespace=true,
	rulecolor=\color{black},
	basicstyle=\ttfamily,
	upquote=true,
	keepspaces,
	literate=
		{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
		{Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
		{à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1
		{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
		{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
		{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
		{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
		{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
		{æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 {œ}{{\oe}}1 {Œ}{{\OE}}1
		{ő}{{\H{o}}}1 {Ő}{{\H{O}}}1 {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1
		{å}{{\r a}}1 {Å}{{\r A}}1 {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1
		{©}{{\textcopyright}}1 {™}{\texttrademark}1 {§}{\S}1
		{£}{{\pounds}}1 {°}{\textdegree{}}1 {„}{{\quotedblbase}}1
		{“}{{\textquotedblleft}}1 {”}{{\textquotedblright}}1
		{‘}{{\textquoteleft}}1 {’}{{\textquoteright}}1
		{«}{\guillemotleft}1 {»}{\guillemotright}1
		{€}{{\fontencoding{LY1}\selectfont\symbol{'001}}}1
		{‐}{-}1 {‑}{-}1 {‒}{-}1 {–}{-}1 {—}{-}1 {―}{-}1
		{…}{{\fontencoding{LY1}\selectfont\symbol{'205}}}1,
	columns=flexible,
	showstringspaces=false,
	extendedchars=true,
	breaklines=true,
	prebreak=\unicodepoints@flipsym{\color{red}\ding{229}},
	frame=single,
	showtabs=false,
	showspaces=false,
	showstringspaces=false,
	escapeinside={〈}{〉},
	keywordstyle=\color{teckidsbluestroke},
	commentstyle=\color{ForestGreen},
	stringstyle=\color{teckidsorangedark},
	% für 〔Paßwörter〕 und 「variable Texte」 in Listings
	% (wird bei Benutzung der language-Option in einem Listing entfernt)
	moredelim={[is][\color{ForestGreen}]{〔}{〕}},
	moredelim={*[is][\color{teckidsorangedark}]{「}{」}},
	% Zeilennummern
	numbers=left,
	numberstyle=\ttfamily\color{teckidsSTYlstlineno},
	xleftmargin=24pt,
	numbersep=12pt,
}%
\makeatother%

% Use pxfonts by default
\renewcommand{\sfdefault}{pxss}%
% sans-serif fonts should not use italic as emphasis
\renewcommand{\emph}[1]{\textbf{#1}}%
% Use Comic Sans MS as “roman” font, because we have to use the
% sans-serif font always, and like this, we spot errors easily
\renewcommand{\rmdefault}{comic}%
% default font is sans-serif, i.e. pxfonts
\renewcommand*{\familydefault}{\sfdefault}%

% em dash
\def\dash{\unskip\kern.16667em\textemdash\penalty\exhyphenpenalty\hskip.16667em\relax}%
% for footnotes
\newcommand{\Hair}{\kern.16667em}%

% for lead paragraph before IT-Mieze
\makeatletter%
\newcommand{\keinumbruch}{\par\nobreak\@afterheading}%
\makeatother%

% for nice inline pictures in boxen with rounded corners
\makeatletter%
% fbox and ovalbox line will be inside the box
\setlength{\fboxsep}{-2\fboxrule}%
% to calculate horizontal padding inside the frame
\newdimen{\inlinebildsep}%
% to store dimensions of box without padding
\newsavebox{\inlinebildbox}%
\newcommand{\inlinebild}[2][\@empty]{%
 % first, generate a box with square content and w/o padding
 \savebox{\inlinebildbox}{\ovalbox{\strut\hspace{1.25ex}}}%
 % get its real height (Teχ height + depth)
 \inlinebildsep=\ht\inlinebildbox%
 \advance\inlinebildsep by \dp\inlinebildbox%
 % subtract its real width
 \advance\inlinebildsep by -\wd\inlinebildbox%
 % we want half of it on either side
 \divide\inlinebildsep by 2%
 % now render the actual box
 \ovalbox{%
  % left padding
  \hspace{\inlinebildsep}%
  % ensure standard height
  \strut%
  % the graphic
  \resizebox{!}{1.25ex}{\includegraphics{#2}}%
  % the text, if any
  \ifx#1\@empty\else{ #1}\fi%
  % right padding
  \hspace{\inlinebildsep}%
}}%
\makeatother%

% for nice inline boxen with square corners
\makeatletter%
\newcommand{\inlinekasten}[1]{%
 % first, generate a box with square content and w/o padding
 \savebox{\inlinebildbox}{\fbox{\strut\hspace{1.25ex}}}%
 % get its real height (Teχ height + depth)
 \inlinebildsep=\ht\inlinebildbox%
 \advance\inlinebildsep by \dp\inlinebildbox%
 % subtract its real width
 \advance\inlinebildsep by -\wd\inlinebildbox%
 % we want half of it on either side
 \divide\inlinebildsep by 2%
 % now render the actual box
 \fbox{%
  % left padding
  \hspace{\inlinebildsep}%
  % ensure standard height
  \strut%
  % the text
  #1%
  % right padding
  \hspace{\inlinebildsep}%
}}%
\makeatother%

\makeatletter%
% \hyperfootnotetext is what \footnotetext is supposed to be:
% like \footnote except not rendering anything (it will not
% generate a paragraph if you append % to all lines)
\newcommand\hyperfootnotetext[1]{%
 % new local scope
 {%
  % temporarily redefine this macro to empty
  \renewcommand{\@makefnmark}{}%
  % temporarily prevent leaving vmode
  \renewcommand{\leavevmode}{}%
  % this also means we cannot create a(n empty) hyperlink
  \renewcommand{\hyper@linkstart}[2]{}%
  \renewcommand{\hyper@linkend}{}%
  % call the original \footnote macro
  \footnote{#1}%
  % exit the local scope with the redefined macro
 }%
 % end of command
}%
\makeatother%

% uncomment to figure out overfull hbox
%\overfullrule=2cm