Verified Commit bd6bca52 authored by Adrian C. Hinrichs's avatar Adrian C. Hinrichs
Browse files

Implement the Table of Contents


Signed-off-by: Adrian C. Hinrichs's avatarACHinrichs <adrian-corin.hinrichs@gmx.de>
parent 8a82772c
......@@ -40,7 +40,9 @@
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{HomeworkAssignment}
[2017/04/29 v1.4 HomeworkAssignment]
\RequirePackage{kvoptions}
\DeclareStringOption[alph]{subproblemSty}
\DeclareStringOption[roman]{subsubproblemSty}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax \LoadClass{article}
\RequirePackage{suffix} \RequirePackage{fancyhdr}
......@@ -92,7 +94,9 @@
{-2em \@plus -1em \@minus -1em}%beforeskip
{1ex \@plus .5ex}%afterskip
{\normalfont\Large\bfseries}%style
*{#1}}
*{#1}
\addcontentsline{toc}{section}{#1}
}
\newcommand{\subproblem}[1]{\@startsection{subproblem}%Name
{2}%Level
......@@ -100,7 +104,9 @@
{-1em \@plus -.5em \@minus -.5em}%beforeskip
{.5ex \@plus .5ex}%afterskip
{\normalfont\large\bfseries}%style
*{#1}}
*{#1}
\addcontentsline{toc}{subsection}{#1}
}
\newcommand{\subsubproblem}[1]{\@startsection{subsubproblem}%Name
{3}%Level
......@@ -108,7 +114,8 @@
{-.5em}%beforeskip
{.5em}%afterskip
{\normalfont\bfseries}%style
*{#1}}
*{#1}
}
\newcommand{\solution}[1][]{\@startsection{solution}%Name
{4}%Level
......@@ -116,7 +123,8 @@
{-.1em}%beforeskip
{\z@}%afterskip
{\normalfont\bfseries}%style
*{L\"osung\ifthenelse{\equal{#1}{}} {} { #1}:~~ } }
*{L\"osung\ifthenelse{\equal{#1}{}} {} { #1}:~~ }
}
\newcommand{\proof}[1][]{\@startsection{proof}%Name
{4}%Level
......@@ -124,7 +132,8 @@
{-.1em}%beforeskip
{\z@}%afterskip
{\normalfont\bfseries}%style
*{Beweis\ifthenelse{\equal{#1} {} } {} { #1}:~~ } }
*{Beweis\ifthenelse{\equal{#1} {} } {} { #1}:~~ }
}
\newcommand{\newproblem}[1][]{\stepcounter{problem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{problem}{#1}}
\problem{Aufgabe \arabic{problem}} }
......@@ -135,7 +144,7 @@
\newcommand{\newsubsubproblem}[1][]{\stepcounter{subsubproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subsubproblem}{#1}}
\subproblem{\roman{subsubproblem})} }
\subsubproblem{\roman{subsubproblem})} }
\endinput
%%
......
......@@ -135,7 +135,9 @@
% and sets the Version
% Loads the \texttt{article}, which is the base-class.
% \begin{macrocode}
\RequirePackage{kvoptions}
\DeclareStringOption[alph]{subproblemSty}
\DeclareStringOption[roman]{subsubproblemSty}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax \LoadClass{article}
% \end{macrocode}
......@@ -228,7 +230,9 @@
{-2em \@plus -1em \@minus -1em}%beforeskip
{1ex \@plus .5ex}%afterskip
{\normalfont\Large\bfseries}%style
*{#1}}
*{#1}
\addcontentsline{toc}{section}{#1}
}
\newcommand{\subproblem}[1]{\@startsection{subproblem}%Name
{2}%Level
......@@ -236,7 +240,9 @@
{-1em \@plus -.5em \@minus -.5em}%beforeskip
{.5ex \@plus .5ex}%afterskip
{\normalfont\large\bfseries}%style
*{#1}}
*{#1}
\addcontentsline{toc}{subsection}{#1}
}
\newcommand{\subsubproblem}[1]{\@startsection{subsubproblem}%Name
{3}%Level
......@@ -244,7 +250,8 @@
{-.5em}%beforeskip
{.5em}%afterskip
{\normalfont\bfseries}%style
*{#1}}
*{#1}
}
\newcommand{\solution}[1][]{\@startsection{solution}%Name
{4}%Level
......@@ -252,7 +259,8 @@
{-.1em}%beforeskip
{\z@}%afterskip
{\normalfont\bfseries}%style
*{L\"osung\ifthenelse{\equal{#1}{}} {} { #1}:~~ } }
*{L\"osung\ifthenelse{\equal{#1}{}} {} { #1}:~~ }
}
\newcommand{\proof}[1][]{\@startsection{proof}%Name
{4}%Level
......@@ -260,7 +268,8 @@
{-.1em}%beforeskip
{\z@}%afterskip
{\normalfont\bfseries}%style
*{Beweis\ifthenelse{\equal{#1} {} } {} { #1}:~~ } }
*{Beweis\ifthenelse{\equal{#1} {} } {} { #1}:~~ }
}
% \end{macrocode}
%
% Defines \enquote*{better} sectioning commands. See
......@@ -277,7 +286,7 @@
\newcommand{\newsubsubproblem}[1][]{\stepcounter{subsubproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subsubproblem}{#1}}
\subproblem{\roman{subsubproblem})} }
\subsubproblem{\roman{subsubproblem})} }
% \end{macrocode}
%
......
No preview for this file type
%%
%% This is file `HomeworkAssignment.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% HomeworkAssignment.dtx (with options: `class')
%% Copyright (c) 2017 by Adrian C. Hinrichs
%%
%% This File may be distributed and/or modified under the condition of the below
%% license.
%%
%%
%% MIT License
%%
%%
%%
%% Copyright (c) 2017
%%
%%
%%
%% Permission is hereby granted, free of charge, to any person obtaining a copy
%% of this software and associated documentation files (the "Software"), to deal
%% in the Software without restriction, including without limitation the rights
%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%% copies of the Software, and to permit persons to whom the Software is
%% furnished to do so, subject to the following conditions:
%%
%% The above copyright notice and this permission notice shall be included in all
%% copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
%% SOFTWARE.
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesClass{HomeworkAssignment}
[2017/04/29 v1.4 HomeworkAssignment]
\RequirePackage{kvoptions}
\DeclareStringOption[alph]{subproblemSty}
\DeclareStringOption[roman]{subsubproblemSty}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions \relax \LoadClass{article}
\RequirePackage{suffix} \RequirePackage{fancyhdr}
\RequirePackage{ifthen}
\fancypagestyle{firstpage}{
%
\fancyhf{}
% clear all six fields
\renewcommand{\headrulewidth}{.7pt}
\renewcommand{\footrulewidth}{0pt} \fancyfoot[RE,LO]{\thepage}
\fancyhead[L]{\hwa@tutorium } \fancyhead[R]{\@date } }
\fancypagestyle{followingpage}{
%
\fancyhf{}
% clear all six fields
\fancyhead[RE,LO]{\@author} \fancyhead[LE,RO]{\hwa@kurs\\ Abgabe:
\hwa@abgabe} \fancyfoot[RE,LO]{\thepage}
\renewcommand{\headrulewidth}{0.7pt}
\renewcommand{\footrulewidth}{0pt} } \pagestyle{followingpage}
\AtBeginDocument{ \thispagestyle{firstpage}
\setlength{\headheight}{25pt} }
\newcommand{\hwa@kurs}{Kein Kurs}
\newcommand{\subject}[1]{\renewcommand{\hwa@kurs}{#1}}
\newcommand{\kurs}[1]{\subject{#1}}
\newcommand{\hwa@tutorium}{}
\newcommand{\tutorial}[1]{\renewcommand{\hwa@tutorium}{#1}}
\newcommand{\tutorium}[1]{\tutorial{#1}}
\newcommand{\hwa@abgabe}{\today}
\newcommand{\deadline}[1]{\def\hwa@abgabe{#1}}
\newcommand{\abgabe}[1]{\deadline{#1}}
\renewcommand{\maketitle} {
\begin{centering}
\huge{\textbf{\hwa@kurs}} {\hrule height 2pt} \vspace{.25cm}
\large
Abgabe: \hwa@abgabe\\
\vspace{.5cm} \hrule \vspace{.25cm}
\normalsize{\@author}\\
\vspace{.25cm} \hrule \vspace{.25cm} \normalsize
\end{centering}
}
\newcounter{problem} \setcounter{problem}{0}
\newcounter{subproblem}[problem] \setcounter{subproblem}{0}
\newcounter{subsubproblem}[subproblem] \setcounter{subsubproblem}{0}
\newcommand{\problem}[1]{\@startsection{problem}%Name
{1}%Level
{\z@}%indent
{-2em \@plus -1em \@minus -1em}%beforeskip
{1ex \@plus .5ex}%afterskip
{\normalfont\Large\bfseries}%style
*{#1}
\addcontentsline{toc}{section}{#1}
}
\newcommand{\subproblem}[1]{\@startsection{subproblem}%Name
{2}%Level
{\z@}%indent
{-1em \@plus -.5em \@minus -.5em}%beforeskip
{.5ex \@plus .5ex}%afterskip
{\normalfont\large\bfseries}%style
*{#1}
\addcontentsline{toc}{subsection}{#1}
}
\newcommand{\subsubproblem}[1]{\@startsection{subsubproblem}%Name
{3}%Level
{\z@}%indent
{-.5em}%beforeskip
{.5em}%afterskip
{\normalfont\bfseries}%style
*{#1}
}
\newcommand{\solution}[1][]{\@startsection{solution}%Name
{4}%Level
{\parindent}%indent
{-.1em}%beforeskip
{\z@}%afterskip
{\normalfont\bfseries}%style
*{L\"osung\ifthenelse{\equal{#1}{}} {} { #1}:~~ }
}
\newcommand{\proof}[1][]{\@startsection{proof}%Name
{4}%Level
{\parindent}%indent
{-.1em}%beforeskip
{\z@}%afterskip
{\normalfont\bfseries}%style
*{Beweis\ifthenelse{\equal{#1} {} } {} { #1}:~~ }
}
\newcommand{\newproblem}[1][]{\stepcounter{problem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{problem}{#1}}
\problem{Aufgabe \arabic{problem}} }
\newcommand{\newsubproblem}[1][]{\stepcounter{subproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subproblem}{#1}}
\subproblem{Aufgabe \arabic{problem}.\alph{subproblem}} }
\newcommand{\newsubsubproblem}[1][]{\stepcounter{subsubproblem}
\ifthenelse{\equal{#1}{}} { } {\setcounter{subsubproblem}{#1}}
\subsubproblem{\roman{subsubproblem})} }
\endinput
%%
%% End of file `HomeworkAssignment.cls'.
\documentclass[a4paper,twoside,subproblemSty=numeral]{HomeworkAssignment}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{%
arrows,%
shapes.misc,% wg. rounded rectangle
shapes.arrows,%
chains,%
matrix,%
positioning,% wg. " of "
scopes,%
decorations.pathmorphing,% /pgf/decoration/random steps | erste Graphik
shadows%
}
\usepackage{amsmath}
\usepackage[autostyle,german = guillemets]{csquotes}
\author{Autor Eins 1701\\ Autor Zwei 74656}
\date{\today}
\deadline{\today}
\tutorial{\"Ubungsgruppe 42}
\subject{Programmierung}
\begin{document}
\tikzset{
nonterminal/.style={
% The shape:
rectangle,
% The size:
minimum size=6mm,
% The border:
very thick,
draw=red!50!black!50, % 50% red and 50% black,
% and that mixed with 50% white
% The filling:
top color=white, % a shading that is white at the top...
bottom color=red!50!black!20, % and something else at the bottom
% Font
font=\itshape
},
terminal/.style={
% The shape:
rounded rectangle,
minimum size=6mm,
% The rest
very thick,draw=black!50,
top color=white,bottom color=black!20,
font=\ttfamily},
skip loop/.style={to path={-- ++(0,#1) -| (\tikztotarget)}}
}
{
\tikzset{terminal/.append style={text height=1.5ex,text depth=.25ex}}
\tikzset{nonterminal/.append style={text height=1.5ex,text depth=.25ex}}
}
\maketitle
\tableofcontents
\newproblem
\newsubproblem
\newsubsubproblem
\begin{align*}
&&S_2 \\
S_2 \rightarrow & A.S_2 & A.S_2\\
A \rightarrow & B & B.S_2\\
B \rightarrow & p & p.S_2\\
S_2 \rightarrow & A.S_2 & p.A.S_2\\
A \rightarrow & B & p.B.S_2\\
B \rightarrow & q & p.q.S_2\\
S_2 \rightarrow & A. & p.q.A.\\
A \rightarrow & B:-B & p.q.B:-B.\\
B \rightarrow & r & p.q.r:-B.\\
B \rightarrow & q & p.q.r:-q.\\
\end{align*}
Der Ausdruck wird akzeptiert.
\begin{align*}
\mathcal{W}(p.q.r:-q) = & \mathcal{W}(p.q.)\cup\{r\}\\
= & \mathcal{W}(p.)\cup{q}\cup\{r\}\\
= & \{p\}\cup\{q\}\cup\{r\}\\
= & \{p,q,r\}\\
\end{align*}
\newsubsubproblem
\begin{align*}
&&S_2\\
S_2 \rightarrow & A.S_2 & A.S_2\\
A \rightarrow & B:-B & B:-B.S_2\\
B \rightarrow & q & q:-B-S_2\\
B \rightarrow & p & q:-p.S_2\\
S_2 \rightarrow & A. & q:-p.A.\\
A \rightarrow & B:-B & q:-p.B:-B.\\
B \rightarrow & p & q:-p.p:-B.\\
B \rightarrow & q & q:-p.p:-q.\\
\end{align*}
Der Ausdruck wird akzeptiert.
\begin{align*}
\mathcal{W}(q:-p.p:-q.) & = \mathcal{W}(q:-p.)\\
& = \emptyset
\end{align*}
\newsubsubproblem
\begin{align*}
&&S_2\\
S_2 \rightarrow & A.S_2 & A.S_2\\
A \rightarrow & B:-B & B:-B.S_2\\
B \rightarrow & q & q:-B.S_2\\
B \rightarrow & p & q:-p.S_2\\
S_2 \rightarrow & A. & q:-p.A.\\
A \rightarrow & B & q:-p.B.\\
B \rightarrow & p & q:-p.p.\\
\end{align*}
Der Ausdruck wird Akzeptiert.
\begin{align*}
\mathcal{W}(q:-p.p.) & = \mathcal{W}(q:-p.) \cup \{ p \}\\
& = \emptyset \cup \{ p \}\\
& = \{ p \}\\
\end{align*}
\newsubsubproblem
Der Ausdruck wird nicht Akzeptiert, da \enquote{t} kein Symbol des Alphabetes ist.
\newsubproblem
Sei $\mathcal{S}$ eine Sprache und $\mathcal{P}$ ein Programm.
Zu zeigen:\\
\begin{align*}
&&\mathcal{P} \text{ ist semantisch korrekt bzgl. } \mathcal{S} \Rightarrow & \mathcal{P} \text{ ist syntaktisch korrekt}\\
\Leftrightarrow&&\mathcal{P} \text{ ist syntaktisch Falsch} \Rightarrow & \mathcal{P} \text{ ist semantisch falsch} & \text{(entspricht Def.)}\\
&&&&qed
\end{align*}
\subsection*{c)}
Seien $\mathcal{A}_1$ und $\mathcal{A}_2$ zwei Ausdrücke in einer Sprache und es gelte:
\begin{align*}
&& \mathcal{W}(\mathcal{A}_1) \neq \mathcal{W}(\mathcal{A}_2) & \Rightarrow \mathcal{A}_1 \neq \mathcal{A}_2\\
\text{dann gilt auch: }&& \mathcal{A}_1 = \mathcal{A}_2 & \Rightarrow \mathcal{W}(\mathcal{A}_1) = \mathcal{W}(\mathcal{A}_2) \\
&&&&qed
\end{align*}
\newproblem[3] % Ueberspringt aufgabe 2
\newsubproblem
$G = (\{S,A,B\},\{a,b\},P,S\}$ mit den Produktionsregeln $P$:
\begin{align*}
S \rightarrow & A \\
S \rightarrow & B \\
A \rightarrow & aAb\\
A \rightarrow & AA\\
A \rightarrow & a\\
B \rightarrow & \varepsilon\\
B \rightarrow & Bb\\
\end{align*}
\newsubproblem
\begin{align*}
S_1& = ( \{ b \} | S_2)\\
S_2& = [ [S_2] a [S_2] b [S_2] ]\\
\end{align*}
\newpage
\newsubproblem
\begin{figure}[h]
\begin{tikzpicture}[
>=latex,thick,
/pgf/every decoration/.style={/tikz/sharp corners},
fuzzy/.style={decorate,
decoration={random steps,segment length=0.5mm,amplitude=0.15pt}},
minimum size=6mm,line join=round,line cap=round,
terminal/.style={rectangle,draw,fill=white,fuzzy,rounded corners=3mm},
nonterminal/.style={rectangle,draw,fill=white,fuzzy},,
node distance=4mm,
]
\ttfamily
\begin{scope}[start chain,
every node/.style={on chain},
terminal/.append style={join=by {->,shorten >=-1pt,
fuzzy,decoration={post length=4pt}}},
nonterminal/.append style={join=by {->,shorten >=-1pt,
fuzzy,decoration={post length=4pt}}},
support/.style={coordinate,join=by fuzzy}
]
\node [support] (start) {};
\node [support,xshift=5mm] (after start2) {};
\node [support,xshift=5mm] (after start) {};
\node [terminal,xshift=5mm] (b) {b};
\node [support,xshift=5mm] (before end) {};
\node [support,xshift=5mm] (before end2) {};
\node [coordinate,join=by ->] (end) {};
\end{scope}
\node (s2) [nonterminal,above=of b] {$S_2$};
\node (support) [below=of b] {};
\begin{scope}[->,decoration={post length=4pt},rounded corners=2mm,
every path/.style=fuzzy]
\draw (after start2) |- (s2);
\draw (s2) -| (before end2);
\draw (before end) -- +(0,-.7) -| (after start);
\end{scope}
\end{tikzpicture}
\caption{Regel $S_1$}
\end{figure}
\begin{figure}[h]
\begin{tikzpicture}[
>=latex,thick,
/pgf/every decoration/.style={/tikz/sharp corners},
fuzzy/.style={decorate,
decoration={random steps,segment length=0.5mm,amplitude=0.15pt}},
minimum size=6mm,line join=round,line cap=round,
terminal/.style={rectangle,draw,fill=white,fuzzy,rounded corners=3mm},
nonterminal/.style={rectangle,draw,fill=white,fuzzy},,
node distance=4mm,
]
\ttfamily
\begin{scope}[start chain,
every node/.style={on chain},
terminal/.append style={join=by {->,shorten >=-1pt,
fuzzy,decoration={post length=4pt}}},
nonterminal/.append style={join=by {->,shorten >=-1pt,
fuzzy,decoration={post length=4pt}}},
support/.style={coordinate,join=by fuzzy}
]
\node [support] (start) {};
\node [support,xshift=5mm] (after start) {};
\node [support,xshift=5mm] (line S2_1) {};
\node [support,xshift=5mm] (before a) {};
\node [terminal,xshift=5mm] (a) {a};
\node [support,xshift=5mm] (after a) {};
\node [support,xshift=5mm] (line S2_2) {};
\node [support,xshift=5mm] (before b) {};
\node [terminal,xshift=5mm] (b) {b};
\node [support,xshift=5mm] (before end) {};
\node [coordinate,join=by ->] (end) {};
\end{scope}
\node (s2_1) [nonterminal,above=of line S2_1] {$S_2$};
\node (s2_2) [nonterminal,above=of line S2_2] {$S_2$};
\begin{scope}[->,decoration={post length=4pt},rounded corners=2mm,
every path/.style=fuzzy]
\draw (after start) |- (s2_1);
\draw (s2_1) -| (before a);
\draw (after a) |- (s2_2);
\draw (s2_2) -| (before b);
\draw (before end) -- +(0,-.7) -| (after start);
\end{scope}
\end{tikzpicture}
\caption{Regel $S_2$}
\end{figure}
\end{document}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment