From 3e0fcaf2bea7864235ec415895ecd7b788a1531c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 2 Apr 2023 15:44:00 +0200 Subject: initial commit adding my latex build system The two classes test and handout are provided. * test is for setting any kind of test * handout is for setting any handout sheet All markdown files in any subdirectory are converted to pdfs using pandoc. Found tex files are used to generate pdf files using rubber and can use the latex classes defined in the latex/ directory. --- .editorconfig | 12 ++++ Makefile | 30 +++++++++ common.mk | 19 ++++++ latex/common.tex | 19 ++++++ latex/common_options.tex | 12 ++++ latex/common_packages.tex | 10 +++ latex/handout.cls | 20 ++++++ latex/images/Kleeblatt.jpg | Bin 0 -> 9914 bytes latex/images/LogoHansSachs.png | Bin 0 -> 4016591 bytes latex/packages.tex | 110 +++++++++++++++++++++++++++++++++ latex/test.cls | 136 +++++++++++++++++++++++++++++++++++++++++ make-lesson | 12 ++++ templates/.gitignore | 1 + templates/Aufgaben/aufgabe.tex | 10 +++ templates/schedule.md | 12 ++++ templates/test.tex | 28 +++++++++ 16 files changed, 431 insertions(+) create mode 100644 .editorconfig create mode 100644 Makefile create mode 100644 common.mk create mode 100644 latex/common.tex create mode 100644 latex/common_options.tex create mode 100644 latex/common_packages.tex create mode 100644 latex/handout.cls create mode 100644 latex/images/Kleeblatt.jpg create mode 100644 latex/images/LogoHansSachs.png create mode 100644 latex/packages.tex create mode 100644 latex/test.cls create mode 100755 make-lesson create mode 100644 templates/.gitignore create mode 100644 templates/Aufgaben/aufgabe.tex create mode 100644 templates/schedule.md create mode 100644 templates/test.tex diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..cfaf9082 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true +end_of_line = lf +insert_final_newline = true +spell_language = de + +[*.{md,tex}] +indent_style = space +indent_size = 2 diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..13993c53 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +# The full path to the Makefile +MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +# The path to the directory of the Makefile +MAKEFILE_DIR := $(dir $(MAKEFILE_PATH)) + +include $(MAKEFILE_DIR)/common.mk + +SRC_DIRS := $(shell find "(" -not -path "./templates/*" -a -not -path "./latex/*" -a -not -path "*/Aufgaben/*" -a "(" -name "*.md" -o -name "*.tex" ")" ")" -printf "%h\n" | uniq) + +# Hide or not the calls depending of VERBOSE +ifeq ($(VERBOSE),TRUE) + HIDE := +else + HIDE := @ +endif + +.DEFAULT_GOAL := all +all: $(SRC_DIRS) + +define generateRules +$(1): + @echo \#\# Building $$@ \#\# + @pushd $$(@) >/dev/null && make-lesson || popd >/dev/null +endef + +$(foreach dir, $(SRC_DIRS), $(eval $(call generateRules, $(dir)))) +$(eval $(call generateRules, templates)) + +.PHONY: $(SRC_DIRS) templates + diff --git a/common.mk b/common.mk new file mode 100644 index 00000000..825d00dc --- /dev/null +++ b/common.mk @@ -0,0 +1,19 @@ +IMGS := $(wildcard img/*) + +SLIDES_OPTIONS := --slide-level 2 -t beamer +SLIDES_FORMAT := markdown +SCHEDULE_FORMAT := markdown+pipe_tables + +LATEX_BASE := $(MAKEFILE_DIR)latex +ADDITIONAL_TEX_INPUTS := LATEX_BASE: + +RUBBER_OPTS := --pdf --shell-escape -I "$(LATEX_BASE)" + +schedule.pdf: schedule.md $(MAKEFILE_LIST) + pandoc $< -f $(SCHEDULE_FORMAT) -o $@ + +slides.pdf: slides.md $(wildcard img/*) $(MAKEFILE_LIST) + pandoc $(SLIDES_OPTIONS) -f $(SLIDES_FORMAT) $< -o $@ + +%.pdf: %.tex $(MAKEFILE_LIST) + rubber $(RUBBER_OPTS) $< && rubber --clean -q $< diff --git a/latex/common.tex b/latex/common.tex new file mode 100644 index 00000000..decebd24 --- /dev/null +++ b/latex/common.tex @@ -0,0 +1,19 @@ +\newcommand{\Signatur}{FIF} +\newcommand{\Schule}{Hans-Sachs-Gymnasium Nürnberg} +\newcommand{\LogoSchule}{images/logoHansSachs.png} + +\newtcolorbox{wiederholung}[1]{colback=orange!5!white,colframe=orange!75!black,fonttitle=\bfseries,title=Wiederholung: #1} + +\newcommand\kariert[2][0.5cm]{% + \begin{tikzpicture}[gray,step=#1] + \pgfmathtruncatemacro\anzahl{(\linewidth-\pgflinewidth)/#1} % maximale Anzahl Kästchen pro Zeile + \draw (0,0) rectangle (\anzahl*#1,#2*#1) (0,0) grid (\anzahl*#1,#2*#1); + \end{tikzpicture} +} + +\newcommand{\liniert}[2][0.5cm]{% + \begin{tikzpicture}[gray] + \path[use as bounding box](0,0)rectangle(\linewidth,-#2*#1-0.5\pgflinewidth); + \foreach \n in {1,...,#2}\draw(0 ,-#1*\n )--(\linewidth,-#1*\n ); + \end{tikzpicture} +} diff --git a/latex/common_options.tex b/latex/common_options.tex new file mode 100644 index 00000000..0ef8b1cb --- /dev/null +++ b/latex/common_options.tex @@ -0,0 +1,12 @@ +\RequirePackage{etoolbox} +\newtoggle{lehrerversion} +\DeclareOption{lehrerversion}{\toggletrue{lehrerversion}} + +\newtoggle{debug} +\DeclareOption{debug}{\toggletrue{debug}} + +\ProcessOptions\relax + +\iftoggle{debug}{ + \RequirePackage{showframe} % Seitenlayout anzeigen +}{} diff --git a/latex/common_packages.tex b/latex/common_packages.tex new file mode 100644 index 00000000..e3e0cf94 --- /dev/null +++ b/latex/common_packages.tex @@ -0,0 +1,10 @@ +\RequirePackage{geometry} +\RequirePackage[utf8]{inputenc} +\RequirePackage{amssymb,amsthm,amsmath} +\RequirePackage{ifthen} +\RequirePackage{graphicx} +\RequirePackage{tikz} +\RequirePackage{multicol} +\RequirePackage[most]{tcolorbox} +\RequirePackage{xcolor} +\RequirePackage{lmodern} diff --git a/latex/handout.cls b/latex/handout.cls new file mode 100644 index 00000000..5943769a --- /dev/null +++ b/latex/handout.cls @@ -0,0 +1,20 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{handout}[muhq's simple handout class] + +\LoadClass{scrartcl} + +\input{common_packages.tex} +\input{common_options.tex} +\input{common.tex} + +\geometry{a4paper,margin=1cm,nohead} + +\newcommand{\solution}[1]{ + \iftoggle{lehrerversion}{ + #1 + }{ + \phantom{#1} + } +} + +\newcommand{\gap}[1]{\underline{\solution{#1}}} diff --git a/latex/images/Kleeblatt.jpg b/latex/images/Kleeblatt.jpg new file mode 100644 index 00000000..3a5423b2 Binary files /dev/null and b/latex/images/Kleeblatt.jpg differ diff --git a/latex/images/LogoHansSachs.png b/latex/images/LogoHansSachs.png new file mode 100644 index 00000000..82e4dc43 Binary files /dev/null and b/latex/images/LogoHansSachs.png differ diff --git a/latex/packages.tex b/latex/packages.tex new file mode 100644 index 00000000..649d3fdc --- /dev/null +++ b/latex/packages.tex @@ -0,0 +1,110 @@ +\renewcommand{\baselinestretch}{1,5} + +\usepackage{geometry} +\geometry{a4paper, top=35mm, left=20mm, right=35mm, bottom=25mm, +headsep=15mm, footskip=10mm} + +\usepackage{floatflt} +\usepackage{footnote} +\usepackage{amsthm} +\usepackage{float} +\usepackage[utf8]{inputenc} +\usepackage[ngerman]{babel} +\usepackage{underscore} +\usepackage{amssymb,amsmath} +\usepackage{comment} +\usepackage{ifthen} +\usepackage{graphicx} +\newcommand{\Verteilung}{} + +\newtheoremstyle{Aufg}% name of the style to be used +{2pt}% measure of space to leave above the theorem. E.g.: 3pt +{}% measure of space to leave below the theorem. E.g.: 3pt +{}% name of font to use in the body of the theorem +{}% measure of space to indent +{}% name of head font +{}% punctuation between head and body +{\newline }% space after theorem head; " " = normal interword space +{\textbf{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}: \ \Verteilung \hfill {/}\AnzahlPunkte \ BE}} + +\theoremstyle{Aufg} +\newtheorem{Aufg}{Aufgabe} + +\newtheoremstyle{Lsg}% name of the style to be used +{2pt}% measure of space to leave above the theorem. E.g.: 3pt +{}% measure of space to leave below the theorem. E.g.: 3pt +{}% name of font to use in the body of the theorem +{}% measure of space to indent +{}% name of head font +{}% punctuation between head and body +{\newline }% space after theorem head; " " = normal interword space +{\textbf{\thmname{#1}\thmnote{ (#3)}: }} + + + +\theoremstyle{Lsg} +\newtheorem{Lsg}{Lösung} + +\newtheoremstyle{Bearbeitung}% name of the style to be used +{0pt}% measure of space to leave above the theorem. E.g.: 3pt +{25pt}% measure of space to leave below the theorem. E.g.: 3pt +{}% name of font to use in the body of the theorem +{}% measure of space to indent +{}% name of head font +{}% punctuation between head and body +{ }% space after theorem head; " " = normal interword space +{\thmname{#1} } + +\theoremstyle{Bearbeitung} +\newtheorem{Bearbeitung}{} + + +\newcommand{\centeredgraphics}[2][]{\[\includegraphics[#1]{images/#2}\]} +\newcommand{\Ende}{ \ifdefined\PlatzKnapp \makebox(100,25)[c]{} \else \vspace*{\fill} \fi +%\makebox(100,50)[c]{} +\centeredgraphics[height=2.5cm]{Kleeblatt.jpg} +\centerline{\textbf{Viel Erfolg!}} \newline} + +\newcommand{\AnzahlPunkte}{X} %%Anzahl der Punkte festlegen + + + +\makeindex +\usepackage{setspace} + +%\usepackage{showframe} % Seitenlayout anzeigen + +\usepackage{fancyhdr} +\pagestyle{fancy} +\setlength{\headheight}{25 pt} +\fancyhf{} +\fancyhead[L]{\Schule} +\fancyhead[R]{\HeaderText} + + + +\fancypagestyle{ErsteSeite}{% + \fancyhf{}% + \fancyhead[L]{\ifdefined\KeinLogo \else \includegraphics[width=0.3\textwidth]{\LogoSchule} \newline \fi \Schule} + \fancyhead[R]{\Large Name: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } + +} + + +\usepackage{tikz} +\newcommand\kariert[2][0.5cm]{% + \begin{tikzpicture}[gray,step=#1] + \pgfmathtruncatemacro\anzahl{(\linewidth-\pgflinewidth)/#1} % maximale Anzahl Kästchen pro Zeile + \draw (0,0) rectangle (\anzahl*#1,#2*#1) (0,0) grid (\anzahl*#1,#2*#1); + \end{tikzpicture} +} + +\newcommand{\liniert}[2][0.5cm]{% + \begin{tikzpicture}[gray] + \path[use as bounding box](0,0)rectangle(\linewidth,-#2*#1-0.5\pgflinewidth); + \foreach \n in {1,...,#2}\draw(0 ,-#1*\n )--(\linewidth,-#1*\n ); + \end{tikzpicture}} + +\newcommand{\Lehrerversion}{\excludecomment{Bearbeitung}} + +\newcommand{\Schuelerversion}{\excludecomment{Lsg}} diff --git a/latex/test.cls b/latex/test.cls new file mode 100644 index 00000000..64fdf54e --- /dev/null +++ b/latex/test.cls @@ -0,0 +1,136 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{test}[muhq's test class] + +\renewcommand{\baselinestretch}{1,5} + +\LoadClass[a4paper,12pt]{scrartcl} + +\RequirePackage{floatflt} +\RequirePackage{footnote} +\RequirePackage{float} +\RequirePackage[ngerman]{babel} +\RequirePackage{underscore} +\RequirePackage{comment} + +\input{common_packages.tex} +\input{common_options.tex} +\input{common.tex} + +\geometry{a4paper, top=35mm, left=20mm, right=35mm, bottom=25mm, headsep=15mm, footskip=10mm} + +\newcommand{\Verteilung}{} +\newcommand{\AnzahlPunkte}{0} %%Anzahl der Punkte festlegen + +\newcommand{\Datum}{\today} +\newcommand{\Klasse}{TODO} +\newcommand{\TestNummer}{1} +\newcommand{\TestArt}{Schulaufgabe} +\newcommand{\Fach}{Mathemathik} +\newcommand{\HeaderText}{\TestArt{} aus der \Fach} +%\newcommand{\KeinLogo}{} %%FALLS Kein Logo erwünscht +\newcommand{\EinleitungsSatz}{Achte auf eine korrekte Schreibweise und eine ordentliche äußere Form!} + +\definecolor{testgrauRGB}{rgb}{0.9,0.9,0.9} +\definecolor{testgrauCMYK}{cmyk}{0.0,0.0,0.0,0.30} + +\newcommand{\AnzahlInsgesamtPunkte}{TODO} %%Anzahl der zu erreichenden Punkte + +\newtheoremstyle{Aufg}% name of the style to be used +{2pt}% measure of space to leave above the theorem. E.g.: 3pt +{}% measure of space to leave below the theorem. E.g.: 3pt +{}% name of font to use in the body of the theorem +{}% measure of space to indent +{}% name of head font +{}% punctuation between head and body +{\newline }% space after theorem head; " " = normal interword space +{\textbf{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}: \ \Verteilung \hfill {/}\AnzahlPunkte \ BE}} + +\theoremstyle{Aufg} +\newtheorem{Aufg}{Aufgabe} + +\newtheoremstyle{Lsg}% name of the style to be used +{2pt}% measure of space to leave above the theorem. E.g.: 3pt +{}% measure of space to leave below the theorem. E.g.: 3pt +{}% name of font to use in the body of the theorem +{}% measure of space to indent +{}% name of head font +{}% punctuation between head and body +{\newline }% space after theorem head; " " = normal interword space +{\textbf{\thmname{#1}\thmnote{ (#3)}:}} + +\theoremstyle{Lsg} +\newtheorem{Lsg}{Lösung} + +\newtheoremstyle{Bearbeitung}% name of the style to be used +{0pt}% measure of space to leave above the theorem. E.g.: 3pt +{25pt}% measure of space to leave below the theorem. E.g.: 3pt +{}% name of font to use in the body of the theorem +{}% measure of space to indent +{}% name of head font +{}% punctuation between head and body +{ }% space after theorem head; " " = normal interword space +{\thmname{#1}} + +\theoremstyle{Bearbeitung} +\newtheorem{Bearbeitung}{} + +\newcommand{\Lehrerversion}{\excludecomment{Bearbeitung}} +\newcommand{\Schuelerversion}{\excludecomment{Lsg}} + +\iftoggle{lehrerversion}{ + \Lehrerversion +}{ + \Schuelerversion +} + +\newcommand{\Intro}{ + \fcolorbox{black}{testgrauRGB}{% + \parbox{14.3cm}{ + \centerline{\Large \bfseries \TestNummer{}. \TestArt{} aus der Mathematik} + \medskip + \centerline{\bfseries Klasse \Klasse} + \centerline{\bfseries -- am \Datum \ --} + } + } + \medskip + \newline + \centerline{\EinleitungsSatz} +} + +\newcommand{\centeredgraphics}[2][]{\[\includegraphics[#1]{images/#2}\]} +\newcommand{\Ende}{ + \ifdefined\PlatzKnapp \makebox(100,25)[c]{} + \else \vspace*{\fill} + \fi + %\makebox(100,50)[c]{} + \centeredgraphics[height=2.5cm]{Kleeblatt.jpg} + \centerline{\textbf{Viel Erfolg! \Signatur}} + \newline + + \makebox(1,50)[c]{} + + %%Erstellt Summenzeichen und Erreichte Punktzahl + \centerline{\Large \bfseries $\sum$ \ \ \ \ \ \ \ \ \ \ {/}\AnzahlInsgesamtPunkte \ BE} + \makebox(1,25)[c]{} \newline + \ifdefined\PlatzKnapp + \else + \makebox(100,100)[c]{} + \fi +} + +\makeindex +\RequirePackage{setspace} + +\RequirePackage{fancyhdr} +\pagestyle{fancy} +\setlength{\headheight}{25 pt} +\fancyhf{} +\fancyhead[L]{\Schule} +\fancyhead[R]{\HeaderText} + +\fancypagestyle{ErsteSeite}{% + \fancyhf{}% + \fancyhead[L]{\ifdefined\KeinLogo \else \includegraphics[width=0.3\textwidth]{\LogoSchule} \newline \fi \Schule} + \fancyhead[R]{\Large Name: \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } + +} diff --git a/make-lesson b/make-lesson new file mode 100755 index 00000000..a82776d6 --- /dev/null +++ b/make-lesson @@ -0,0 +1,12 @@ +#!/usr/bin/bash +MAKEFILE='Makefile' +while [[ ! -f "${MAKEFILE}" ]]; do + MAKEFILE=../"${MAKEFILE}" +done + +FIND="find . -maxdepth 1 '(' -name '*.md' -o -name '*.tex' ')' -a -not -name 'Aufgabe[0-9].tex'" + +if [[ -f "${MAKEFILE}" ]]; then + exec make -s -f "${MAKEFILE}" "$@" $(eval "${FIND}" | sed 's/.tex/.pdf/g' | sed 's/.md/.pdf/g') +fi + diff --git a/templates/.gitignore b/templates/.gitignore new file mode 100644 index 00000000..a1363379 --- /dev/null +++ b/templates/.gitignore @@ -0,0 +1 @@ +*.pdf diff --git a/templates/Aufgaben/aufgabe.tex b/templates/Aufgaben/aufgabe.tex new file mode 100644 index 00000000..ef86bf06 --- /dev/null +++ b/templates/Aufgaben/aufgabe.tex @@ -0,0 +1,10 @@ +\renewcommand{\AnzahlPunkte}{8} %%Anzahl der Punkte festlegen +\renewcommand{\Verteilung}{4 + 4 BE} %%Anzahl der Punkte festlegen + +\begin{Aufg} +Berechne $1+1$ +\end{Aufg} + +\begin{Lsg} +$1 + 1 = 2$ +\end{Lsg} diff --git a/templates/schedule.md b/templates/schedule.md new file mode 100644 index 00000000..8d2c4ae1 --- /dev/null +++ b/templates/schedule.md @@ -0,0 +1,12 @@ +--- +lang: de +geometry: margin=2cm +--- +# Thema der Stunde + +## Lernziele + +## Verlaufplan + +| Zeit | Phase | Unterrichtsgeschehen | Ziel | Methode | Medien | +|:-----|-------------|--------------------------------------|-----------------------------------------------------------|----------|------------------| diff --git a/templates/test.tex b/templates/test.tex new file mode 100644 index 00000000..b8dbed23 --- /dev/null +++ b/templates/test.tex @@ -0,0 +1,28 @@ +\documentclass[ +% debug, % Zeigt Rahmen der verwendeten frames +lehrerversion, % Zeigt die Loesungen und versteckt den Platz zur Bearbeitung +]{test} + +\begin{document} + +\thispagestyle{ErsteSeite} +\Intro + +%%BEISPIEL AUFGABE MIT KARIERTER BEARBEITUNG +\input{Aufgaben/aufgabe} +%\newline +\begin{Bearbeitung} +\kariert[0.5cm]{17} +%\liniert[0.5cm]{13} +\end{Bearbeitung} + +%%%Hier die Darstellung am Ende +%%Falls es das ganze auf eine andere Seite Schiebt und man alles komprimieren will +%\newcommand{\PlatzKnapp}{} + +%%Optional neue Seite +\newpage + +%%Bindet Kleeblatt mit Viel Erfolg ein und erstellt Platz darunter +\Ende +\end{document} -- cgit v1.2.3