framed_environments.sty 2.2 KB
Newer Older
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
\ProvidesPackage{vorlage/framed_environments}
% implementation based on framed package by Donald Arseneau
% warning: floating environments (figure, table) must be placed outside of the framed environment
\RequirePackage{framed}
\RequirePackage{ifthen}

% this color is used for the shaded environment
\definecolor{shadecolor}{rgb}{0.63, 0.79, 0.95}
% this color is used for the leftbar environment
\definecolor{leftbarcolor}{rgb}{0, 0.5, 0}

% modify leftbar command to change the default color and position
\renewenvironment*{leftbar}{%
	\def\FrameCommand{\textcolor{leftbarcolor}{\hspace{-14pt}\vrule width 4pt \hspace{10pt}}}%
	\MakeFramed{\advance \hsize - \width \FrameRestore}%
}{%
	\endMakeFramed%
}

% helper commands for defining shaded environment
\newcommand*{\shadedbegin}[2]{
	\begin{shaded}
		% remove space above and below theorem environment
		\setlength\topsep{0pt}
		% handle optional argument to theorem environment
		\ifthenelse{\equal{#2}{}}{\begin{#1}}{\begin{#1}[#2]}%
}
\newcommand*{\shadedend}[1]{%
		\end{#1}%
	\end{shaded}%
}

% helper commands for defining leftbar environment
\newcommand*{\leftbarbegin}[2]{
	\begin{leftbar}
		% remove space above and below theorem environment
		\setlength\topsep{0pt}
		% handle optional argument to theorem environment
		\ifthenelse{\equal{#2}{}}{\begin{#1}}{\begin{#1}[#2]}%
}
\newcommand*{\leftbarend}[1]{%
		\end{#1}%
	\end{leftbar}%
}

% Definition
\newtheorem{idefinition}{Definition}[chapter]
\newenvironment{definition}[1][]{\shadedbegin{idefinition}{#1}}{\shadedend{idefinition}}

% Lemma
\newtheorem{ilemma}{Lemma}[chapter]
\newenvironment{lemma}[1][]{\shadedbegin{ilemma}{#1}}{\shadedend{ilemma}}

% Satz
\newtheorem{itheorem}{Satz}[chapter]
\newenvironment{theorem}[1][]{\shadedbegin{itheorem}{#1}}{\shadedend{itheorem}}

% Annahme
\newtheorem{iassumption}{Annahme}[chapter]
\newenvironment{assumption}[1][]{\shadedbegin{iassumption}{#1}}{\shadedend{iassumption}}

% Aufgabe
\newtheorem{iexercise}{\color{leftbarcolor}Aufgabe}[chapter]
\newenvironment{exercise}[1][]{\leftbarbegin{iexercise}{#1}}{\leftbarend{iexercise}}

% Beispiel
\newtheorem{iexample}{\color{leftbarcolor}Beispiel}[chapter]
\newenvironment{example}[1][]{\leftbarbegin{iexample}{#1}}{\leftbarend{iexample}}