-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsopra-documentation.sty
71 lines (63 loc) · 3.16 KB
/
sopra-documentation.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% Version: 1.0
% Author: Florian Sihler, 02.12.2019
% Will contain all the definitions and packages to be used in the documentation
% of all the other sopra-* packages
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sopra-documentation}[2019/12/02 EagleoutIce - documentation for the sopra-team-020]
% Lengths and Registers
\newcounter{sodversion} \setcounter{sodversion}{1102}
\newif\ifsod@usedummy@
\newif\ifsod@uselistings@
% Package-Args
% allow debug-options :D
\DeclareOption{debug}{\errorcontextlines99999}
\DeclareOption{nodebug}{\errorcontextlines4}
\DeclareOption{dummy}{\sod@usedummy@true}
\DeclareOption{nodummy}{\sod@usedummy@false}
\DeclareOption{listings}{\sod@uselistings@true}
\DeclareOption{nolistings}{\sod@uselistings@false}
\ExecuteOptions{nodebug,dummy,listings}% set it explicitly
\ProcessOptions\relax
% Basic Packages
\ifsod@usedummy@ \RequirePackage{blindtext} \fi % only for testing and stuff :D
\RequirePackage{attachfile2,multicol,xcolor,csquotes}% including files :D
\@ifundefined{thesobversion}{% not called from sopra-base-class
\RequirePackage{hyperref}}{}
\attachfilesetup{author={Florian Sihler},color=0.6392 0.149 0.2314,icon=Tag,mimetype=text/plain}
\def\email#1{\href{mailto:#1}{#1}}
\ifsod@uselistings@
\RequirePackage{sopra-listings}
\solLoadLanguage{latex,bash}
\fi
% Helper Methods
\def\sod@thesodversion#1#2#3#4\@nil{{v#1.#2.#3#4}}
\edef\sod@version@str{\noexpand\sod@thesodversion\arabic{sodversion}\noexpand\@nil}
\edef\thesodversion{\sod@version@str}
% Commands and Environments
\def\manArg#1{\T{\{#1\}}}
\def\optArg#1{\T{\itshape[#1]}}
\def\optFlag#1{\T{\itshape$\langle$*$\rangle$}}
\def\optStar{\optFlag*}
\def\cmd#1{\solGet{command}{\textbackslash#1}}
\def\env#1{\solGet{keywordC}{env@#1}}
\def\cmdref#1{\hyperref[mrk:#1]{\solGet{command}{\textbackslash#1}}\textsuperscript{$\rightarrow$\thinspace p. \pageref{mrk:#1}}}
\def\envref#1{\hyperref[mrk:#1]{\solGet{keywordC}{env@#1}}\textsuperscript{$\rightarrow$\thinspace p. \pageref{mrk:#1}}}
% #2 counter
\def\argref#1#2{\hyperref[mrk:#1]{\T{#1 (#2)}}\textsuperscript{$\rightarrow$\thinspace p. \pageref{mrk:#1}}}
% only shows second
\def\firstargref#1#2{\hyperref[mrk:#1]{\T{#1}}\textsuperscript{$\rightarrow$\thinspace p. \pageref{mrk:#1}}}
\def\secondargref#1#2{\hyperref[mrk:#1]{\T{#2}}\textsuperscript{$\rightarrow$\thinspace p. \pageref{mrk:#1}}}
% #1: name of the present-sequence #2: Args of the present-sequence #3: presenter style #4: prefix of cs-name
\newenvironment{present}[4]{\phantomsection\label{mrk:#1}%
\begingroup\leavevmode\newline\noindent\hspace*{-.75cm}\parbox{.75cm}{$\triangleright$\quad}{#3{#4#1}}{\T{#2}}\par\nopagebreak% done on purpose
}{\endgroup\bigskip}
% #1: name of the command-sequence #2: Args of the command-sequence
\newenvironment{command}[2]{\present{#1}{#2}{\solGet{command}}{\textbackslash}}{\endpresent}
% #1: name of the environment #2: Args of the environment
\newenvironment{environment}[2]{\present{#1}{#2}{\solGet{keywordC}}{env@}}{\endpresent}
% #1: name of the arg #2: name of the counter-Arg
\newenvironment{argument}[2]{\present{#1}{\qquad(\T{#2})}{\T}{}}{\endpresent}
% Comfort-Methods and linkers
\let\say\enquote
\newcommand*\jmark[2][Linkname]{\hyperref[#2]{#1}}
\endinput