add uebungen latex scaffolding

This commit is contained in:
2025-11-18 02:09:44 +01:00
parent a2bc018235
commit a81c7fceb6
8 changed files with 344 additions and 1 deletions

6
.gitignore vendored
View File

@@ -35,4 +35,8 @@ build/
.vscode/
### Mac OS ###
.DS_Store
.DS_Store
### nix / direnv
.direnv
result

4
docs/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
out
latexout
latex.out
direnv

2
docs/uebungen/.latexmkrc Normal file
View File

@@ -0,0 +1,2 @@
$out_dir = "out";
$pdf_mode = 4; # lualatex

View File

@@ -0,0 +1,20 @@
\documentclass{uebung}
\author{Linus Nagel}
\chapter{5}
\begin{document}
\maketitle
\begin{exercises}
\item Worum handelt es sich bei Facelets und welche Vorteile bietet die Verwendung von Facelets?
\item Wie können Templates mit Facelets erstellt bzw. verwendet werden?
\item Worum handelt es sich bei PrimeFaces?
\item Welcher Namespace wird für die Verwendung von PrimeFaces benutzt?
\item Wie kann per Ajax auf die Eingabe eines Tastenklicks reagiert werden?
\item Zählen Sie vier PrimeFaces-Komponenten auf und geben deren Funktion an.
\item Erstellen Sie eine JSF-Seite, die eine Klappliste anzeigt in der einer der Werte „Farben“, „Zahlen“ oder „Buchstaben“ ausgewählt werden kann. Darunter befindet sich eine Klappliste die zunächst nur den Inhalt „---“ hat. Nach einer Auswahl in der ersten Klappliste soll ein AJAX-Request generiert werden, der den Inhalt der zweiten Klappliste setzt (denken Sie sich zu den in Klappliste 1 auswählbaren Werten passende Werte aus).
\end{exercises}
\end{document}

142
docs/uebungen/uebung.cls Normal file
View File

@@ -0,0 +1,142 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{uebung}[Sem3 Web Engineering Exercise Sheet Class]
% Base class with options
\LoadClass[11pt,a4paper]{article}
% Required packages
\RequirePackage[german]{babel}
\RequirePackage{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{titlesec}
\RequirePackage{enumitem}
\RequirePackage{listings}
\RequirePackage{xcolor}
\RequirePackage{graphicx}
\RequirePackage{amsmath}
\RequirePackage{hyperref}
% Define chapter counter for exercise sheets
\newcounter{chapter}
\renewcommand{\thechapter}{\arabic{chapter}}
% Page geometry
\geometry{a4paper, left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm}
% Colors for code listings
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
% Code listing style
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
frame=single,
framesep=5pt
}
\lstset{style=mystyle}
% Header and footer setup
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\textbf{Übung Web-Engineering}}
\fancyhead[R]{\textbf{Aufgabenblatt zu Kapitel \thechapter}}
\fancyfoot[C]{\thepage}
% Title format
\renewcommand{\maketitle}{
\begin{center}
\LARGE\textbf{Übung Web-Engineering}\\
\Large\textbf{Aufgabenblatt zu Kapitel \thechapter}
\vspace{1cm}
\large\textbf{Aufgaben \@author}
\end{center}
\vspace{0.5cm}
}
% Section formatting
\titleformat{\section}
{\large\bfseries}
{}
{0em}
{}
[\titlerule]
% Exercise item formatting
\newlist{exercises}{enumerate}{1}
\setlist[exercises]{
label=\arabic*),
leftmargin=*,
itemsep=1em,
before=\vspace{1.0cm}
}
% Java code environment
\lstnewenvironment{javaCode}[1][]
{\lstset{style=mystyle, language=Java, #1}}
{}
% JSP/HTML code environment
\lstnewenvironment{htmlCode}[1][]
{\lstset{style=mystyle, language=HTML, #1}}
{}
% XML code environment
\lstnewenvironment{xmlCode}[1][]
{\lstset{style=mystyle, language=XML, #1}}
{}
% Subsection for code examples
\newcommand{\codeexample}[1]{
\vspace{0.5em}
\noindent\textbf{Beispiel:}
\vspace{0.3em}
#1
}
% Environment for multi-page content
\newenvironment{multipagecontent}
{\par\vspace{1em}}
{\par\vspace{1em}}
% Command for page breaks with continuation marker
\newcommand{\continuepage}{
\vfill
\centerline{\textit{Fortsetzung auf nächster Seite...}}
\newpage
\centerline{\textit{Fortsetzung von vorheriger Seite...}}
\vspace{1em}
}
% Hyperref setup
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Web Engineering Übungen},
pdfauthor={Linus Nagel}
}
% Chapter command for exercise sheets
\newcommand{\chapter}[1]{\setcounter{chapter}{#1}}
\endinput

61
flake.lock generated Normal file
View File

@@ -0,0 +1,61 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1762980239,
"narHash": "sha256-8oNVE8TrD19ulHinjaqONf9QWCKK+w4url56cdStMpM=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "52a2caecc898d0b46b2b905f058ccc5081f842da",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1763283776,
"narHash": "sha256-Y7TDFPK4GlqrKrivOcsHG8xSGqQx3A6c+i7novT85Uk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1761765539,
"narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

110
flake.nix Normal file
View File

@@ -0,0 +1,110 @@
{
description = "Description for the project";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
# To import an internal flake module: ./other.nix
# To import an external flake module:
# 1. Add foo to inputs
# 2. Add foo as a parameter to the outputs function
# 3. Add here: foo.flakeModule
];
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}:
with pkgs.lib; let
latexPackages = with pkgs; [
latexrun
(texlive.withPackages
(ps:
with ps; [
amsmath
biber
biblatex
changepage
csquotes
enumitem
fontaxes
latexmk
listings
minted
newtx
newtxsf
newtxtt
scheme-medium
textpos
times
titlesec
transparent
upquote
]))
];
in {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
packages = with pkgs; let
fmtNum = strings.fixedWidthNumber 2;
fmtReleaseName = sem: author: chap: "${fmtNum sem} - ${fmtNum chap} - ${author.lastName}, ${author.firstName}.pdf";
fmtRelease = fmtReleaseName 3 {
firstName = "Linus";
lastName = "Nagel";
};
mkUebungPdf = n: args:
stdenvNoCC.mkDerivation rec {
name = fmtRelease n;
version = "1.0.0";
src = ./.;
buildInputs = latexPackages;
buildPhase =
# sh
''
cd docs/uebungen
latexmk \
-pdf \
-l -dir-report -file-line-error -verbose \
-interaction=nonstopmode \
"uebung-${toString n}.tex"
'';
installPhase =
# sh
''
mkdir -p $out/share $out/log $out/artifacts
cp out/uebung-${toString n}.pdf "$out/share/${name}"
cp out/*.log $out/log/
cp out/* $out/artifacts
'';
}
// args;
in {
"uebung-5" = mkUebungPdf 5 {};
};
devShells.default = with pkgs;
mkShell {
nativeBuildInputs = [];
packages = [mermaid-cli] ++ latexPackages;
shellHook = ''
'';
};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
};
};
}