diff --git a/README.md b/README.md index 92bae5a524ec2bb3890b7b8173009417e90d00cf..a9dd0d972b0347058c6e9276d89828e57fb6d629 100644 --- a/README.md +++ b/README.md @@ -1,262 +1,195 @@ -# What this is +[](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh) +[](https://www.latex-project.org/) +[](https://hs-hannover.de/) +<br> +[](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/releases) -This is a template designed to ease the workflow when writing documents for the Hochschule Hannover. It is intended to be used in all sophisticated -works, from lab-reports to master’s thesis's. <br> -The project provides custom document-classes caring the `HsH-` prefix as well as support files. These classes extend the well known KOMA-Script -classes and customize them with specific configurations, presets and provide commonly needed features. +# What this is -[](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/releases) +This is a template designed to ease the workflow when writing documents for the +Hochschule Hannover. It is intended to be used in all sophisticated works, from +lab-reports to master’s thesis's. \ +The project provides custom document-classes caring +the `HsH-` prefix as well as support files. These classes extend the well known +KOMA-Script classes and customize them with specific configurations, presets and provide +commonly needed features. -**Provided classes are:** +# The different classes -- [`HsH-article`](#hsh-article) -- [`HsH-report`](#hsh-report) -- [`HsH-book`](#hsh-book) (planed) -- [`HsH-standalone`](#hsh-standalone) +This project provides a set of additional classes designed for use in the Hochschule +Hannover, Germany. They extend the well-known +[KOMA-Script classes](https://ctan.org/pkg/koma-script) by adding styling and providing +some additional commands. You can find the full documentation of all features in +[src/HsH-classes.pdf](src/HsH-classes.pdf), but here is a short description of the +different classes: +### `HsH-article` +Based on the `scrartcl` this class is designed for quick and compact documents. It does +not have chapters and therefore never breaks to a new page on its own. This class is +useful for writing lab-protocols and alike. -# Quick start guide +### `HsH-report` +This is probably the most useful class. It is based on the `scrreprt` and can be used +for a wide variety of documents, beginning with lab-reports and ending at complete +thesis. The line between article and report is somewhat blurry, so use as you see fit. -## Recommended software +### `HsH-book` -As a Tex-Distribution, [MiKTeX is recommended](https://miktex.org/), TexLive should also work, but I don't use it much. <br> -To edit the `.tex` files, you could use any text editor, but I personally like [Visual Studio Code](https://code.visualstudio.com/) the most, which -can also be used for pretty much all other programming languages. Use the [Latex Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop), -and you can steal my config file from [here](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/snippets/111). <br> -If you prefer a Tex-only editor, I used [Texmaker](https://www.xm1math.net/texmaker/) in the past, and it's also very good. +// ToDo -If you want to use citations in your work, you should get familiar with the `biblatex` package and include it in your project. The classes set it up -to use `biber` as the backend, which is more modern and has more features than the usual `bibtex`, but you will need to set you editor up to also use -this. +### `HsH-standalone` -## I have now Idea how to start, show me! +A helper class based on the normal `standalone` class. It is designed only for creating +images as separate documents to keep things organized and compiler times low. It is +useful for creating graphs, circuit diagrams or other kind of complex sub documents. -To get you started, there is a working example Project on the example branch that has loads of tips. Check it out -[Online](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/tree/example) or locally using `git checkout example` +# Quick start guide +## Recommended software -## Quick and dirty +As a Tex-Distribution, [MiKTeX is recommended](https://miktex.org/), TexLive should also +work, but I don't use it much. You will also need `perl` to run `latexmk` and other +useful tools. To edit the `.tex` files, you could use any text editor, but I personally +like [Visual Studio Code](https://code.visualstudio.com/) the most, which can also be +used for pretty much all other programming languages. Use the +[Latex Workshop extension](https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop). -To get started, create a new folder for your project somewhere on your PC and create your `.tex` file. Copy the class file (`.cls`) you want to use -and the `HsH-logo.pdf` from the src folder to your project folder. You can optionally copy the `config.tex`, but you can also configure everything in -your preamble. +If you have [`winget`](https://docs.microsoft.com/en-us/windows/package-manager/winget) +(windows new, build in package manager) and just want to install everything without any +fuzz, use the following command: +```powershell +winget install "MiKTeX.MiKTeX" "StrawberryPerl.StrawberryPerl" "Git.Git" "Microsoft.VisualStudioCode" +code --install-extension "James-Yu.latex-workshop" +``` -## Using a proper subfolder structure +## Using the project as a template -The projects also provides a recommendation for a subfolder structure, to keep things organized. You can -[download the .zip-Archive](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/archive/master/latex-template-hsh-master.zip) -and unpack it or clone the repository via `git clone https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh.git`. -This has the downside of storing class files and other needed files in the _./src_ folder, which means it needs to be added to the path searched when -running your latex command ([see below](#adding-src-to-path)). <br> -The provided Makefile demonstrates how to run a successful build, you might want to check it out. +The projects also provides a recommendation for a subfolder structure to keep things +organized. If you don't want to use git and just want to get started in LaTeX, +[download the zip-Archive](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/archive/master/latex-template-hsh-master.zip) +and unpack it. -## Compiling +It is recommended you use git to take full advantage of its features (like having backups +and being able to easily see what changed from the last version) and also be able to +easily update should a newer version of this repo be released. First create a new, +**empty** project on the platform of your choice (for example here on +<https://lab.it.hs-hannover.de>), than you can use the following to set it up locally on +your system. -The Project comes with `latexmk` setting, so you should be able to instantly compile using it. +> **Note** replace `[Project]` with your projects name (for example "_Report_") and +> `[Project_URL]` with the git-url for the project you created on the online git +> platform ```shell -latexmk project.tex +# create project folder +mkdir [Project] +cd [Project] +# set up local git repo with template +git init -b [Project] +git lfs install +git remote add upstream https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh.git +git fetch upstream +git pull upstream master +git remote add origin [Project_URL] +git push --set-upstream origin [Project] +# optionally do some cleanup (linux syntax, adjust when needed) +rm CHANGELOG.md LICENSE +mv project.tex [Project].tex +echo "# [Project]" > README.md +git commit --all -m "initalise for [Project]" +git push ``` +> **Note** giving you Project name as the default branch name is optional, and you could +> keep the default name of `master`, but as the template also has a `master` branch it is +> less confusing if you choose a different name. -# Documentation - - -## The different classes - -This project provides a set of additional classes designed for use in the Hochschule Hannover, Germany. They extend the well-known [KOMA-Script -classes](https://ctan.org/pkg/koma-script) by adding styling and providing some additional commands. The provided classes are: +## I have now Idea how to start, show me -### `HsH-article` - -Based on the `scrartcl` this class is designed for quick and compact documents. It does not have chapters and therefore never breaks to a new page on -its own. This class is useful for writing lab-protocols and alike. - -### `HsH-report` -This is probably the most useful class. It is based on the `scrreprt` and can be used for a wide variety of documents, beginning with lab-reports and -ending at complete thesis. The line between article and report is somewhat blurry, so use as you see fit. +To get you started, there is a working example Project on the example branch that has +loads of tips. Check it out +[Online](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/tree/example) or +locally using `git checkout example`. -### `HsH-book` -// To-do +## Compiling -### `HsH-standalone` -A helper class based on the normal standalone class. It is designed only for creating images as separate documents to keep things organized and -compiler times low. It is useful for creating graphs, circuit diagrams or other kind of complex sub documents. - - -## Document Options - -The classes accept a number of new options, which are passed to the class via `\documentclass[options]{class}`. All unknown options are passed to the -underlying subclass and processed there. So you can use everything from the corresponding documentations. - -### Default Options -If you don't define something different, the classes set your project up to use the following options: -- `fontsize=11pt` the font size -- `a4paper` the paper size -- `ngerman` the document language -- `sans` the font type (Sans Serif) -- `margin=0.25cm` ONLY for `hsh-standalone`, adds an empty margin around all pages - -### List of all options -- `german`, `ngerman` These two options are aliases. They switch the document language to German, which affects autogenerated naming as well as the - formatting of numbers. This is implemented by using an internal if switch, called `\@german`, which is set to true. -- `english` This option is the opposite of the previous ones. It sets the document language to English by setting `\@german` to false. -- `f1` - `f5` To use the correct logo of a certain faculty, you can define your faculty with these options. If none of these are present, a generic - grey logo is chosen. <br> - The different logos correspond to different pages of the `HsH-Logo.pdf`, so you could change this file and therefore the used logo as long as you - keep the page numbering consistent with the original. -- `sans` This option sets the font family to Sans Serif. -- `roman` The opposite of `sans`, sets a roman/serif font. -- `todos` This enables the [`todonotes`](http://tug.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf) package and allows you to use the `\todo{}` - command. It is set up in a way that removing this option allows you to still leave `\todos`'s in your code without breaking. NOTE: using this - options will create pages that are wider than A4-format, making them non-printable! - -All remaining options are passed along to the respective subclasses and processed there. This means, that you can use all the options described in -their respective documentations. - - -## Packages - -### Provided packages -These Packages are automatically included by the class file. These are either important for provided functions or so generally useful that they are -used in pretty much every project anyway. - -- `inputenc` for input encoding, all input files (.tex files, etc.) are expected to be UTF8 encoded -- `fontenc` for output encoding, set to T1, if you use non-Latin characters (like Cyrillic, etc.) you need to add that -- `lmodern` is a font -- `babel` for German typesetting -- `geometry` for pagelayout and margins -- `scrlayer-scrpage` KOMA package for headers and footers -- `scrhack` KOMA package for compatibility with listings -- `pgffor` allows for the use of for-loops (internal) -- `graphicx` for importing images -- `hyperref` for references and links -- `caption` to customize captions and make references point to the beginning of the floats -- `bookmark` for bookmarking -- `amsmath` for a lot of general purpose maths features -- `csquotes` makes quotations easier -- `ziffer` is only included when the German document option is provided, sets comma as decimal - -### Recommended packages -These packages are recommended, but not included automatically to save compile time when they are not needed. If you want to use one of them, include -it in your preamble. - -- `bibtex` a package for citation and source management. Keep in mind, that there are multiple backends and `biber` is configured, if you want to - continue using the old backend, type `\usepackage[backend=bibtex]{biblatex}` in your preamble. -- `subfigure` one of multiple packages, that allows you to put multiple images into a figure -- `siunitx` is an amazing tool for Units -- `csvsimple` allows you to import CSV files, which is handy if you want to display measurements -- `listings` allows you to include format code snippets -- `pgfplots` is a great maths engine, which can create amazing plots -- `tikz` is already included with pgfplots, but is also a nice standalone package -- `circuitikz` expands the previous packages with macros for circuit creation -- `standalone` is a package, that allows you to create simple images from sub-texfiles. This can save a lot of compile time, especially with tikz and - alike. - -There's more... - - -## Commands - -The classes provide a few commands of their own. Here are some explanations: - -### `\maketitle[align]` -This command is not new, but changed. It creates a title-page fitting for most use cases. You can change its alignment via the optional parameter by -using on of the three options `r`, `c` or `l` for right aligned, centred or left aligned. <br> -You can use the following macros to define the different information presented on the title-page: - -- `\author` as usual, this is where you put your name. But you can also input a comma-seperated list, if more than one person has written in this file. -- `\matrikelnr` a new macro for your matriculation number. This is optional, but will be put next to your name if present. You can input again a - comma-seperated list, if more than one author is present. -- `\titlehead` is for a small line left of the logo. This is usually the department or division. May be empty -- `\subject` is for a broad description of what your file is. "Laborbericht" for example. Can be empty. -- `\title` is quite obvious. The only one that must be present. I additionally accept an optional parameter which will be treated as a short form of - the title and used in the header (this makes sense if your title is very long and fills your header too much) -- `\subtitle` is a smaller second line under the title. Can be empty -- `\date` is the date of your project. You can use a custom one, but if you don't set it, the current date at compile time will be used. -- `\professor` a new macro do define your professors name, if needed. -- `\firstexaminer` a new macro do define your first examiners name, if needed. -- `\secondexaminer` a new macro do define your second examiners name, if needed. -- `\keywords` will not be printed on the title-page, but rather on the end of the abstract, if you define some. They will also be but into the PDFs - metadata. - -### `\declarationofauthorship[align]` -This macro will typeset a declaration of authorship, which is needed for most academic works. You can choose to have it on the bottom (`b`) or top (`t`) of the page, with bottom beeing the default. <br> -The macro is defined in German and English and will automatically match your document language. - -### `\abs` -A helpful macro for absolute values. It can be used in maths mode and will put vertical lines around its content, that match the height of the -content. <br> -This macro is only provided, meaning if another package defines it, its definition will be used. - -### HsH-Logo macros -These are more of a by-product, but they are defined, so you could use them: -- `\HsHlogoPath` the path to an image, that is used as the logo. Given a default value by the class. -- `\HsHlogoPage` the page of the previous file, which is used. This is changed with the `f1`-`f5` options. -- `\includeHsHlogohere[width]` this macro produces the logo using the previous macros. The width can optionally be provided. +The Project comes with setting for `latexmk`, so you should be able to instantly compile +using it. +```shell +latexmk +``` +> **Note** If you use the recommended folder-structure, it stores the class files and +> other needed files in the _./src_ folder. If you use `latexmk` this is already +> configured correctly, but might be relevant if you choose a different build system +> ([see below](#adding-src-to-path)). # Common additions and expansions (Snippets) -Sadly most Profs have widely different expectations when it comes to styling of written works. So you might find yourself having to change some -settings. For some cases this has already been done and, to help others, uploaded in -[the snippets section](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/snippets) of the project. Most of them are only visible when you -are logged in!! <br> -Also, if you create your own set of additions that are useful for other, feel free to contact me and I will give you access right, so you can upload -it there. - +Sadly most Profs have widely different expectations when it comes to styling of written +works. So you might find yourself having to change some settings. For some cases this +has already been done and, to help others, uploaded in +[the snippets' section](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/snippets) +of the project. +Also, if you create your own set of additions that are useful for other, feel free to +contact me and I will give you access right, so you can upload it there. # Frequently Asked Questions -## What is the `config.tex`? +### How can I create my own title page -These file is an easy way to configure your project in a single central location, so it can be used over multiple documents in the same project as -well as allowing easy reuse of configs for other projects. +If you don't like the title page, feel free to create your own. You can simply redefine +the `\maketitle` command to you liking. -The provided classes automatically check for this file and use it, if it is present. But they are completely optional, so you can just ditch them if -you want to. Keep in mind that the `config.tex` will be included right before the `\begin{document}`, so it overrides all settings you may have put -in your preamble. +Before you go to town, check out what others already published in +[the snippets section](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/snippets). +This will be a good starting point or maybe even already be what you want. -The `config.tex` is intended for configurations. For example new- or redefinitions of commands should be put here. Also, packages-specific configs are -loaded here. The `\@ifpackageloaded{pakagename}{true}{false}` macro allows to check for the existence of a package, so that you can reuse config files, -even if you don't use all the same packages. +### Italic vs. upright Index? (changing subscript) -## Adding _./src_ to path +The classes by default set all sub scripts upright ("steil" in German), because this is +required in Germany in most cases. You can deactivate this permanently with +`\normalsubscripts` and reactivate it with `\upsubscripts`. -You need to do this if you get errors like this: +If you want to change it for a single use, you can use the original Tex Macro `\sb{}` +instead of the `_` to get the original behaviour. -> ! LaTeX Error: File `HsH-report.cls' not found. +> **Warning** DO NOT use `_\math..{}`! This would be a nested font change and lead to +> unexpected results. `\sb{\math..{}}` is possible. -Usually the `latexmkrc` files handles setting this up, but if you have problems or just want more controll, -[here](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/snippets/121) are more details. +### Adding _./src_ to path -## Using an _.aux_ directory +You need to do this if you get errors like this: -It is very useful to define subdirectory for all the files produced during a latex run. This is also set up via the `latexmkrc` file. +> ! LaTeX Error: File \`HsH-report.cls' not found. + +Usually the `latexmkrc` files handles setting this up, but if you have problems or just +want more control, +[here](https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh/-/snippets/121) are +more details. ## LaTeX errors -> You have requested document class \`src/HsH-report', but the document class provides \`HsH-report'. +> You have requested document class \`src/HsH-report', but the document class provides +> \`HsH-report'. -This happens when you tried to use something like `\documentclass{src/HsH-report}`, which was a good idea, but doesn't quite work. You need to properly -add the `src` directory to the path searched by LaTeX (as explained [here](#adding-src-to-path)). You can than simply use `\documentclass{HsH-report}`. +This happens when you tried to use something like `\documentclass{src/HsH-report}`, +which was a good idea, but doesn't quite work. You need to properly add the `src` +directory to the path searched by LaTeX (as explained [here](#adding-src-to-path)). You +can than simply use `\documentclass{HsH-report}`. ## BibTeX errors > Sorry, but BibTeX did not succeed -You are probably using `bibtex` as your backend, but `biber` the standard configuration. You can change it, see -[here for most editors](https://texwelt.de/fragen/1909/wie-verwende-ich-biber-in-meinem-editor) and [here for VS Code](https://tex.stackexchange.com/questions/459640/implementing-biber-for-biblatex-in-microsoft-visual-studio-code/459933#459933) +You are probably using `bibtex` as your backend, but `biber` the standard configuration. +You can change it, see +[here for most editors](https://texwelt.de/fragen/1909/wie-verwende-ich-biber-in-meinem-editor) +and +[here for VS Code](https://tex.stackexchange.com/questions/459640/implementing-biber-for-biblatex-in-microsoft-visual-studio-code/459933#459933) or use `\usepackage[backend=bibtex]{biblatex}` in your preamble to keep using BibTeX. - -## Italic vs. upright Index? (changing subscript) - -The classes by default set all sub scripts upright ("steil" in German), because this is required in Germany in most cases. <br> -You can deactivate this permanently with `\normalsubscripts` and reactivate it with `\upsubscripts`. <br> -If you want to change it for a single use, you can use the original Tex Macro `\sb{}` instead of the `_` to get the original behaviour. <br> -DO NOT use `_\math..{}`! This would be a nested font change and lead to unexpected results. `\sb{\math..{}}` is possible. diff --git a/src/.latexmkrc b/src/.latexmkrc index 335a4d22a0fcf90823f6c1bfa37cf3654568274e..1875c26f20612cecf3cb8258c41fb114cdb33b8c 100644 --- a/src/.latexmkrc +++ b/src/.latexmkrc @@ -3,8 +3,8 @@ # generall settings: $pdf_mode = 1; # use pdflatex -push @final_output_exts, 'ins', 'cls', 'cfg'; -push @generated_exts, 'hd'; +push @generated_exts, 'hd', 'ins', 'cfg'; +push @final_output_exts, 'ins', 'cfg'; $makeindex = 'makeindex -s gind.ist %S'; diff --git a/src/HsH-article.cls b/src/HsH-article.cls index a0c5bdf1da208a66e41c58d6df43fac3ac7407ca..9f53c6574e21c0c9b12d153f763cc6cbc0df7e65 100644 --- a/src/HsH-article.cls +++ b/src/HsH-article.cls @@ -15,150 +15,338 @@ %% %% http://www.latex-project.org/lppl.txt %% -\typeout{Adapted from KOMA script for use in Hochschule Hannover <2023-08-12> Jan Wille} -\NeedsTeXFormat{LaTeX2e} -\newcommand{\HsHClassName}{HsH-article} -\ProvidesClass{\HsHClassName}[2023/08/12 v2.1 HsH-Class based on KOMA] - -%% commands for HsH-logo -\newcommand{\HsHlogoPath}{HSH-Logo.pdf} -\newcommand{\HsHlogoPage}{1} -\newcommand{\includeHsHlogohere}[1][5cm]{ - \IfFileExists{\HsHlogoPath}{}{ - \ClassError{\HsHClassName}{HsH-Logo.pdf not found!}{ - The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location - } - } - \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} +\NeedsTeXFormat{LaTeX2e}[2022-06-01] +\ProvidesClass{HsH-article} + [2024-04-23 3.00 HsH-class based on KOMA] +\let\HsHClassName\@currname +\def\HsHClassName@ParrentClass{% + scrartcl% } -\newif\if@german% -\newif\if@todos\@todosfalse% - -%% document options ------------------------------------------------------------------------------- -\DeclareOption{german}{ - \@germantrue +\RequirePackage{scrbase} +\RequirePackage{setspace} +\DefineFamily{HsH} +\DefineFamilyMember{HsH} +\newcommand{\HsH@Options@PassToParrent}[1]{% + \ClassInfoNoLine{\HsHClassName}{passing option to parrent class: #1}% + \PassOptionsToClass{#1}{\HsHClassName@ParrentClass}% } -\DeclareOption{ngerman}{ - \@germantrue +\newcommand{\HsH@Options@DeclareAlias}[3][HsH]{% + \DeclareOption{#2}{\FamilyExecuteOptions{#1}{#3}}% } -\DeclareOption{english}{ - \@germanfalse +\DefineFamilyKey{HsH}{fontfamily}{ + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tmp}{% + {sans}{0}, {sans-serif}{0},% + {roman}{1}, {serif}{1},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tmp% 0 + \endgroup + \renewcommand{\familydefault}{\sfdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \or% 1 + \endgroup + \renewcommand{\familydefault}{\rmdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{f1}{ - \renewcommand{\HsHlogoPage}{2} +\HsH@Options@DeclareAlias{sans}{fontfamily=sans} +\HsH@Options@DeclareAlias{roman}{fontfamily=roman} +\DefineFamilyKey{HsH}{linespacing}{ + \begingroup + \FamilySetNumerical{HsH}{linespacing}{@tempa}{% + {single}{0},% + {onehalf}{1},% + {double}{2},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tempa% 0 + \endgroup + \if@atdocument\singlespacing\else\AtEndOfClass{\singlespacing}\fi + \or% 1 + \endgroup + \if@atdocument\onehalfspacing\else\AtEndOfClass{\onehalfspacing\AfterTOCHead{\singlespacing}}\fi + \or% 2 + \endgroup + \if@atdocument\doublespacing\else\AtEndOfClass{\doublespacing\AfterTOCHead{\singlespacing}}\fi + + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{f2}{ - \renewcommand{\HsHlogoPage}{3} +\HsH@Options@DeclareAlias{singlespacing}{linespacing=single} +\HsH@Options@DeclareAlias{onehalfspacing}{linespacing=onehalf} +\HsH@Options@DeclareAlias{doublespacing}{linespacing=double} +\DefineFamilyKey{HsH}{parskip}{% + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tempa}{% + {never+}{0},% + {never*}{1},% + }{#1} + \if@atdocument + \ClassError{\HsHClassName}{ + option `parskip' can only be configured in preamble! + } + \fi + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tempa% 0 + \endgroup + \AtEndOfClass{\setparsizes{\z@}{\z@}{.3333\linewidth \@plus 1fil}} + \or% 1 + \endgroup + \AtEndOfClass{\setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}} + \else% should never be + \endgroup + \fi + \else + \endgroup + \HsH@Options@PassToParrent{parskip=#1} + \FamilyKeyStateProcessed + \fi } -\DeclareOption{f3}{ - \renewcommand{\HsHlogoPage}{4} +\def\HsH@opt@headheight{} +\FamilyStringKey{HsH}{headheight}{\HsH@opt@headheight} +\AtEndOfClass{% + \headheight=\HsH@opt@headheight% } -\DeclareOption{f4}{ - \renewcommand{\HsHlogoPage}{5} +\DefineFamilyKey{HsH}{twoside}[semi]{% + \HsH@Options@PassToParrent{twoside=#1,BCOR=1cm} + \FamilyKeyStateProcessed } -\DeclareOption{f5}{ - \renewcommand{\HsHlogoPage}{6} +\def\HsH@opt@language{nil} +\FamilyStringKey{HsH}{language}{\HsH@opt@language} +\HsH@Options@DeclareAlias{english}{language=english} +\HsH@Options@DeclareAlias{german}{language=ngerman} +\HsH@Options@DeclareAlias{ngerman}{language=ngerman} +\def\HsH@opt@faculty{1} +\FamilyNumericalKey{HsH}{faculty}{HsH@opt@faculty}{% + {none}{1}, {false}{1},% + {f1}{2}, {1}{2},% + {f2}{3}, {2}{3},% + {f3}{4}, {3}{4},% + {f4}{5}, {4}{5},% + {f5}{6}, {5}{6},% } -\DeclareOption{sans}{ - \renewcommand{\familydefault}{\sfdefault} +\HsH@Options@DeclareAlias{f1}{faculty=f1} +\HsH@Options@DeclareAlias{f2}{faculty=f2} +\HsH@Options@DeclareAlias{f3}{faculty=f3} +\HsH@Options@DeclareAlias{f4}{faculty=f4} +\HsH@Options@DeclareAlias{f5}{faculty=f5} +\FamilyBoolKey{HsH}{todos}{@todos} +\DefineFamilyKey{HsH}{@else@}{ + \HsH@Options@PassToParrent{#1} + \FamilyKeyStateProcessed } -\DeclareOption{roman}{ - \renewcommand{\familydefault}{\rmdefault} +\DeclareOption*{ + \HsH@Options@PassToParrent{\CurrentOption} } -\DeclareOption{todos}{ - \@todostrue +\FamilyExecuteOptions{HsH}{% + fontfamily=sans-serif, + fontsize=11pt, + language=ngerman, + parskip=never+, + linespacing=single, + headheight=2.15\baselineskip, + toc=listof, + toc=bibliography, + faculty=none, } -%% defere all other options to the base class -\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrartcl}} -\ExecuteOptions{fontsize=11pt,a4paper,ngerman,sans} % default options -\ProcessOptions\relax -%% Load KOMA class -\LoadClass{scrartcl} -\KOMAoption{toc}{bibliography,listof} - -%% package loading and config --------------------------------------------------------------------- -\PassOptionsToPackage{utf8}{inputenc} -\RequirePackage{inputenc} -\PassOptionsToPackage{T1}{fontenc} -\RequirePackage{fontenc} -\RequirePackage{lmodern} -\RequirePackage{graphicx} -\RequirePackage{amsmath} -\PassOptionsToPackage{vmargin=6\baselineskip,bindingoffset=0.08\paperwidth,textwidth=0.75\paperwidth}{geometry} -\if@todos - \setlength{\marginparwidth}{6cm} - \PassOptionsToPackage{paperwidth=\dimexpr +0.915\paperwidth+\marginparsep+\marginparwidth+0.25cm, right=\dimexpr +\marginparsep+\marginparwidth+0.25cm}{geometry} -\else - \PassOptionsToPackage{nomarginpar}{geometry} -\fi -\RequirePackage{geometry} -\if@german - \PassOptionsToPackage{ngerman}{babel} -\else - \PassOptionsToPackage{english}{babel} -\fi -\RequirePackage{babel} +\FamilyProcessOptions{HsH}\relax +\LoadClass{\HsHClassName@ParrentClass} +\RequirePackage[T1]{fontenc} +\RequirePackage{type1ec} +\RequirePackage[main=\HsH@opt@language]{babel} +\RequirePackage[autostyle=true]{csquotes} +\MakeOuterQuote{"} \iflanguage{ngerman}{\RequirePackage{ziffer}}{}% -\PassOptionsToPackage{headsepline}{scrlayer-scrpage} -\RequirePackage{scrlayer-scrpage} -\RequirePackage{scrhack} -\PassOptionsToPackage{hidelinks}{hyperref} -\RequirePackage{hyperref} -\PassOptionsToPackage{hypcap=true}{caption} -\RequirePackage{caption} +\RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' \RequirePackage{bookmark} -\PassOptionsToPackage{babel}{csquotes} -\iflanguage{ngerman}{\PassOptionsToPackage{german=quotes}{csquotes}}{}% -\RequirePackage{csquotes} -\MakeOuterQuote{"} +\AtBeginDocument{ + \hypersetup{ + pdfinfo={ + Title={\@title}, + Author={\@author}, + Subject={\@subject}, + Keywords={\@keywords} + } + } +} \if@todos - \PassOptionsToPackage{svgnames}{xcolor} \PassOptionsToPackage{ textsize=small, figwidth=.6\textwidth }{todonotes} \RequirePackage{todonotes} - \setlength{\marginparwidth}{5.2cm} \else - \newcommand{\listoftodos}[1]{} - \newcommand{\todo}[2]{} - \newcommand{\missingfigure}[2]{} + \newcommand{\listoftodos}[1]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} \fi -\RequirePackage{pgffor} -%% options for not loaded packages ---------------------------------------------------------------- -\PassOptionsToPackage{backend=biber,style=alphabetic,sorting=nyt}{biblatex} +\RequirePackage[hypcap=true]{caption} +\RequirePackage{graphicx} +\RequirePackage{amsmath,amssymb,amsfonts} +\RequirePackage[svgnames]{xcolor} +\RequirePackage{scrhack} +\PassOptionsToPackage{backend=biber}{biblatex} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}} + }{}% + \makeatother +} \PassOptionsToPackage{free-standing-units}{siunitx} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} - -%% title matters ---------------------------------------------------------------------------------- -\newcommand*{\@shorttitle}{\@empty} +\AtBeginDocument{ + \makeatletter + \InputIfFileExists{HsH-classes.cfg}{ + \ClassInfo{\HsHClassName}{Local config file HsH-classes.cfg used.} + }{ + \ClassInfo{\HsHClassName}{No HsH-classes.cfg!! I hope you configered it yourself.} + } + \makeatother +} +\newcommand{\HsHlogoPath}{HSH-Logo.pdf} +\newcommand{\HsHlogoPage}{\HsH@opt@faculty} +\newcommand{\includeHsHlogohere}[1][5cm]{ + \IfFileExists{\HsHlogoPath}{ + \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} + }{ + \ClassError{\HsHClassName}{\HsHlogoPath\space not found!}{ + The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location + } + } +} +\let\@author\@empty \renewcommand{\title}[2][]{ \gdef\@title{#2} \gdef\@shorttitle{#1} } -\newcommand*{\@matrikelnr}{} +\def\@shorttitle{\@empty} \newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}} -\newcommand*{\@professor}{} +\def\@matrikelnr{\@empty} \newcommand{\professor}[1]{\gdef\@professor{#1}} -\newcommand*{\@firstexaminer}{} +\def\@professor{\@empty} \newcommand{\firstexaminer}[1]{\gdef\@firstexaminer{#1}} -\newcommand*{\@secondexaminer}{} +\def\@firstexaminer{\@empty} \newcommand{\secondexaminer}[1]{\gdef\@secondexaminer{#1}} -\newcommand*{\@keywords}{} +\def\@secondexaminer{\@empty} \newcommand{\keywords}[1]{\gdef\@keywords{#1}} -\let\@author\@empty -\let\@keywords\@empty - -%% typesetting indexes upright or standart -\def\subinrm#1{\sb{\mathrm{#1}}} -{\catcode`\_=13 \global\let_=\subinrm} -\newcommand\upsubscripts{\catcode`\_=12 } -\newcommand\normalsubscripts{\catcode`\_=8 } +\def\@keywords{\@empty} +\RequirePackage{pgffor} +\newcommand{\declarationofauthorship}[1][b]{ + \if#1b + \vspace*{\fill} + \hrule + \else\if#1t + \vspace*{2em} + \else + \ClassError{\HsHClassName}{Wrong Parameter for `\declarationofauthorship'}{ + `\string\declarationofauthorship' only accepts `t' and `b' as parameters. + } + \fi\fi + \vskip 3em + {\centering\bfseries\usekomafont{section}{\decofauthname}\par} + \vskip 3em + \decofauthtext\par + \begingroup + \renewcommand{\thanks}{\sbox0} + \raggedleft + \foreach \tmp@ in \@author { + \if\tmp@\empty\else + \hskip 1em \parbox{4cm}{ + \vskip 4em + \hrule\vskip 4pt + \raggedleft\footnotesize\tmp@ + }% + \fi + }\par + \endgroup +} +\newif\ifsingleauthor +\AtBeginDocument{ + \begingroup + \newcount\count@ + \count@=\z@ + \@for\tmp@:=\@author\do{\advance\count@\@ne} + \ifnum\count@>\@ne\global\singleauthorfalse\else\global\singleauthortrue\fi + \endgroup +} +\newcommand{\decofauthname}{Declaration of Authorship} +\newcaptionname{english}\decofauthname{Declaration of Authorship} +\newcaptionname{german,ngerman}\decofauthname{Selbstst\"andigkeitserkl\"arung} +\newcommand{\decofauthtext}{Language not supported!} +\newcaptionname{english}\decofauthtext{% + \ifsingleauthor{I}\else{We}\fi\space hereby certify that the work \ifsingleauthor{I}\else{we}\fi\space + \ifsingleauthor am\else are\fi\space submitting is entirely of \ifsingleauthor{my}\else{our}\fi own + making except where otherwise indicated. \ifsingleauthor{I}\else{We}\fi\space + \ifsingleauthor{am}\else{are}\fi\space aware of regulations concerning plagiarism, including + disciplinary actions that may result from it. Any use of the works of any other author, in any form, + is properly acknowledged at their point of use. +} +\newcaptionname{german,ngerman}\decofauthtext{% + Hiermit best{\"a}tige\ifsingleauthor\else{n}\fi\space \ifsingleauthor ich\else wir\fi, dass die + folgende Arbeit eigenst{\"a}ndig von \ifsingleauthor{mir}\else{uns}\fi\space allein erstellt und + unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem Arbeitsmaterial + unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines + Plagiats, inklusive disziplinarischer Ma{\ss}nahmen, sind \ifsingleauthor{mir}\else{uns}\fi\space + bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmenals solche kenntlich gemacht. +} +\def\declarationAuthorship{% + \ClassWarning{\HsHClassName}{% + Command \string\declarationAuthorship\space is deprecate.\MessageBreak + Replace it with \string\declarationofauthorship. + }% + \declarationofauthorship% +} +\newcommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} +\def\@subinrm#1{\sb{\mathrm{#1}}} +{\catcode`\_=13 \global\let_=\@subinrm} +\newcommand\upsubscripts{\catcode`\_=12} +\newcommand\normalsubscripts{\catcode`\_=8} +\RequirePackage{lmodern} +\areaset[current]{0.75\paperwidth}{0.8\paperheight} +\if@todos + \addtolength\paperwidth{5cm} + \addtolength\marginparwidth{5cm} +\fi +\renewcommand{\fps@figure}{h!t} +\renewcommand{\fps@table}{h!t} +\g@addto@macro\@floatboxreset\centering +\setcapwidth{0.8\textwidth} +\defcaptionname{english}\figurename{Fig.} +\defcaptionname{german,ngerman}\figurename{Abb.} +\defcaptionname{english}\tablename{Tab.} +\defcaptionname{german,ngerman}\tablename{Tab.} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{subfigure}{ + \let\subfigureautorefname\figureautorefname + }{}% + \makeatother +} +\renewcommand{\labelitemi}{\raisebox{.3ex}{\scalebox{0.7}{$\bullet$}}} +\renewcommand{\labelitemii}{\raisebox{.3ex}{\scalebox{0.7}{$\circ$}}} +\renewcommand{\labelitemiii}{\raisebox{.1ex}{-}} +\renewcommand{\labelitemiv}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}} \upsubscripts - -%% header and footer -\clearpairofpagestyles -\ofoot*{\pagemark} +\raggedbottom +\let\layercontentsmeasure\relax +\RequirePackage{scrlayer-scrpage} +\FamilyOptions{KOMA}{headsepline,singlespacing=true} \newpagestyle{HsHheadings}{ { \parbox[b]{\sls@headwidth}{ @@ -189,119 +377,25 @@ {\hfill\pagemark} {\hfill\pagemark} } +\clearpairofpagestyles +\ofoot*{\pagemark} \pagestyle{HsHheadings} \automark{section} - -%% floats -\renewcommand{\fps@figure}{h!t} -\renewcommand{\fps@table}{h!t} -\ifx\KOMAScriptVersion\undefined\else - \g@addto@macro\@floatboxreset\centering - \setcapwidth{0.8\textwidth} -\fi -\iflanguage{english}{ - \renewcaptionname{english}{\figurename}{Fig.} - \renewcaptionname{english}{\tablename}{Tab.} -}{}% -\iflanguage{ngerman}{ - \renewcaptionname{ngerman}{\figurename}{Abb.} - \renewcaptionname{ngerman}{\tablename}{Tab.} - \renewcaptionname{ngerman}{\abstractname}{Abstract} -}{}% - -%% styling for itemize -\renewcommand{\labelitemi}{$\bullet$} -\renewcommand{\labelitemii}{$\circ$} -\renewcommand{\labelitemiii}{$-$} -\renewcommand{\labelitemiv}{$\cdot$} - -%% do stuff -\setlength\parindent{0pt} -\raggedbottom -\let\layercontentsmeasure\relax - -%% custom commands -\newcommand{\uproman}[1]{\uppercase\expandafter{\romannumeral#1}} -\newcommand{\lowroman}[1]{\romannumeral#1\relax} - -%% load config at beginning of document -\AtBeginDocument{ - \makeatletter - \@ifpackageloaded{biblatex}{ - \renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}} - }{} - \@ifpackageloaded{subfigure}{ - \newcommand{\subfigureautorefname}{\figureautorefname} - }{} - \InputIfFileExists{HsH-classes.cfg}{ - \ClassInfo{\HsHClassName}{HsH-classes.cfg was found. Using it...} - }{ - \ClassInfo{\HsHClassName}{no HsH-classes.cfg!! I hope you configered it yourself.} - } - %% provide some usefull commands: - \providecommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} - \makeatother -} -%% declaration of Authorship ---------------------------------------------------------------------- -\iflanguage{english}{ - \setlocalecaption{english}{authorshipdeclaration}{Declaration of Authorship} -}{}% -\iflanguage{ngerman}{ - \setlocalecaption{ngerman}{authorshipdeclaration}{Selbstst\"andigkeitserkl\"arung} -}{}% -\newif\if@oneAuthor \@oneAuthortrue -\newcommand{\declarationofauthorship}[1][b]{ - \let\@param#1 - \renewcommand{\thanks}{\sbox0} - \foreach \x [count=\i] in \@author{\ifnum\i>1\global\@oneAuthorfalse\fi} - \thispagestyle{plain} - \if\@param b\vspace*{\fill}\fi - {\rule{\textwidth}{0.1pt}} - \vskip 3em - {\centering\huge\bfseries\authorshipdeclarationname\par} - \vskip 3em - \iflanguage{english}{ - \if@oneAuthor I\else We\fi\space hereby certify that the work \if@oneAuthor I\else we\fi\space \if@oneAuthor am\else are\fi\space submitting - is entirely of \if@oneAuthor my\else our\fi own making except where otherwise indicated. \if@oneAuthor I\else We\fi\space - \if@oneAuthor am\else are\fi\space aware of regulations concerning plagiarism, including disciplinary actions that may result from it. Any use - of the works of any other author, in any form, is properly acknowledged at their point of use. \par - }{}% - \iflanguage{ngerman}{ - Hiermit best{\"a}tige\if@oneAuthor\else n\fi\space \if@oneAuthor ich\else wir\fi, dass die folgende Arbeit eigenst{\"a}ndig von - \if@oneAuthor mir\else uns\fi\space allein erstellt und unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem - Arbeitsmaterial unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines Plagiats, inklusive - disziplinarischer Ma{\ss}nahmen, sind \if@oneAuthor mir\else uns\fi\space bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmen - als solche kenntlich gemacht. \par - }{}% - {\raggedleft - \foreach \x in \@author{ - \begin{tabular}[t]{r} - \\[3em] - \rule{4cm}{0.4pt}\\ - {\footnotesize\x} - \end{tabular} - } - \par} - \if\@param t\vspace*{\fill}\fi -} -\let\declarationAuthorship\declarationofauthorship - -%% reconfig Titlepage ----------------------------------------------------------------------------- -\iflanguage{english}{ - \setlocalecaption{english}{professor}{Professor} - \setlocalecaption{english}{firstexaminer}{First examiner} - \setlocalecaption{english}{secondexaminer}{Second examiner} -}{}% -\iflanguage{ngerman}{ - \setlocalecaption{ngerman}{professor}{Professor(in)/Lehrbeauftragte(r)} - \setlocalecaption{ngerman}{firstexaminer}{Erstpr{\"u}fer(in)} - \setlocalecaption{ngerman}{secondexaminer}{Zweitpr{\"u}fer(in)} -}{}% +\newcommand{\professortext}{Professor} +\newcommand{\firstexaminertext}{First examiner} +\newcommand{\secondexaminertext}{Second examiner} +\newcaptionname{english}\professortext{Professor} +\newcaptionname{english}\firstexaminertext{First examiner} +\newcaptionname{english}\secondexaminertext{Second examiner} +\newcaptionname{german,ngerman}\professortext{Professor(in)/Lehrbeauftragte(r)} +\newcaptionname{german,ngerman}\firstexaminertext{Erstpr{\"u}fer(in)} +\newcaptionname{german,ngerman}\secondexaminertext{Zweitpr{\"u}fer(in)} \newtoks\@tabtoks \newcommand\addtabtoks[1]{\global\@tabtoks\expandafter{\the\@tabtoks#1}} \newcommand\eaddtabtoks[1]{\edef\mytmp{#1}\expandafter\addtabtoks\expandafter{\mytmp}} \newcommand*\printtabtoks{\the\@tabtoks} \addtokomafont{publishers}{\normalsize} +\g@addto@macro\titlepage{\singlespacing} \renewcommand\maketitle[1][c]{ \expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax \else @@ -329,8 +423,9 @@ \begingroup \let\@param#1 \ifx\@param\@empty - \ClassError{\HsHClassName}{\maketitle\space with empty option}{ - \maketitle[] has been called with an empty parameter, this doesn't work. Use \maketitle instead. + \ClassError{\myClassName}{\maketitle\space with empty option}{ + \maketitle[] has been called (with an empty parameter), this doesn't work. + Use \maketitle instead. } \fi \let\titlepage@restore\relax @@ -402,9 +497,9 @@ \if\@param l\begin{tabular}{@{}l l}\fi \if\@param c\begin{tabular}{l l}\fi \if\@param r\begin{tabular}{r r@{}}\fi - \if\@professor\@empty\else\textbf{\professorname:}&\@professor\\\fi - \if\@firstexaminer\@empty\else\textbf{\firstexaminername:}&\@firstexaminer\\\fi - \if\@secondexaminer\@empty\else\textbf{\secondexaminername:}&\@secondexaminer\\\fi + \if\@professor\@empty\else\textbf{\professortext:}&\@professor\\\fi + \if\@firstexaminer\@empty\else\textbf{\firstexaminertext:}&\@firstexaminer\\\fi + \if\@secondexaminer\@empty\else\textbf{\secondexaminertext:}&\@secondexaminer\\\fi \end{tabular} } \ifx\@dedication\@empty\else diff --git a/src/HsH-classes.dtx b/src/HsH-classes.dtx index dde6b40cd9446566cfce2e15863552912d538302..13cf50c6d4aa6ffcb197c81fdf9dd5bf503cdaaf 100644 --- a/src/HsH-classes.dtx +++ b/src/HsH-classes.dtx @@ -66,239 +66,1328 @@ http://www.latex-project.org/lppl.txt % \fi % % \iffalse -%<*driver> -\documentclass{ltxdoc} -\begin{document} -\end{document} +%<*driver> ^^A ---------- file headers ------------------------------------------------- +\ProvidesFile{HsH-classes.dtx} +%</driver> +%<article|report|standalone>\NeedsTeXFormat{LaTeX2e}[2022-06-01] +%<article>\ProvidesClass{HsH-article} +%<report>\ProvidesClass{HsH-report} +%<standalone>\ProvidesClass{HsH-standalone} +%<*article|report|standalone> + [2024-04-23 3.00 HsH-class based on KOMA] +%</article|report|standalone> +%<*driver> ^^A ---------- documentation driver ----------------------------------------- + \documentclass{ltxdoc} + \usepackage{doc}[2022-06-01] + \usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry} + \usepackage[numbered]{hypdoc} + \usepackage[style=ddmmyyyy,datesep={.}]{datetime2} + \usepackage{scrlogo} + % + \NewDocElement[idxgroup=classes]{Class}{class} + \NewDocElement{Option}{option} + \providecommand\opt{\texttt} + \newenvironment{options}% + {\begin{list}{}{% + \renewcommand{\makelabel}[1]{\opt{##1}\hfil}% + \setlength{\itemsep}{-.5\parsep} + \settowidth{\labelwidth}{\texttt{xxxxxxxxx\space}}% + \setlength{\leftmargin}{\labelwidth}% + \addtolength{\leftmargin}{\labelsep}}% + \raggedright} + {\end{list}} + \newenvironment{packages}% + {\begin{list}{}{% + \renewcommand{\makelabel}[1]{\pkg{##1}\hfil}% + \setlength{\itemsep}{-.5\parsep} + \settowidth{\labelwidth}{\texttt{xxxxxxx\space}}% + \setlength{\leftmargin}{\labelwidth}% + \addtolength{\leftmargin}{\labelsep}}% + \raggedright} + {\end{list}} + \newenvironment{note}[1]{\begin{quote}\textbf{Note:}\;#1}{\end{quote}} + \def\paragraph#1{\bigskip\textbf{#1}\\} + \newcommand\OR{\kern1pt{|}\kern1pt} + % + \renewcommand{\familydefault}{\sfdefault} + \setlength\parindent{0pt} + \setcounter{IndexColumns}{2} + \setlength\marginparsep{2\labelsep} + % + \EnableCrossrefs + \RecordChanges + % + \GetFileInfo{\jobname.dtx} + \title{ + \textsf{HsH-Classes} --- A set of \LaTeX{} classes for use in Hochschule Hannover + \thanks{This file describes version \fileversion, last revised \filedate.} + } + \author{Jan Wille\thanks{E-mail: mail@janiwlle.de}} + \MaintainedBy{Maintained on \url{https://lab.it.hs-hannover.de/qxx-tul-u1/latex-template-hsh}} + \date{Printed \today} + \begin{document} + \maketitle + \begin{multicols}{2} + \tableofcontents + \end{multicols} + \DocInput{\jobname.dtx} + \end{document} %</driver> % \fi +% +%^^A ---------- change log ------------------------------------------------------------- +%\changes{v1.00}{2021-11-09}{Initial Version. Official first release} +%\changes{v2.00}{2023-08-08}{This version changes the default build-system to \texttt{latexmk}} +% +% +%^^A ---------- document body ---------------------------------------------------------- +% +% \vspace{2\baselineskip} +% \begin{abstract} +% The following documents a set of \LaTeX{} classes created for the Hochschule Hannover. +% They are intended to ease the workflow when writing documents by providing a common +% formating basis that should work for pretty much everything a studend will be expected +% to write. This can be simple one-paged documents, excercises, lab-reports, papers or +% bachelors and masters thesises. +% +% The classes provide interfaces to modify commend requriements, provide commands to get +% specifics like the logo and provide and pre-configure comonly needed packages. This +% should get you going imidealty and reduce the setuptime significantly. +% \end{abstract} +% +% +% \clearpage +% \section{The different classes} +% +% The project classes provided by the Project all carry the |HsH-| prefix. Here is a +% list of the available classes and some expleantion on when to use which class. +% \begin{description} +% \item\DescribeClass{HsH-article} +% A article-class based on \KOMAScript{}s \cls{scrartcl}. +% It is designed for quick and compact documents and is useful for writing +% lab-protocols and alike. It does not have chapters and therefore never +% breaks to a new page on its own. +% \item\DescribeClass{HsH-report} +% A report-class based on \KOMAScript{}s \cls{scrreprt}. +% This is probably the most useful class, as it can be used for a wide +% variety of documents (beginning with lab-reports and ending at complete +% thesis). The line between article and report is somewhat blurry, so use +% as you see fit. +% \item\DescribeClass{HsH-standalone} +% A helper class based based on the \cls{standalone} +% class. It is designed only for creating images as separate documents to +% keep things organized and compiler times low. It is useful for creating +% graphs, circuit diagrams or other kind of complex sub documents. +% \end{description} +% +% \section{Document options} +% To configure the behavior and style of documents using this class, options can be +% passed via the |\documentclass|\oarg{options}\marg{document-class} command. +% +% It should be noted that all unknown keys will pe passed to the parrent class and a +% log-message issued. +% +% \subsection{Generic options share by all classes} +% These Options are avalable regardless of documentclass and modify common things. +% +% \DescribeOption{fontfamily} \DescribeOption{sans}\DescribeOption{roman} +% The \opt{fontfamily=\meta{opt}} option configures which font-style is used. +% For convenience there are also short-forms providet. +% The avalable options are: +% \begin{options} +% \item[sans\OR sans-serif] A sans-serif font is used (similar to Arial) +% \item[roman\OR serif] A serif font is udes (similar to Times-new-Roman) +% \end{options} +% +% \DescribeOption{language} \DescribeOption{english}\DescribeOption{german} +% The \opt{language=\meta{opt}} option set the main language you write in. It ensures +% texts like auto-generated headings are localised properly. +% You can pass in any language-name understood by the \pkg{babel} package. German is +% the default. +% For convenience there are also short-forms providet. +% +% \medskip +% \DescribeOption{todos} +% The \opt{todos} option is a simple switch that activates support for the +% \pkg{todonotes} package. It enables/\-disables the package as well as increasing +% the pagewidth to make space for the notes. +% +% You can use the commands from the package to make notes and other anotations +% (similar to how MS-Words comments work). When you pass \opt{off\OR false} all the +% anotation will disaper from the PDF while still beeing in the source. +% \begin{note} +% setting \opt{todos=off} after having used the option will mostlikly produce +% compilation errors. These will go away after you remove the temporary files. +% \end{note} +% +% \subsection{Options for modifying the document} +% The following options are only avalable for documents (so not utility classes). +% +% \DescribeOption{linespacing} +% \DescribeOption{singlespacing}\DescribeOption{onehalfspacing}\DescribeOption{doublespacing} +% The \opt{linespacing=\meta{opt}} option configures the spacing in beween lines. +% For convenience there are also short-forms providet. +% The avalable options are: +% \begin{options} +% \item[single] No additional space is added in between lines. +% \item[onehalf] Aproximalty half a line of empty space is added inbetween lines. +% \item[double] About a full linehight is left in between lines. +% \end{options} +% +% \DescribeOption{parskip} +% The \opt{parskip=\meta{opt}} option configures the spacing in beween paragraphs. +% This is a option originally implemented by \KOMAScript{} (see \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf?page=239#table.3.7}{its manual}) +% so all its options apply. The class only adds additional options. \par +% For you convinience the relevant options are also listed here: +% +% \begin{options} +% \item[false\OR off] Paragraphs are identified by indentation of the first line by +% 1\,em. There is no spacing requirement at the end of the last line of a +% paragraph. +% \item[full\OR true\OR on] Paragraphs are identified by a vertical space of one line +% between paragraphs. There must be at least 1\,em of free space at the end of +% the last line of the paragraph. +% \item[full-] Paragraphs are identified by a vertical space of one line between +% paragraphs. There is no spacing requirement at the end of the last line of a +% paragraph. +% \item[full+] Paragraphs are identified by a vertical space of one line between +% paragraphs. There must be at least a third of a line of free space at the end +% of a paragraph. +% \item[full*] Paragraphs are identified by a vertical space of one line between +% paragraphs. There must be at least a quarter of a line of free space at the +% end of a paragraph. +% \item[half] Paragraphs are identified by a vertical space of half a line between +% paragraphs. There must be at least 1\,em free space at the end of the last +% line of a paragraph. +% \item[half-] Paragraphs are identified by a vertical space of half a line between +% paragraphs. There is no spacing requirement at the end of the last line of a +% paragraph. +% \item[half+] Paragraphs are identified by a vertical space of half a line between +% paragraphs. There must be at least a third of a line of free space at the end +% of a paragraph. +% \item[half*] Paragraphs are identified by a vertical space of half a line between +% paragraphs. There must be at least a quarter of a line of free space at the +% end of a paragraph. +% \item[never] No inter-paragraph spacing will be inserted even if additional +% vertical spacing is needed for vertical adjustment with |\flushbottom|. +% \item[never+] No inter-paragraph spacing will be inserted. There must be at least a +% third of a line of free space at the end of a paragraph. +% \item[never*] No inter-paragraph spacing will be inserted. There must be at least a +% quarter of a line of free space at the end of a paragraph. +% \end{options} +% +% +% \DescribeOption{headheight} +% The \opt{headheight=\meta{dim}} option allows you to set the required size of the +% header. You may need to modify this if you get a |\headheight|\emph{ to low} error +% message. The emssage should tell you what value you need, but you can pass any +% valid length. +% +% \paragraph{Often relevant \KOMAScript\ options} +% The following options are implemented by the parrent classes and only listed here +% for completness. For more detils, see \href{http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf?page=239#chapter.3}{its manual}. +% \smallskip +% +% \DescribeOption{fontsize} +% The \opt{fontsize=\meta{size}} options takes a size in \opt{pt}. It is usually in therange of +% 10-12, but other sizes can work as well. +% +% \DescribeOption{paper} +% The \opt{paper=\meta{size}} options accepts a number of options, most ISO formats +% are supported, but also others like \opt{letter} or \opt{legal}. +% +% \DescribeOption{twoside} +% The \opt{twoside} option sets your document up for doublesided printing. The header +% and footer will take this into account and binding-correction will be applide along +% the inner edge. +% +% \DescribeOption{BCOR} +% The \opt{BCOR=}\meta{dim} option allows you to define a custom binding-correction. +% Any valid length can be put here, but to large of a value will shrink the outer +% margin to a not-desirable level. +% +% +% \subsection{Standalone specific options} +% The \cls{standalone} utillity class has some special options which are documented +% here. +% \smallskip +% +% \DescribeOption{margin} +% The \opt{margin=}\meta{dim} option controlls how much whicspace is added arround +% you standalone document. This usually looks better which is why the default is +% 0.25\,cm, but you can supress it by passing 0\,cm. +% +% \DescribeOption{multi} +% The \opt{multi=}\meta{opt} option defines which enviroment make up a page. It can +% be passe more than once. +% +% +% \section{Provided commands} +% The clases define a set of commands which are explained in the following section. +% +% \DescribeMacro{\HsHClassName} +% Each class defines the macro |\HsHClassName| to contain its classname. This is +% mostly usefull so internals can reuse the classname, but you could also check +% against it if you needed to. +% +% \subsection{Title matters} +% \LaTeX{} has a set of default commands which are used to define data for the +% titlepage, like |\title| or |\author|. The classes define a few additional +% commands, which are documented her. +% \smallskip +% +% \DescribeMacro{\matrikelnr} +% The |\matrikelnr|\marg{nr[, ..]} macro sets the matrikelnumber of the author(s). +% It can be a single number or a comma seperated list of numbers. The numbers will +% be matched to the authors passed into |\author|. +% +% \DescribeMacro{\professor} +% You can pass any text to |\professor|\marg{text}, it will be printed on the +% bottom of the titelpage. +% +% \DescribeMacro{\keywords} +% This macro can be used to define keywords which are relevant to your document. +% They will be printed as part of the abstract and be put into the PDF's meta-data. +% +% \paragraph{Modifying the Logo} +% \DescribeMacro{\HsHlogoPath} +% The logo is loaded from a file whos name is read from \cmd{\HsHlogoPath}. Change +% it to use a different logo-file. +% +% \DescribeMacro{\HsHlogoPage} +% As the PDF file can hae multiple pages, the \cmd{\HsHlogoPage} command stores +% which page to load. +% +% \DescribeMacro{\includeHsHlogohere} +% The macro \cmd{\includeHsHlogohere\oarg{width}} is used by |\maketitle| to produce +% the logo. But if you want it elsewhere, you cann call this macro yourself. +% +% +% \subsection{Commands for document writing} +% The following commands will be usefull to you when writing a document. +% \smallskip +% +% \DescribeMacro{\declarationofauthorship} +% The command |\declarationofauthorship|\oarg{align} can be used to print a +% "declatation of authorship" in the current location, similar to how +% |tableofcontens| and friends work. +% +% It will produce a horizontal line, a text block containing the regulatory text and +% a signature block for every author. The command is localised for both english and +% german. Using the optional argument, you can define the positioning. Pass \opt{t} +% for alignment at the top of the page and \opt{b} for bottom alignment +% (\emph{default}). +% +% \smallskip +% The three commands \cmd{\frontmatter},\cmd{\mainmatter} and \cmd{\backmatter} are +% provided for \cls{report} classes. They seperate document section and +% automatically set up pagenumer styles. \par +% \DescribeMacro{\frontmatter} +% \cmd{\frontmatter} set the pagenumers to capital roman numerals. This is usually +% required for everything before the first chapter. \par +% \DescribeMacro{\mainmatter} +% \cmd{\mainmatter} sets the pagenumbering to "normal" arabic numbers. This is +% usually the style for the document content. \par +% \DescribeMacro{\backmatter} +% \cmd{\backmatter} can be used for apendixes and alike. It sets the pagenumbering +% to small roman numerals. +% +% +% \subsection{Default \LaTeX{} Commands that are modified} +% Additionaly, some of \LaTeX{}s default commands are moddified to better fit this +% class. This is documented here. +% +% \DescribeMacro{\title} +% The \cmd{\title\oarg{short-title}\marg{title}} command now takes an additional, +% optional argument. You can use it for a shorter version of your title, that will +% be used in the header to save on space. +% +% \DescribeMacro{\maketitle} +% The |\maketilte| command if \LaTeX{} default way to create a titlepage. We +% redefine it to produce a titlepage that matches the sytel typically used on the +% Hochschle Hannover. This incudes the logo beeing printed, depending on the +% \opt{f1} to \opt{f5} documentoptions. \par +% The command now also takes an options alignment-parameter: +% |\maketitle|\oarg{align}. You can pass \opt{l\OR c\OR r} to get \emph{left}, +% \emph{center} or \emph{right} alignment. +% +% +% \section{Package laoding} +% The classes load some packges for internal use as well as loading and configuring +% common use packages. The details are documented in the following section. +% +% \subsection{Allways loaded packages} +% \begin{packages} +% \item[fontenc] for output encoding, set to the european characterset +% \item[babel] for langauge-specific typesetting +% \item[bookmark] creates bookmoarks in the PDF +% \item[hyperref] for easy referencing and linking +% \item[caption] to customize captions and make references point to the beginning +% of the floats +% \item[graphicx] for importing and manipultating images +% \item[amsmath,amssymb,amsfonts] more options when typesetting math +% \item[lmodern] sets up the Latin-Modern font +% \item[setspace] used for configuring linespacing +% \end{packages} +% +% There are also some packages for internal functionalaty that shouln't conserne the +% user, but they are listed here for completness. +% \begin{packages} +% \item[scrbase] +% \item[pgffor] +% \end{packages} +% +% \subsection{Conditionally loaded Packages} +% A subset of packages is only loaded (or loaded with specifig options) depending +% on options passed to the package +% \begin{packages} +% \item[babel] gets configured depending on \opt{language} +% \item[csquotes] for language-specific quotations marks +% \item[ziffer] only loaded for german documents, sets comma as decimal seperatior +% \item[todonotes] loaded depending on \opt{todos} +% \end{packages} +% +% \subsection{Pre-configured Packages} +% These packages are coonfigured by the class to work in a cooperative way. The +% user must load them in this preable via |\usepackage|\marg{pkg-name} however, as +% loading them allways bears additional, unnecicary overhead. +% +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} +% +% \section{Implementation} +% +%\iffalse docstrip-guard %<*article|report|standalone> -\typeout{Adapted from KOMA script for use in Hochschule Hannover <2023-08-12> Jan Wille} -\NeedsTeXFormat{LaTeX2e} +%\fi % -%<article>\newcommand{\HsHClassName}{HsH-article} -%<report>\newcommand{\HsHClassName}{HsH-report} -%<standalone>\newcommand{\HsHClassName}{HsH-standalone} -\ProvidesClass{\HsHClassName}[2023/08/12 v2.1 HsH-Class based on KOMA] - -%% commands for HsH-logo -\newcommand{\HsHlogoPath}{HSH-Logo.pdf} -\newcommand{\HsHlogoPage}{1} -\newcommand{\includeHsHlogohere}[1][5cm]{ - \IfFileExists{\HsHlogoPath}{}{ - \ClassError{\HsHClassName}{HsH-Logo.pdf not found!}{ - The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location - } - } - \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} +% \subsection{Internal commands} +% \begin{macro}{\HsHClassName} +% The classname of specific class is stored in the |\HsHClassName| which gets used +% throuout the code. +% \begin{macrocode} +\let\HsHClassName\@currname +% \end{macrocode} +% \end{macro} +% +% There is also a second macro |\HsHClassName@ParrentClass| which stores the parrent +% classes name. +% \begin{macrocode} +\def\HsHClassName@ParrentClass{% +%<article> scrartcl% +%<report> scrreprt% +%<standalone> standalone% } -\newif\if@german% -%<article|report>\newif\if@todos\@todosfalse% - -%% document options ------------------------------------------------------------------------------- -\DeclareOption{german}{ - \@germantrue +% \end{macrocode} +% +% +% \subsection{Option handeling} +% The options are handled using featues provieded by the |KOMA|-Script ecosystem. +% To get access to this the \pkg{srcbase} package is loaded. +% \begin{macrocode} +\RequirePackage{scrbase} +% \end{macrocode} +% +% We also require some packages for some of the option, these are loaded next. +% \begin{macrocode} +\RequirePackage{setspace} +% \end{macrocode} +% +% A new familiy of keys is created and shared by all elelments of this project. +% For that the |\DefineFamily| macro is used. The familiy name is \emph{HsH}, +% matching the usual prefixes. +% \begin{macrocode} +\DefineFamily{HsH} +% \end{macrocode} +% Additionally each class-file represents a member in the family. This is defined +% using the |\DefineFamilyMember| macro. It's optional argument is set to the current +% filename by default, so we do not need to specify it, just the family name to +% attatch it to. +% \begin{macrocode} +\DefineFamilyMember{HsH} +% \end{macrocode} +% +% \begin{macro}{\HsH@Options@PassToParrent} +% To be able to pass options to the parrent class wehre needed easiely, a command is +% defined. It also issues a log-message. +% \begin{macrocode} +\newcommand{\HsH@Options@PassToParrent}[1]{% + \ClassInfoNoLine{\HsHClassName}{passing option to parrent class: #1}% + \PassOptionsToClass{#1}{\HsHClassName@ParrentClass}% } -\DeclareOption{ngerman}{ - \@germantrue +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\HsH@Options@DeclareAlias} +% It is also usefull to have shot-versions of options. The following commands makes +% it easy to decalare these. +% \begin{macrocode} +\newcommand{\HsH@Options@DeclareAlias}[3][HsH]{% + \DeclareOption{#2}{\FamilyExecuteOptions{#1}{#3}}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{option}{fontfamily} +% The first option to be defined is \opt{fontpamily}. It's defined as a +% \emph{Numerical} key so that it can accept multiple options and map them to a +% switch case. +% \begin{macrocode} +\DefineFamilyKey{HsH}{fontfamily}{ + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tmp}{% + {sans}{0}, {sans-serif}{0},% + {roman}{1}, {serif}{1},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tmp% 0 + \endgroup + \renewcommand{\familydefault}{\sfdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \or% 1 + \endgroup + \renewcommand{\familydefault}{\rmdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{english}{ - \@germanfalse +% \end{macrocode} +% \end{option} +% +% \begin{option}{sans,roman} +% For convinience, there are also two short-versions defined. +% \begin{macrocode} +\HsH@Options@DeclareAlias{sans}{fontfamily=sans} +\HsH@Options@DeclareAlias{roman}{fontfamily=roman} +% \end{macrocode} +% \end{option} +% +% \begin{macrocode} +%<*!standalone> +% \end{macrocode} +% +% +% \begin{option}{linespacing} +% The \opt{linespacing} options is also a \emph{Numerical} option, mapping to three +% cases. They execute the apropriate commands of the \pkg{setspace} package. +% \begin{macrocode} +\DefineFamilyKey{HsH}{linespacing}{ + \begingroup + \FamilySetNumerical{HsH}{linespacing}{@tempa}{% + {single}{0},% + {onehalf}{1},% + {double}{2},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tempa% 0 + \endgroup + \if@atdocument\singlespacing\else\AtEndOfClass{\singlespacing}\fi + \or% 1 + \endgroup + \if@atdocument\onehalfspacing\else\AtEndOfClass{\onehalfspacing\AfterTOCHead{\singlespacing}}\fi + \or% 2 + \endgroup + \if@atdocument\doublespacing\else\AtEndOfClass{\doublespacing\AfterTOCHead{\singlespacing}}\fi + + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{f1}{ - \renewcommand{\HsHlogoPage}{2} +% \end{macrocode} +% \end{option} +% +% \begin{option}{singlespacing,onehalfspacing,doublespacing} +% For convinience, there are also these short-versions defined. +% \begin{macrocode} +\HsH@Options@DeclareAlias{singlespacing}{linespacing=single} +\HsH@Options@DeclareAlias{onehalfspacing}{linespacing=onehalf} +\HsH@Options@DeclareAlias{doublespacing}{linespacing=double} +% \end{macrocode} +% \end{option} +% +% +% \begin{option}{parskip} +% The \opt{parskip} option is special in that ist originally a \KOMAScript{} option +% that get expanded by this class. Only two new cases are defined here and everything +% unknown gets passed to the parrent class. \par +% It should also be noted that this option can't execute its code imidealtly, as the +% commands needed are only defined later when the parrent class loads in. So the +% |\setparsizes| command is pushed into a hook. +% \begin{macrocode} +\DefineFamilyKey{HsH}{parskip}{% + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tempa}{% + {never+}{0},% + {never*}{1},% + }{#1} + \if@atdocument + \ClassError{\HsHClassName}{ + option `parskip' can only be configured in preamble! + } + \fi + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tempa% 0 + \endgroup + \AtEndOfClass{\setparsizes{\z@}{\z@}{.3333\linewidth \@plus 1fil}} + \or% 1 + \endgroup + \AtEndOfClass{\setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}} + \else% should never be + \endgroup + \fi + \else + \endgroup + \HsH@Options@PassToParrent{parskip=#1} + \FamilyKeyStateProcessed + \fi } -\DeclareOption{f2}{ - \renewcommand{\HsHlogoPage}{3} +% \end{macrocode} +% \end{option} +% +% \begin{option}{headheight} +% The \opt{headheight} option just stet the |\headheight| to the given value. +% \begin{macrocode} +\def\HsH@opt@headheight{} +\FamilyStringKey{HsH}{headheight}{\HsH@opt@headheight} +\AtEndOfClass{% + \headheight=\HsH@opt@headheight% } -\DeclareOption{f3}{ - \renewcommand{\HsHlogoPage}{4} +% \end{macrocode} +% \end{option} +% +% For the \opt{twoside} option we only redefine the default, everyting else is +% handled by the parrent class. +% \begin{macrocode} +\DefineFamilyKey{HsH}{twoside}[semi]{% + \HsH@Options@PassToParrent{twoside=#1,BCOR=1cm} + \FamilyKeyStateProcessed } -\DeclareOption{f4}{ - \renewcommand{\HsHlogoPage}{5} +% \end{macrocode} +% +% \begin{macrocode} +%</!standalone> +% \end{macrocode} +% +% +% \begin{macro}{\HsH@opt@language} +% First, the macro to store the languages name in is created. The default is |nil|, +% as \pkg{babel} will see this as no-language. +% \begin{macrocode} +\def\HsH@opt@language{nil} +% \end{macrocode} +% \end{macro} +% +% \begin{option}{language} +% The key is than defined to store its value inside the command. This allowes the +% option to be called multiple time, but only the last set value will be passed on to +% \pkg{bable}. +% \begin{macrocode} +\FamilyStringKey{HsH}{language}{\HsH@opt@language} +% \end{macrocode} +% \end{option} +% +% \begin{option}{english,german, ngerman} +% For convinience, there are also these short-versions defined. +% \begin{macrocode} +\HsH@Options@DeclareAlias{english}{language=english} +\HsH@Options@DeclareAlias{german}{language=ngerman} +\HsH@Options@DeclareAlias{ngerman}{language=ngerman} +% \end{macrocode} +% \end{option} +% +% +% \begin{macro}{\HsH@opt@faculty} +% As we need a default value that is not zero, the macro needs to be defined an +% initalised manually. +% \begin{macrocode} +\def\HsH@opt@faculty{1} +% \end{macrocode} +% \end{macro} +% +% \begin{option}{faculty} +% The \opt{faculty} options is once again a \emph{Numerical} option, mapping the five +% faculties and storeing the selected one in |\HsH@opt@faculty|. +% \begin{macrocode} +\FamilyNumericalKey{HsH}{faculty}{HsH@opt@faculty}{% + {none}{1}, {false}{1},% + {f1}{2}, {1}{2},% + {f2}{3}, {2}{3},% + {f3}{4}, {3}{4},% + {f4}{5}, {4}{5},% + {f5}{6}, {5}{6},% } -\DeclareOption{f5}{ - \renewcommand{\HsHlogoPage}{6} +% \end{macrocode} +% \end{option} +% +% \begin{option}{f1,f2,f3,f4,f5} +% For convinience, there are also these short-versions defined. +% \begin{macrocode} +\HsH@Options@DeclareAlias{f1}{faculty=f1} +\HsH@Options@DeclareAlias{f2}{faculty=f2} +\HsH@Options@DeclareAlias{f3}{faculty=f3} +\HsH@Options@DeclareAlias{f4}{faculty=f4} +\HsH@Options@DeclareAlias{f5}{faculty=f5} +% \end{macrocode} +% \end{option} +% +% \begin{option}{todos} +% The boolean option \opt{todos} is simply created using the commands from \pkg{scrbase}. +% Boolean options allready default to \meta{true} if called without and argument, so +% no need to define an explicit alias. +% \begin{macrocode} +\FamilyBoolKey{HsH}{todos}{@todos} +% \end{macrocode} +% \end{option} +% +% For the \cls{standalone} class the \opt{fontsize} option is mocked to present a +% standardised interface. A user might expect this option to be passable to this +% class and we shoulnd crete an anoying error just for this. +% \begin{macrocode} +%<*standalone> +\DefineFamilyKey{HsH}{fontsize}{% + \ClassInfoNoLine{\HsHClassName}{The `fontsize' option is only a mock, its has not effect} + \FamilyKeyStateProcessed } -\DeclareOption{sans}{ - \renewcommand{\familydefault}{\sfdefault} +%</standalone> +% \end{macrocode} +% +% \subsubsection{Unknown options} +% Unknown options will be passed to the parent class. For that a |@else@| key is +% defined on the |HsH| family, which will be execute for every unknown key-value +% option. Unknown bare options are handled by the |\DeclareOption*| command and will +% be passed there. +% \begin{macrocode} +\DefineFamilyKey{HsH}{@else@}{ + \HsH@Options@PassToParrent{#1} + \FamilyKeyStateProcessed } -\DeclareOption{roman}{ - \renewcommand{\familydefault}{\rmdefault} +\DeclareOption*{ + \HsH@Options@PassToParrent{\CurrentOption} } +% \end{macrocode} +% +% +% \subsubsection{Default options} +% The different classes all execute a set of default options, which is handled by the +% following code. +% \begin{macrocode} +\FamilyExecuteOptions{HsH}{% + fontfamily=sans-serif, +%<*!standalone> + fontsize=11pt, + language=ngerman, +%<article> parskip=never+, +%<report> parskip=half+, + linespacing=single, + headheight=2.15\baselineskip, +%</!standalone> %<*article|report> -\DeclareOption{todos}{ - \@todostrue -} + toc=listof, + toc=bibliography, %</article|report> + faculty=none, +%<*standalone> + margin=0.25cm, + multi=tikzpicture, + multi=circuitikz, +%</standalone> +} +% \end{macrocode} % -%% defere all other options to the base class -%<article>\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrartcl}} -%<report>\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrreprt}} -%<standalone>\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{standalone}} -% -%<article|report>\ExecuteOptions{fontsize=11pt,a4paper,ngerman,sans} % default options -%<standalone>\ExecuteOptions{margin=0.25cm,fontsize=11pt,a4paper,ngerman,sans} % default options -\ProcessOptions\relax -%% Load KOMA class -%<article>\LoadClass{scrartcl} -%<report>\LoadClass{scrreprt} -%<standalone>\LoadClass[multi=tikzpicture,multi=circuitikz]{standalone} -%<article|report>\KOMAoption{toc}{bibliography,listof} - -%% package loading and config --------------------------------------------------------------------- +% Now we cann process the options for the |HsH| familiy. +% \begin{macrocode} +\FamilyProcessOptions{HsH}\relax +% \end{macrocode} % -% inputencoding, utf8 recomendet -\PassOptionsToPackage{utf8}{inputenc} -\RequirePackage{inputenc} +% \subsubsection{Loading the parrent class} +% \begin{macrocode} +\LoadClass{\HsHClassName@ParrentClass} +% \end{macrocode} % -% outputencoding, T1 recomendet -\PassOptionsToPackage{T1}{fontenc} -\RequirePackage{fontenc} % -% font -\RequirePackage{lmodern} +% \subsection{Package loading} +% The clases load and configure some common packages to reduce the needed amount of +% boilderplate code in your preamble. % -% required for importing images -\RequirePackage{graphicx} +% Additionally there are settings provided for packages that are used more rarly, but +% will be set up correctly if you decide to load them via |\usepackage{}|. % -% a lot of nice Math -\RequirePackage{amsmath} +% \subsubsection{Ensuring German works} +% With modern LaTeX systems the encoding of inputfiles is UTF-8 by default, so the +% \pkg{inputenc} package is no longer requried. Should the user still use a old +% setup or use a different encoding, he is responsible for loading \pkg{inputenc} +% himself. +% \changes{v3.00}{2024-02-03}{removed the \pkg{inputenc} package, as utf8 is now default} % -%<*article|report> -% required for changing layout -\PassOptionsToPackage{vmargin=6\baselineskip,bindingoffset=0.08\paperwidth,textwidth=0.75\paperwidth}{geometry} -\if@todos -% new paperwidth is everything without the right marging plus new stuff for marginpar -% rightmargin = ((1-0,75<paperwidth>) - 0.08<bindingoffset>)/2 = 0.915 - \setlength{\marginparwidth}{6cm} - \PassOptionsToPackage{paperwidth=\dimexpr +0.915\paperwidth+\marginparsep+\marginparwidth+0.25cm, right=\dimexpr +\marginparsep+\marginparwidth+0.25cm}{geometry} -\else - \PassOptionsToPackage{nomarginpar}{geometry} -\fi -\RequirePackage{geometry} +% The font-encoding for the pdf file is also set up to allow for the full european +% characterset. +% \changes{v3.00}{2024-02-03}{added \pkg{type1ec} package to get better font-scaling} ^^A see https://tex.stackexchange.com/questions/208304 +% \begin{macrocode} +\RequirePackage[T1]{fontenc} +\RequirePackage{type1ec} +% \end{macrocode} % -% language specific localisation -\if@german - \PassOptionsToPackage{ngerman}{babel} -\else - \PassOptionsToPackage{english}{babel} -\fi -\RequirePackage{babel} +% To ensure localised translations of all displayed text automatically dependign on +% the user-selected \opt{language}, the \pkg{babel} package is loaded. This also +% allowes for the use of the |\iflanguage| command, which is relevant later. +% \begin{macrocode} +\RequirePackage[main=\HsH@opt@language]{babel} +% \end{macrocode} % -% german dezimal numbers -\iflanguage{ngerman}{\RequirePackage{ziffer}}{}% +% Quotationsmarks are also very different between languages, so the following +% ensures the correct style for the correct language. +% \begin{macrocode} +\RequirePackage[autostyle=true]{csquotes} +\MakeOuterQuote{"} +% \end{macrocode} % -% required for header and footer -\PassOptionsToPackage{headsepline}{scrlayer-scrpage} -\RequirePackage{scrlayer-scrpage} -% compatability with listings -\RequirePackage{scrhack} +% German uses a comma as the decimal separator, which collides with \LaTeX{}s +% default english setting of using the comma as a thousands separator and therefore +% replacing it with some whitespace on printed version. Luckily loading the +% \pkg{ziffer} package sets this up to match the german standart. +% \begin{macrocode} +\iflanguage{ngerman}{\RequirePackage{ziffer}}{}% +% \end{macrocode} % -% references and lists are clikable -\PassOptionsToPackage{hidelinks}{hyperref} -\RequirePackage{hyperref} % -% put anchors at the beginning of floats -\PassOptionsToPackage{hypcap=true}{caption} -\RequirePackage{caption} +% \subsubsection{Generally usefull packages} % -% generat bookmarkes +% We load \pkg{hyperref} for clikable links and configure it to write meta-date to +% the PDF. +% \begin{macrocode} +\RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' \RequirePackage{bookmark} +\AtBeginDocument{ + \hypersetup{ + pdfinfo={ + Title={\@title}, + Author={\@author}, + Subject={\@subject}, + Keywords={\@keywords} + } + } +} +% \end{macrocode} % -% quotations -\PassOptionsToPackage{babel}{csquotes} -\iflanguage{ngerman}{\PassOptionsToPackage{german=quotes}{csquotes}}{}% -\RequirePackage{csquotes} -% this makes quotationmarks usable in text: -\MakeOuterQuote{"} -% -% Todonote package -% already changed the margins with geometry +% The \pkg{todonotes} package is greate for anotation, but extremly expensive on +% compiletime. So we load it only if the user requests it. Also its commands are +% stubed, so that they can be left in the sourcecode and jut not output anything. +% \begin{macrocode} \if@todos - \PassOptionsToPackage{svgnames}{xcolor} \PassOptionsToPackage{ textsize=small, figwidth=.6\textwidth }{todonotes} \RequirePackage{todonotes} - \setlength{\marginparwidth}{5.2cm} \else - \newcommand{\listoftodos}[1]{} - \newcommand{\todo}[2]{} - \newcommand{\missingfigure}[2]{} + \newcommand{\listoftodos}[1]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} \fi +% \end{macrocode} % -% foreach loops -\RequirePackage{pgffor} +% \begin{macrocode} +\RequirePackage[hypcap=true]{caption} +\RequirePackage{graphicx} +\RequirePackage{amsmath,amssymb,amsfonts} +\RequirePackage[svgnames]{xcolor} +% \end{macrocode} % -%</article|report> +% For better compatibility with the \pkg{listings} package we load the +% \pkg{scrhack} package. +% \begin{macrocode} +\RequirePackage{scrhack} +% \end{macrocode} % -%% options for not loaded packages ---------------------------------------------------------------- -%<article|report>\PassOptionsToPackage{backend=biber,style=alphabetic,sorting=nyt}{biblatex} +% \subsubsection{Options for packages that could be loaded by the user} +% Some package are not always needed and potentially heavy to load in by default. +% But its still usefull to set default options for these packagese. +% +% These differ from the settings provided in |HsH-classes.cfg| in that they are +% defaults that apply allway and not user-configurable preferences which are user +% or even project specific. +% \begin{macrocode} +%<*article|report> +\PassOptionsToPackage{backend=biber}{biblatex} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}} + }{}% + \makeatother +} +%</article|report> \PassOptionsToPackage{free-standing-units}{siunitx} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} - +% \end{macrocode} +% +% For other packages we provide the settings more as a recomendation of what is +% usefull. As the user might want to change these, we outsource this to a seperat file +% and input it |\AtBeginDocument|. That way the user can just replace the file with his +% custom version. +% \begin{macrocode} +\AtBeginDocument{ + \makeatletter + \InputIfFileExists{HsH-classes.cfg}{ + \ClassInfo{\HsHClassName}{Local config file HsH-classes.cfg used.} + }{ + \ClassInfo{\HsHClassName}{No HsH-classes.cfg!! I hope you configered it yourself.} + } + \makeatother +} +% \end{macrocode} +% +% \subsection{Custom commands} +% +% \subsubsection{Document seperation commands} +% The following commands are only defnied for \cls{book} type classes by default. +% But they are also usefull for the \cls{report} class, so we define them in that case. +% \begin{macrocode} +%<*report> +% \end{macrocode} +% +% \begin{macro}{\if@mainmatter} +% We define a switch which stores if the document is currently at a mainmatter +% section. Ir defaults to |true| as the user needs to explicitly set the state to +% something differnt. +% \begin{macrocode} +\newif\if@mainmatter\@mainmattertrue +% \end{macrocode} +% \end{macro} +% +% As a pagenumber change requires a fresh page, this is ensured first. We also +% need to make sure that on twosided document, the first page is alwasy on the +% left. +% +% \begin{macro}{\frontmatter} +% The pagenumbering is set to capital roman numerals. +% \begin{macrocode} +\newcommand{\frontmatter}{ + \if@twoside\cleardoubleoddpage\else\clearpage\fi + \@mainmatterfalse\pagenumbering{Roman} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\mainmatter} +% The pagenumbering is set to arabic numerals. +% \begin{macrocode} +\newcommand{\mainmatter}{ + \if@twoside\cleardoubleoddpage\else\clearpage\fi + \@mainmattertrue\pagenumbering{arabic} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\backmatter} +% The pagenumbering is set to arabic numerals. +% \begin{macrocode} +\newcommand{\backmatter}{ + \if@openright\cleardoubleoddpage\else\clearpage\fi + \@mainmatterfalse\pagenumbering{roman} +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +%</report> +% \end{macrocode} +% +% +% \subsubsection{The Logo for Hochschule Hannover} +% The following macros are responsible for creating the logo. They load a specific +% page of a PDF file and siplay it. +% +% \begin{macro}{\HsHlogoPath} +% This macro contains the path to load the PDF from. It defaults to +% |HSH-Logo.pdf|, which is provieded by this project inside the |scr/| folder. +% \begin{macrocode} +\newcommand{\HsHlogoPath}{HSH-Logo.pdf} +% \end{macrocode} +% \end{macro} % +% \begin{macro}{\HsHlogoPage} +% This macro stores the page to use from the PDF. It will be set via the +% documentoption \opt{faculty}. +% \begin{macrocode} +\newcommand{\HsHlogoPage}{\HsH@opt@faculty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\includeHsHlogohere} +% Calling this macro produces the logo in-place. You can specify the width as an +% optional argument. The default is $5\,\mathrm{cm}$. \par +% If the file provided via \cmd{\HsHlogoPath} doesn't exist, the command will +% produce an error. +% \begin{macrocode} +\newcommand{\includeHsHlogohere}[1][5cm]{ + \IfFileExists{\HsHlogoPath}{ + \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} + }{ + \ClassError{\HsHClassName}{\HsHlogoPath\space not found!}{ + The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location + } + } +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Title matters} +% \begin{macrocode} %<*article|report> -%% title matters ---------------------------------------------------------------------------------- +% \end{macrocode} +% +% The following commands relave to the creation of the titlepage. They Implement +% how the user can define the differnt datafields. +% \smallskip +% +% First the |\@author| macro is set to |\@empty|, this makes it easyer to handle it +% later. +% \begin{macrocode} +\let\@author\@empty +% \end{macrocode} % -% redefine title to accept a short tile (like chapter, etc..) -\newcommand*{\@shorttitle}{\@empty} +% \begin{macro}{\title} +% We redefine the |\title| command to take a optional argument. This is stored in +% the additional |\@shorttitle| macro. +% \begin{macrocode} \renewcommand{\title}[2][]{ \gdef\@title{#2} \gdef\@shorttitle{#1} } -\newcommand*{\@matrikelnr}{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@shorttitle} +% This new macro stores a short version of the title. This will be used in places +% where the fill title might overflow the availabel space. +% \begin{macrocode} +\def\@shorttitle{\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\matrikelnr,\@matrikelnr} +% These macros set and store the matrikel-number (or set of numbers), which will +% be printed on the titlepage. +% \begin{macrocode} \newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}} -\newcommand*{\@professor}{} +\def\@matrikelnr{\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\professor,\firstexaminer,\secondexaminer,\@professor,\@firstexaminer,\@secondexaminer} +% These three macros-groups give options to the user to print peoples names on +% the titlepage, who are relevant to the document, but not the author. +% \begin{macrocode} \newcommand{\professor}[1]{\gdef\@professor{#1}} -\newcommand*{\@firstexaminer}{} +\def\@professor{\@empty} \newcommand{\firstexaminer}[1]{\gdef\@firstexaminer{#1}} -\newcommand*{\@secondexaminer}{} +\def\@firstexaminer{\@empty} \newcommand{\secondexaminer}[1]{\gdef\@secondexaminer{#1}} -\newcommand*{\@keywords}{} +\def\@secondexaminer{\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\keywords,\@keywords} +% The macro-group defines and holds keywords which describe the document. They +% are used when printing the abstract as well as in the PDF's meta-data. +% \begin{macrocode} \newcommand{\keywords}[1]{\gdef\@keywords{#1}} -\let\@author\@empty -\let\@keywords\@empty - +\def\@keywords{\@empty} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} %</article|report> +% \end{macrocode} +% +% \subsubsection{Commands for document writing} +% +% \begin{macro}{\declarationofauthorship} +% The declatation of authorship is not relevant for the \cls{standalone} varaiant. +% \begin{macrocode} +%<*!stadnalone> +% \end{macrocode} +% The \pkg{pgffor} package is requried to handle the loope over the list of authors. +% \begin{macrocode} +\RequirePackage{pgffor} +% \end{macrocode} +% Now the command is defined. It takes a optional argument which defaults to \opt{b}. +% \begin{macrocode} +\newcommand{\declarationofauthorship}[1][b]{ +% \end{macrocode} +% First the argument is passed and an error raised for invalid arguments. Passing +% in \opt{b} will push the declatarion to the bottom of the page and add a +% horizontal line. PAssing \opt{t} simply adds some space. +% \begin{macrocode} + \if#1b + \vspace*{\fill} + \hrule + \else\if#1t + \vspace*{2em} + \else + \ClassError{\HsHClassName}{Wrong Parameter for `\declarationofauthorship'}{ + `\string\declarationofauthorship' only accepts `t' and `b' as parameters. + } + \fi\fi +% \end{macrocode} +% Now the actuall declatarion can be constructed. It uses the text from |\decofauthname| +% and |\decofauthtext|. +% \begin{macrocode} + \vskip 3em + {\centering\bfseries\usekomafont{section}{\decofauthname}\par} + \vskip 3em + \decofauthtext\par +% \end{macrocode} +% The last step is to loop over all authors by reading |\@author| and creating a +% signature box for each one. |\thanks| also needs to be cleared, as a footnote +% wouldn't make sense here. +% \begin{macrocode} + \begingroup + \renewcommand{\thanks}{\sbox0} + \raggedleft + \foreach \tmp@ in \@author { + \if\tmp@\empty\else + \hskip 1em \parbox{4cm}{ + \vskip 4em + \hrule\vskip 4pt + \raggedleft\footnotesize\tmp@ + }% + \fi + }\par + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ifsingleauthor} +% To ensure |\decofauthtext| is preperly spelled for one or multiple authors, we +% define a conditional that holds this information. Additionally we check the +% number of authors |\AtBeginDocument| and store it. +% \begin{macrocode} +\newif\ifsingleauthor +\AtBeginDocument{ + \begingroup + \newcount\count@ + \count@=\z@ + \@for\tmp@:=\@author\do{\advance\count@\@ne} + \ifnum\count@>\@ne\global\singleauthorfalse\else\global\singleauthortrue\fi + \endgroup +} +% \end{macrocode} +% \end{macro} +% +% define the localised texts +% \begin{macrocode} +\newcommand{\decofauthname}{Declaration of Authorship} +\newcaptionname{english}\decofauthname{Declaration of Authorship} +\newcaptionname{german,ngerman}\decofauthname{Selbstst\"andigkeitserkl\"arung} +% +\newcommand{\decofauthtext}{Language not supported!} +\newcaptionname{english}\decofauthtext{% + \ifsingleauthor{I}\else{We}\fi\space hereby certify that the work \ifsingleauthor{I}\else{we}\fi\space + \ifsingleauthor am\else are\fi\space submitting is entirely of \ifsingleauthor{my}\else{our}\fi own + making except where otherwise indicated. \ifsingleauthor{I}\else{We}\fi\space + \ifsingleauthor{am}\else{are}\fi\space aware of regulations concerning plagiarism, including + disciplinary actions that may result from it. Any use of the works of any other author, in any form, + is properly acknowledged at their point of use. +} +\newcaptionname{german,ngerman}\decofauthtext{% + Hiermit best{\"a}tige\ifsingleauthor\else{n}\fi\space \ifsingleauthor ich\else wir\fi, dass die + folgende Arbeit eigenst{\"a}ndig von \ifsingleauthor{mir}\else{uns}\fi\space allein erstellt und + unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem Arbeitsmaterial + unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines + Plagiats, inklusive disziplinarischer Ma{\ss}nahmen, sind \ifsingleauthor{mir}\else{uns}\fi\space + bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmenals solche kenntlich gemacht. +} +% \end{macrocode} +% +% \begin{macro}{\declarationAuthorship} +% \changes{v2.01}{2023-08-11}{Deprecate \cmd{\declarationAuthorship}, as it got replaced by \cmd{\declarationofauthorship}} +% \begin{macrocode} +\def\declarationAuthorship{% + \ClassWarning{\HsHClassName}{% + Command \string\declarationAuthorship\space is deprecate.\MessageBreak + Replace it with \string\declarationofauthorship. + }% + \declarationofauthorship% +} +%</!stadnalone> +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Micalanious commands} +% \vspace{-1\baselineskip} +% \paragraph{Utillity commands} +% For writing absolout values, we provide the \cmd{\abs\marg{equ}} command, which +% puts groable, vertical bars on both sides of the equation inside. +% \begin{macrocode} +\newcommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} +% \end{macrocode} +% +% \paragraph{Configuring mathmode-indices} +% The only hard requirements for documents writing on Hochschule Hannover is, that +% the indices in mathematic formulas must be typset in an upright ("steil") font, +% not the default kursive font. We configure this by first defining a macro to +% replace the default \cmd{\sb} macro. We can than assign this to |_|. For that to +% work we need to change its catcode to make it modifyable. +% \begin{note} +% You can allways use \cmd{\sb} to use the original behaviour for special cases. +% \end{note} +% \begin{macrocode} +\def\@subinrm#1{\sb{\mathrm{#1}}} +{\catcode`\_=13 \global\let_=\@subinrm} +% \end{macrocode} +% +% \begin{macro}{\upsubscripts} +% Now we can define a command to activate this new behavior by changing the catcode +% of |_| to 13, which makes it a normal macro. +% \begin{macrocode} +\newcommand\upsubscripts{\catcode`\_=12} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\normalsubscripts} +% To switch back we simply need to reset the catcode of |_| back to the original, +% which makes it a buildin operator with the default behavior. +% \begin{macrocode} +\newcommand\normalsubscripts{\catcode`\_=8} +% \end{macrocode} +% \end{macro} +% +% \subsection{Document setup} +% The following sets up the look and feel of the documents using this classe. All +% configuration and stylin is done here. +% +% \subsubsection{Fonts and text styling} +% \begin{macrocode} +\RequirePackage{lmodern} +% \end{macrocode} +% +% \subsubsection{Page layout} +% +% \begin{macrocode} +%<*!standalone> +\areaset[current]{0.75\paperwidth}{0.8\paperheight} +\if@todos + \addtolength\paperwidth{5cm} + \addtolength\marginparwidth{5cm} +\fi +%</!standalone> +% \end{macrocode} +% +% \subsubsection{Styling \LaTeX{} default constucts} +% +% \paragraph{Floats}\vspace*{-1\baselineskip} +% \begin{macrocode} +%<*!standalone> +% \end{macrocode} +% Floats should alwasy prefere the \emph{here} placement, than the \emph{top} of +% the following page. +% \begin{macrocode} +\renewcommand{\fps@figure}{h!t} +\renewcommand{\fps@table}{h!t} +% \end{macrocode} +% +% Floats should be centered by default and the width of the caption box is limited. +% \begin{macrocode} +\g@addto@macro\@floatboxreset\centering +\setcapwidth{0.8\textwidth} +% \end{macrocode} +% +% The names of floating enviroments are redefined to show abreviations only. +% \begin{macrocode} +\defcaptionname{english}\figurename{Fig.} +\defcaptionname{german,ngerman}\figurename{Abb.} +\defcaptionname{english}\tablename{Tab.} +\defcaptionname{german,ngerman}\tablename{Tab.} +% \end{macrocode} +% +% For subfigures we need to define a name used in autoreferences. +% \begin{macrocode} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{subfigure}{ + \let\subfigureautorefname\figureautorefname + }{}% + \makeatother +} +% \end{macrocode} % -%% typesetting indexes upright or standart -\def\subinrm#1{\sb{\mathrm{#1}}} -{\catcode`\_=13 \global\let_=\subinrm} -% the toggle for upright subscripts -\newcommand\upsubscripts{\catcode`\_=12 } -% the toggle for italic subscripts -\newcommand\normalsubscripts{\catcode`\_=8 } -% setting upright as default +% \begin{macrocode} +%</!standalone> +% \end{macrocode} +% +% \paragraph{Lists} +% For unordert liste the markers are redefined to look a littel nicer. +% \begin{macrocode} +\renewcommand{\labelitemi}{\raisebox{.3ex}{\scalebox{0.7}{$\bullet$}}} +\renewcommand{\labelitemii}{\raisebox{.3ex}{\scalebox{0.7}{$\circ$}}} +\renewcommand{\labelitemiii}{\raisebox{.1ex}{-}} +\renewcommand{\labelitemiv}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}} +% \end{macrocode} +% +% \paragraph{Misc} +% We activae one of the commands defined above to make math-indices upright by +% default. +% \begin{macrocode} \upsubscripts - +% \end{macrocode} +% +% We want a ragged botton instead of spreading the paragraphs over the page. +% \begin{macrocode} +\raggedbottom +% \end{macrocode} % +% The ruler shown in the top and left margin with the \opt{draft} option is +% removed. +% \begin{macrocode} +\let\layercontentsmeasure\relax +% \end{macrocode} +% +% \subsubsection{Header and footer} +% +% \begin{macrocode} %<*article|report> -%% header and footer -% first clear the default styles -\clearpairofpagestyles -% than we set the pagenumber for the plain and normal style -\ofoot*{\pagemark} +% \end{macrocode} % -% now we define our custom header style +% The header and footer are styled using the low-level commands provided by the +% \KOMAScript{} package \pkg{scrlayer-scrpage}. +% \begin{macrocode} +\RequirePackage{scrlayer-scrpage} +\FamilyOptions{KOMA}{headsepline,singlespacing=true} +% \end{macrocode} +% +% First we define the new pagestyle |HsHheadings|. +% \begin{macrocode} \newpagestyle{HsHheadings}{ -% twosided left page header { \parbox[b]{\sls@headwidth}{ \LaTeXraggedright \ifx\@shorttitle\@empty\@title\else\@shorttitle\fi }% } -% twosided right page header { \parbox[b]{\sls@headwidth}{ \LaTeXraggedleft \leftmark }% } -% onesided page header { \parbox[b]{.45\sls@headwidth}{ \LaTeXraggedright @@ -316,185 +1405,44 @@ http://www.latex-project.org/lppl.txt {\hfill\pagemark} {\hfill\pagemark} } +% \end{macrocode} +% Than all generic settings are applyed: +% \begin{macrocode} +\clearpairofpagestyles +\ofoot*{\pagemark} \pagestyle{HsHheadings} %<article>\automark{section} %<report>\automark{chapter} -% Chaptertitles get same header/footer as everything: %<report>\renewcommand*{\chapterpagestyle}{HsHheadings} - -%% floats -% positioning of floats -\renewcommand{\fps@figure}{h!t} -\renewcommand{\fps@table}{h!t} +% \end{macrocode} % -% check if KOMA is used -\ifx\KOMAScriptVersion\undefined\else -% center all floats - \g@addto@macro\@floatboxreset\centering -% center all captions - \setcapwidth{0.8\textwidth} -\fi -% abbreviations for names: -\iflanguage{english}{ - \renewcaptionname{english}{\figurename}{Fig.} - \renewcaptionname{english}{\tablename}{Tab.} -}{}% -\iflanguage{ngerman}{ - \renewcaptionname{ngerman}{\figurename}{Abb.} - \renewcaptionname{ngerman}{\tablename}{Tab.} - \renewcaptionname{ngerman}{\abstractname}{Abstract} -}{}% - -%% styling for itemize -\renewcommand{\labelitemi}{$\bullet$} -\renewcommand{\labelitemii}{$\circ$} -\renewcommand{\labelitemiii}{$-$} -\renewcommand{\labelitemiv}{$\cdot$} - -%% do stuff -% indentation of new paragraphs -\setlength\parindent{0pt} -% all stuff is pushed to the top of the page ingenerall -\raggedbottom -% rulers when using draft disabled -\let\layercontentsmeasure\relax - -%<*report> -% these commands are only defined for the book class, but they also make sens for the report class: -%% define easy shorthands to switch pagenumbering -\newif\if@mainmatter\@mainmattertrue -\newcommand*\frontmatter{% - \if@twoside\cleardoubleoddpage\else\clearpage\fi - \@mainmatterfalse\pagenumbering{Roman}% -} -\newcommand*\mainmatter{% - \if@twoside\cleardoubleoddpage\else\clearpage\fi - \@mainmattertrue\pagenumbering{arabic}% -} -\newcommand*\backmatter{% - \if@openright\cleardoubleoddpage\else\clearpage\fi - \@mainmatterfalse\pagenumbering{roman}% -} - -%</report> -%% custom commands -% these two comand can convert decimal number into roman numerrals in etheir upper- or lowercase -\newcommand{\uproman}[1]{\uppercase\expandafter{\romannumeral#1}} -\newcommand{\lowroman}[1]{\romannumeral#1\relax} - +% \begin{macrocode} %</article|report> +% \end{macrocode} % -%% load config at beginning of document -\AtBeginDocument{ - \makeatletter -%<*!standalone> -% solve some common errors: - \@ifpackageloaded{biblatex}{ -% solves fontype warning in San-Serif - \renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}} - }{} - \@ifpackageloaded{subfigure}{ - \newcommand{\subfigureautorefname}{\figureautorefname} - }{} -%</!standalone> - \InputIfFileExists{HsH-classes.cfg}{ - \ClassInfo{\HsHClassName}{HsH-classes.cfg was found. Using it...} - }{ - \ClassInfo{\HsHClassName}{no HsH-classes.cfg!! I hope you configered it yourself.} - } - %% provide some usefull commands: -% Makro for vertical lines around absolute values - \providecommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} - \makeatother -} +% \subsubsection{Titlepage} % -%<*report> -%% nicer abstract --------------------------------------------------------------------------------- -\renewenvironment{abstract}{ - \quotation - \setlength\parindent{0pt} - \addchap{\abstractname} -}{% - \ifx\@keywords\@empty\else - \vskip 2em - \paragraph{% - \iflanguage{english}{Keywords}{}% - \iflanguage{ngerman}{Schlüsselwörter}{}% - } - \@keywords - \fi - \endquotation -} -%</report> +% \begin{macro}{\maketitle} +% The definiton of |\maketitle| is mostly taken from the source-code of the +% \KOMAScript{} parrentclass, but was modified to create the desired style. +% \begin{macrocode} %<*article|report> -%% declaration of Authorship ---------------------------------------------------------------------- -% -\iflanguage{english}{ - \setlocalecaption{english}{authorshipdeclaration}{Declaration of Authorship} -}{}% -\iflanguage{ngerman}{ - \setlocalecaption{ngerman}{authorshipdeclaration}{Selbstst\"andigkeitserkl\"arung} -}{}% -% -% this boolean stores if this document is written by more than one author -\newif\if@oneAuthor \@oneAuthortrue -% -% this is the actuall command: -\newcommand{\declarationofauthorship}[1][b]{ - \let\@param#1 - \renewcommand{\thanks}{\sbox0} - \foreach \x [count=\i] in \@author{\ifnum\i>1\global\@oneAuthorfalse\fi} - \thispagestyle{plain} - \if\@param b\vspace*{\fill}\fi - {\rule{\textwidth}{0.1pt}} - \vskip 3em - {\centering\huge\bfseries\authorshipdeclarationname\par} - \vskip 3em - \iflanguage{english}{ - \if@oneAuthor I\else We\fi\space hereby certify that the work \if@oneAuthor I\else we\fi\space \if@oneAuthor am\else are\fi\space submitting - is entirely of \if@oneAuthor my\else our\fi own making except where otherwise indicated. \if@oneAuthor I\else We\fi\space - \if@oneAuthor am\else are\fi\space aware of regulations concerning plagiarism, including disciplinary actions that may result from it. Any use - of the works of any other author, in any form, is properly acknowledged at their point of use. \par - }{}% - \iflanguage{ngerman}{ - Hiermit best{\"a}tige\if@oneAuthor\else n\fi\space \if@oneAuthor ich\else wir\fi, dass die folgende Arbeit eigenst{\"a}ndig von - \if@oneAuthor mir\else uns\fi\space allein erstellt und unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem - Arbeitsmaterial unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines Plagiats, inklusive - disziplinarischer Ma{\ss}nahmen, sind \if@oneAuthor mir\else uns\fi\space bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmen - als solche kenntlich gemacht. \par - }{}% - {\raggedleft - \foreach \x in \@author{ - \begin{tabular}[t]{r} - \\[3em] - \rule{4cm}{0.4pt}\\ - {\footnotesize\x} - \end{tabular} - } - \par} - \if\@param t\vspace*{\fill}\fi -} -% for backwards compatability: -\let\declarationAuthorship\declarationofauthorship - -% -%% reconfig Titlepage ----------------------------------------------------------------------------- -\iflanguage{english}{ - \setlocalecaption{english}{professor}{Professor} - \setlocalecaption{english}{firstexaminer}{First examiner} - \setlocalecaption{english}{secondexaminer}{Second examiner} -}{}% -\iflanguage{ngerman}{ - \setlocalecaption{ngerman}{professor}{Professor(in)/Lehrbeauftragte(r)} - \setlocalecaption{ngerman}{firstexaminer}{Erstpr{\"u}fer(in)} - \setlocalecaption{ngerman}{secondexaminer}{Zweitpr{\"u}fer(in)} -}{}% +\newcommand{\professortext}{Professor} +\newcommand{\firstexaminertext}{First examiner} +\newcommand{\secondexaminertext}{Second examiner} +\newcaptionname{english}\professortext{Professor} +\newcaptionname{english}\firstexaminertext{First examiner} +\newcaptionname{english}\secondexaminertext{Second examiner} +\newcaptionname{german,ngerman}\professortext{Professor(in)/Lehrbeauftragte(r)} +\newcaptionname{german,ngerman}\firstexaminertext{Erstpr{\"u}fer(in)} +\newcaptionname{german,ngerman}\secondexaminertext{Zweitpr{\"u}fer(in)} \newtoks\@tabtoks \newcommand\addtabtoks[1]{\global\@tabtoks\expandafter{\the\@tabtoks#1}} \newcommand\eaddtabtoks[1]{\edef\mytmp{#1}\expandafter\addtabtoks\expandafter{\mytmp}} % %%\newcommand*\resettabtoks{\global\@tabtoks{}} \newcommand*\printtabtoks{\the\@tabtoks} \addtokomafont{publishers}{\normalsize} +\g@addto@macro\titlepage{\singlespacing} % %<article>\renewcommand\maketitle[1][c]{ %<report>\renewcommand\maketitle[1][l]{ @@ -527,8 +1475,9 @@ http://www.latex-project.org/lppl.txt %<article> \begingroup \let\@param#1 \ifx\@param\@empty - \ClassError{\HsHClassName}{\maketitle\space with empty option}{ - \maketitle[] has been called with an empty parameter, this doesn't work. Use \maketitle instead. + \ClassError{\myClassName}{\maketitle\space with empty option}{ + \maketitle[] has been called (with an empty parameter), this doesn't work. + Use \maketitle instead. } \fi %<*report> @@ -657,9 +1606,9 @@ http://www.latex-project.org/lppl.txt \if\@param l\begin{tabular}{@{}l l}\fi \if\@param c\begin{tabular}{l l}\fi \if\@param r\begin{tabular}{r r@{}}\fi - \if\@professor\@empty\else\textbf{\professorname:}&\@professor\\\fi - \if\@firstexaminer\@empty\else\textbf{\firstexaminername:}&\@firstexaminer\\\fi - \if\@secondexaminer\@empty\else\textbf{\secondexaminername:}&\@secondexaminer\\\fi + \if\@professor\@empty\else\textbf{\professortext:}&\@professor\\\fi + \if\@firstexaminer\@empty\else\textbf{\firstexaminertext:}&\@firstexaminer\\\fi + \if\@secondexaminer\@empty\else\textbf{\secondexaminertext:}&\@secondexaminer\\\fi \end{tabular} } %<*article> @@ -759,111 +1708,12 @@ http://www.latex-project.org/lppl.txt \global\let\and\relax } %</article|report> -%</article|report|standalone> +% \end{macrocode} +% \end{macro} % -% Config file ------------------------------------------------------------------------------------- -%<*config> -%% Meta Data for the PDF file -\@ifpackageloaded{hyperref}{ - \hypersetup{ - pdfinfo={ - Title={\@title}, - Author={\@author}, - Subject={\@subject}, - Keywords={\@keywords} - } - } -}{} -%% configs for optional packages: -\@ifpackageloaded{biblatex}{ - \ExecuteBibliographyOptions{ - bibwarn=true, - url=true, - isbn=false, - } -}{} -\@ifpackageloaded{todonotes}{ - \setuptodonotes{ - backgroundcolor=orange!60!white, - linecolor=orange, - bordercolor=white - } -}{} -\@ifpackageloaded{siunitx}{ - \iflanguage{ngerman}{ - \sisetup{output-decimal-marker={,}} % use comma as dezimal - }{}% - \sisetup{ - tight-spacing=true, - per-mode=symbol, - scientific-notation=engineering, - %exponent-to-prefix, % use this instead of sci-notatio - round-mode = places, % round numbers - round-precision = 3, % to 3 places - } -}{} -\@ifpackageloaded{listings}{ - \PassOptionsToPackage{svgnames}{xcolor} - \RequirePackage{xcolor} - \RequirePackage{lstautogobble} - \lstset{ - commentstyle=\color{gray}, - keywordstyle=\color{FireBrick}\bfseries, - stringstyle=\color{DodgerBlue}, - showstringspaces=false, - basicstyle=\ttfamily, - tabsize=4, - literate={Ö}{{\"O}}1{Ä}{{\"A}}1{Ü}{{\"U}}1{ß}{{\ss}}1{ü}{{\"u}}1{ä}{{\"a}}1{ö}{{\"o}}1, - escapeinside={(*@}{@*)}, - autogobble=true, - } -}{} -\@ifpackageloaded{enumitem}{ - \RequirePackage{amssymb} - \newlist{checklist}{itemize}{2} - \setlist[checklist]{label=$\square$} -}{} -\@ifpackageloaded{csvsimple}{ - \csvstyle{every csv}{separator=semicolon} % global seperator for csv files -}{} -\@ifpackageloaded{circuitikz}{ - \ctikzset{ - font=\footnotesize, - bipole annotation style/.style={font=\tiny ,inner sep=1pt}, - } -}{} -\@ifpackageloaded{pgfplots}{ - \usepgfplotslibrary{fillbetween} % mark areas under or between graphs - \usetikzlibrary{patterns} % for using pattern in plots - \iflanguage{ngerman}{ - \pgfplotsset{/pgf/number format/use comma} - }{}% - \pgfplotsset{ - compat=1.16, - /pgf/number format/read comma as period, - every tick label/.append style={font=\tiny}, - every axis legend/.append style={font=\footnotesize}, - MyPlots/.style = { % Style for all plots - width=.6\textwidth, - grid=major, - grid style={dashed,gray!50}, - legend pos=outer north east, - FM1/.style = {blue, thick, mark=x, mark size=1.5,samples=100}, % Format 1 - FM2/.style = {orange, thick, mark=*, mark size=1,samples=100}, % Format 2 - FM3/.style = {green, thick, mark=square*, mark size=1,samples=100}, % Format 3 - FM4/.style = {red, thick, mark=diamond*, mark size=1,samples=100}, % Format 4 - FM5/.style = {pink, thick, mark=triangel*, mark size=1,samples=100},% Format 5 - errBars/.style = {error bars/.cd, y dir=both, y explicit, % ermöglicht Fehlerbalken - error mark options={mark size=1pt,rotate=90}}, - } - } -}{} -\@ifpackageloaded{pgfplotstable}{ - \pgfplotstableset{ - col sep=semicolon, % global seperator for csv files - } -}{} -%</config> +%\iffalse docstrip-guard +%</article|report|standalone> +%\fi % -% \Finale +%\Finale \endinput diff --git a/src/HsH-classes.pdf b/src/HsH-classes.pdf new file mode 100644 index 0000000000000000000000000000000000000000..593cecaf0968943fa3e2613563162ab220ae10f0 --- /dev/null +++ b/src/HsH-classes.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9fc4c73ce94b87b806dc3dab2f1d830277c372596b61e94d7c72ee647905a2f4 +size 310671 diff --git a/src/HsH-report.cls b/src/HsH-report.cls index 6d9dd63a22b195f9ba810faea554cc9b9d10f53c..118029ba15bc7e26dc950726d4eb81fd383f81ed 100644 --- a/src/HsH-report.cls +++ b/src/HsH-report.cls @@ -15,150 +15,351 @@ %% %% http://www.latex-project.org/lppl.txt %% -\typeout{Adapted from KOMA script for use in Hochschule Hannover <2023-08-12> Jan Wille} -\NeedsTeXFormat{LaTeX2e} -\newcommand{\HsHClassName}{HsH-report} -\ProvidesClass{\HsHClassName}[2023/08/12 v2.1 HsH-Class based on KOMA] - -%% commands for HsH-logo -\newcommand{\HsHlogoPath}{HSH-Logo.pdf} -\newcommand{\HsHlogoPage}{1} -\newcommand{\includeHsHlogohere}[1][5cm]{ - \IfFileExists{\HsHlogoPath}{}{ - \ClassError{\HsHClassName}{HsH-Logo.pdf not found!}{ - The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location - } - } - \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} +\NeedsTeXFormat{LaTeX2e}[2022-06-01] +\ProvidesClass{HsH-report} + [2024-04-23 3.00 HsH-class based on KOMA] +\let\HsHClassName\@currname +\def\HsHClassName@ParrentClass{% + scrreprt% } -\newif\if@german% -\newif\if@todos\@todosfalse% - -%% document options ------------------------------------------------------------------------------- -\DeclareOption{german}{ - \@germantrue +\RequirePackage{scrbase} +\RequirePackage{setspace} +\DefineFamily{HsH} +\DefineFamilyMember{HsH} +\newcommand{\HsH@Options@PassToParrent}[1]{% + \ClassInfoNoLine{\HsHClassName}{passing option to parrent class: #1}% + \PassOptionsToClass{#1}{\HsHClassName@ParrentClass}% } -\DeclareOption{ngerman}{ - \@germantrue +\newcommand{\HsH@Options@DeclareAlias}[3][HsH]{% + \DeclareOption{#2}{\FamilyExecuteOptions{#1}{#3}}% } -\DeclareOption{english}{ - \@germanfalse +\DefineFamilyKey{HsH}{fontfamily}{ + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tmp}{% + {sans}{0}, {sans-serif}{0},% + {roman}{1}, {serif}{1},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tmp% 0 + \endgroup + \renewcommand{\familydefault}{\sfdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \or% 1 + \endgroup + \renewcommand{\familydefault}{\rmdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{f1}{ - \renewcommand{\HsHlogoPage}{2} +\HsH@Options@DeclareAlias{sans}{fontfamily=sans} +\HsH@Options@DeclareAlias{roman}{fontfamily=roman} +\DefineFamilyKey{HsH}{linespacing}{ + \begingroup + \FamilySetNumerical{HsH}{linespacing}{@tempa}{% + {single}{0},% + {onehalf}{1},% + {double}{2},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tempa% 0 + \endgroup + \if@atdocument\singlespacing\else\AtEndOfClass{\singlespacing}\fi + \or% 1 + \endgroup + \if@atdocument\onehalfspacing\else\AtEndOfClass{\onehalfspacing\AfterTOCHead{\singlespacing}}\fi + \or% 2 + \endgroup + \if@atdocument\doublespacing\else\AtEndOfClass{\doublespacing\AfterTOCHead{\singlespacing}}\fi + + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{f2}{ - \renewcommand{\HsHlogoPage}{3} +\HsH@Options@DeclareAlias{singlespacing}{linespacing=single} +\HsH@Options@DeclareAlias{onehalfspacing}{linespacing=onehalf} +\HsH@Options@DeclareAlias{doublespacing}{linespacing=double} +\DefineFamilyKey{HsH}{parskip}{% + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tempa}{% + {never+}{0},% + {never*}{1},% + }{#1} + \if@atdocument + \ClassError{\HsHClassName}{ + option `parskip' can only be configured in preamble! + } + \fi + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tempa% 0 + \endgroup + \AtEndOfClass{\setparsizes{\z@}{\z@}{.3333\linewidth \@plus 1fil}} + \or% 1 + \endgroup + \AtEndOfClass{\setparsizes{\z@}{\z@}{.25\linewidth \@plus 1fil}} + \else% should never be + \endgroup + \fi + \else + \endgroup + \HsH@Options@PassToParrent{parskip=#1} + \FamilyKeyStateProcessed + \fi } -\DeclareOption{f3}{ - \renewcommand{\HsHlogoPage}{4} +\def\HsH@opt@headheight{} +\FamilyStringKey{HsH}{headheight}{\HsH@opt@headheight} +\AtEndOfClass{% + \headheight=\HsH@opt@headheight% } -\DeclareOption{f4}{ - \renewcommand{\HsHlogoPage}{5} +\DefineFamilyKey{HsH}{twoside}[semi]{% + \HsH@Options@PassToParrent{twoside=#1,BCOR=1cm} + \FamilyKeyStateProcessed } -\DeclareOption{f5}{ - \renewcommand{\HsHlogoPage}{6} +\def\HsH@opt@language{nil} +\FamilyStringKey{HsH}{language}{\HsH@opt@language} +\HsH@Options@DeclareAlias{english}{language=english} +\HsH@Options@DeclareAlias{german}{language=ngerman} +\HsH@Options@DeclareAlias{ngerman}{language=ngerman} +\def\HsH@opt@faculty{1} +\FamilyNumericalKey{HsH}{faculty}{HsH@opt@faculty}{% + {none}{1}, {false}{1},% + {f1}{2}, {1}{2},% + {f2}{3}, {2}{3},% + {f3}{4}, {3}{4},% + {f4}{5}, {4}{5},% + {f5}{6}, {5}{6},% } -\DeclareOption{sans}{ - \renewcommand{\familydefault}{\sfdefault} +\HsH@Options@DeclareAlias{f1}{faculty=f1} +\HsH@Options@DeclareAlias{f2}{faculty=f2} +\HsH@Options@DeclareAlias{f3}{faculty=f3} +\HsH@Options@DeclareAlias{f4}{faculty=f4} +\HsH@Options@DeclareAlias{f5}{faculty=f5} +\FamilyBoolKey{HsH}{todos}{@todos} +\DefineFamilyKey{HsH}{@else@}{ + \HsH@Options@PassToParrent{#1} + \FamilyKeyStateProcessed } -\DeclareOption{roman}{ - \renewcommand{\familydefault}{\rmdefault} +\DeclareOption*{ + \HsH@Options@PassToParrent{\CurrentOption} } -\DeclareOption{todos}{ - \@todostrue +\FamilyExecuteOptions{HsH}{% + fontfamily=sans-serif, + fontsize=11pt, + language=ngerman, + parskip=half+, + linespacing=single, + headheight=2.15\baselineskip, + toc=listof, + toc=bibliography, + faculty=none, } -%% defere all other options to the base class -\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{scrreprt}} -\ExecuteOptions{fontsize=11pt,a4paper,ngerman,sans} % default options -\ProcessOptions\relax -%% Load KOMA class -\LoadClass{scrreprt} -\KOMAoption{toc}{bibliography,listof} - -%% package loading and config --------------------------------------------------------------------- -\PassOptionsToPackage{utf8}{inputenc} -\RequirePackage{inputenc} -\PassOptionsToPackage{T1}{fontenc} -\RequirePackage{fontenc} -\RequirePackage{lmodern} -\RequirePackage{graphicx} -\RequirePackage{amsmath} -\PassOptionsToPackage{vmargin=6\baselineskip,bindingoffset=0.08\paperwidth,textwidth=0.75\paperwidth}{geometry} -\if@todos - \setlength{\marginparwidth}{6cm} - \PassOptionsToPackage{paperwidth=\dimexpr +0.915\paperwidth+\marginparsep+\marginparwidth+0.25cm, right=\dimexpr +\marginparsep+\marginparwidth+0.25cm}{geometry} -\else - \PassOptionsToPackage{nomarginpar}{geometry} -\fi -\RequirePackage{geometry} -\if@german - \PassOptionsToPackage{ngerman}{babel} -\else - \PassOptionsToPackage{english}{babel} -\fi -\RequirePackage{babel} +\FamilyProcessOptions{HsH}\relax +\LoadClass{\HsHClassName@ParrentClass} +\RequirePackage[T1]{fontenc} +\RequirePackage{type1ec} +\RequirePackage[main=\HsH@opt@language]{babel} +\RequirePackage[autostyle=true]{csquotes} +\MakeOuterQuote{"} \iflanguage{ngerman}{\RequirePackage{ziffer}}{}% -\PassOptionsToPackage{headsepline}{scrlayer-scrpage} -\RequirePackage{scrlayer-scrpage} -\RequirePackage{scrhack} -\PassOptionsToPackage{hidelinks}{hyperref} -\RequirePackage{hyperref} -\PassOptionsToPackage{hypcap=true}{caption} -\RequirePackage{caption} +\RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' \RequirePackage{bookmark} -\PassOptionsToPackage{babel}{csquotes} -\iflanguage{ngerman}{\PassOptionsToPackage{german=quotes}{csquotes}}{}% -\RequirePackage{csquotes} -\MakeOuterQuote{"} +\AtBeginDocument{ + \hypersetup{ + pdfinfo={ + Title={\@title}, + Author={\@author}, + Subject={\@subject}, + Keywords={\@keywords} + } + } +} \if@todos - \PassOptionsToPackage{svgnames}{xcolor} \PassOptionsToPackage{ textsize=small, figwidth=.6\textwidth }{todonotes} \RequirePackage{todonotes} - \setlength{\marginparwidth}{5.2cm} \else - \newcommand{\listoftodos}[1]{} - \newcommand{\todo}[2]{} - \newcommand{\missingfigure}[2]{} + \newcommand{\listoftodos}[1]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} \fi -\RequirePackage{pgffor} -%% options for not loaded packages ---------------------------------------------------------------- -\PassOptionsToPackage{backend=biber,style=alphabetic,sorting=nyt}{biblatex} +\RequirePackage[hypcap=true]{caption} +\RequirePackage{graphicx} +\RequirePackage{amsmath,amssymb,amsfonts} +\RequirePackage[svgnames]{xcolor} +\RequirePackage{scrhack} +\PassOptionsToPackage{backend=biber}{biblatex} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}} + }{}% + \makeatother +} \PassOptionsToPackage{free-standing-units}{siunitx} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} - -%% title matters ---------------------------------------------------------------------------------- -\newcommand*{\@shorttitle}{\@empty} +\AtBeginDocument{ + \makeatletter + \InputIfFileExists{HsH-classes.cfg}{ + \ClassInfo{\HsHClassName}{Local config file HsH-classes.cfg used.} + }{ + \ClassInfo{\HsHClassName}{No HsH-classes.cfg!! I hope you configered it yourself.} + } + \makeatother +} +\newif\if@mainmatter\@mainmattertrue +\newcommand{\frontmatter}{ + \if@twoside\cleardoubleoddpage\else\clearpage\fi + \@mainmatterfalse\pagenumbering{Roman} +} +\newcommand{\mainmatter}{ + \if@twoside\cleardoubleoddpage\else\clearpage\fi + \@mainmattertrue\pagenumbering{arabic} +} +\newcommand{\backmatter}{ + \if@openright\cleardoubleoddpage\else\clearpage\fi + \@mainmatterfalse\pagenumbering{roman} +} +\newcommand{\HsHlogoPath}{HSH-Logo.pdf} +\newcommand{\HsHlogoPage}{\HsH@opt@faculty} +\newcommand{\includeHsHlogohere}[1][5cm]{ + \IfFileExists{\HsHlogoPath}{ + \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} + }{ + \ClassError{\HsHClassName}{\HsHlogoPath\space not found!}{ + The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location + } + } +} +\let\@author\@empty \renewcommand{\title}[2][]{ \gdef\@title{#2} \gdef\@shorttitle{#1} } -\newcommand*{\@matrikelnr}{} +\def\@shorttitle{\@empty} \newcommand{\matrikelnr}[1]{\gdef\@matrikelnr{#1}} -\newcommand*{\@professor}{} +\def\@matrikelnr{\@empty} \newcommand{\professor}[1]{\gdef\@professor{#1}} -\newcommand*{\@firstexaminer}{} +\def\@professor{\@empty} \newcommand{\firstexaminer}[1]{\gdef\@firstexaminer{#1}} -\newcommand*{\@secondexaminer}{} +\def\@firstexaminer{\@empty} \newcommand{\secondexaminer}[1]{\gdef\@secondexaminer{#1}} -\newcommand*{\@keywords}{} +\def\@secondexaminer{\@empty} \newcommand{\keywords}[1]{\gdef\@keywords{#1}} -\let\@author\@empty -\let\@keywords\@empty - -%% typesetting indexes upright or standart -\def\subinrm#1{\sb{\mathrm{#1}}} -{\catcode`\_=13 \global\let_=\subinrm} -\newcommand\upsubscripts{\catcode`\_=12 } -\newcommand\normalsubscripts{\catcode`\_=8 } +\def\@keywords{\@empty} +\RequirePackage{pgffor} +\newcommand{\declarationofauthorship}[1][b]{ + \if#1b + \vspace*{\fill} + \hrule + \else\if#1t + \vspace*{2em} + \else + \ClassError{\HsHClassName}{Wrong Parameter for `\declarationofauthorship'}{ + `\string\declarationofauthorship' only accepts `t' and `b' as parameters. + } + \fi\fi + \vskip 3em + {\centering\bfseries\usekomafont{section}{\decofauthname}\par} + \vskip 3em + \decofauthtext\par + \begingroup + \renewcommand{\thanks}{\sbox0} + \raggedleft + \foreach \tmp@ in \@author { + \if\tmp@\empty\else + \hskip 1em \parbox{4cm}{ + \vskip 4em + \hrule\vskip 4pt + \raggedleft\footnotesize\tmp@ + }% + \fi + }\par + \endgroup +} +\newif\ifsingleauthor +\AtBeginDocument{ + \begingroup + \newcount\count@ + \count@=\z@ + \@for\tmp@:=\@author\do{\advance\count@\@ne} + \ifnum\count@>\@ne\global\singleauthorfalse\else\global\singleauthortrue\fi + \endgroup +} +\newcommand{\decofauthname}{Declaration of Authorship} +\newcaptionname{english}\decofauthname{Declaration of Authorship} +\newcaptionname{german,ngerman}\decofauthname{Selbstst\"andigkeitserkl\"arung} +\newcommand{\decofauthtext}{Language not supported!} +\newcaptionname{english}\decofauthtext{% + \ifsingleauthor{I}\else{We}\fi\space hereby certify that the work \ifsingleauthor{I}\else{we}\fi\space + \ifsingleauthor am\else are\fi\space submitting is entirely of \ifsingleauthor{my}\else{our}\fi own + making except where otherwise indicated. \ifsingleauthor{I}\else{We}\fi\space + \ifsingleauthor{am}\else{are}\fi\space aware of regulations concerning plagiarism, including + disciplinary actions that may result from it. Any use of the works of any other author, in any form, + is properly acknowledged at their point of use. +} +\newcaptionname{german,ngerman}\decofauthtext{% + Hiermit best{\"a}tige\ifsingleauthor\else{n}\fi\space \ifsingleauthor ich\else wir\fi, dass die + folgende Arbeit eigenst{\"a}ndig von \ifsingleauthor{mir}\else{uns}\fi\space allein erstellt und + unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem Arbeitsmaterial + unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines + Plagiats, inklusive disziplinarischer Ma{\ss}nahmen, sind \ifsingleauthor{mir}\else{uns}\fi\space + bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmenals solche kenntlich gemacht. +} +\def\declarationAuthorship{% + \ClassWarning{\HsHClassName}{% + Command \string\declarationAuthorship\space is deprecate.\MessageBreak + Replace it with \string\declarationofauthorship. + }% + \declarationofauthorship% +} +\newcommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} +\def\@subinrm#1{\sb{\mathrm{#1}}} +{\catcode`\_=13 \global\let_=\@subinrm} +\newcommand\upsubscripts{\catcode`\_=12} +\newcommand\normalsubscripts{\catcode`\_=8} +\RequirePackage{lmodern} +\areaset[current]{0.75\paperwidth}{0.8\paperheight} +\if@todos + \addtolength\paperwidth{5cm} + \addtolength\marginparwidth{5cm} +\fi +\renewcommand{\fps@figure}{h!t} +\renewcommand{\fps@table}{h!t} +\g@addto@macro\@floatboxreset\centering +\setcapwidth{0.8\textwidth} +\defcaptionname{english}\figurename{Fig.} +\defcaptionname{german,ngerman}\figurename{Abb.} +\defcaptionname{english}\tablename{Tab.} +\defcaptionname{german,ngerman}\tablename{Tab.} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{subfigure}{ + \let\subfigureautorefname\figureautorefname + }{}% + \makeatother +} +\renewcommand{\labelitemi}{\raisebox{.3ex}{\scalebox{0.7}{$\bullet$}}} +\renewcommand{\labelitemii}{\raisebox{.3ex}{\scalebox{0.7}{$\circ$}}} +\renewcommand{\labelitemiii}{\raisebox{.1ex}{-}} +\renewcommand{\labelitemiv}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}} \upsubscripts - -%% header and footer -\clearpairofpagestyles -\ofoot*{\pagemark} +\raggedbottom +\let\layercontentsmeasure\relax +\RequirePackage{scrlayer-scrpage} +\FamilyOptions{KOMA}{headsepline,singlespacing=true} \newpagestyle{HsHheadings}{ { \parbox[b]{\sls@headwidth}{ @@ -189,151 +390,26 @@ {\hfill\pagemark} {\hfill\pagemark} } +\clearpairofpagestyles +\ofoot*{\pagemark} \pagestyle{HsHheadings} \automark{chapter} \renewcommand*{\chapterpagestyle}{HsHheadings} - -%% floats -\renewcommand{\fps@figure}{h!t} -\renewcommand{\fps@table}{h!t} -\ifx\KOMAScriptVersion\undefined\else - \g@addto@macro\@floatboxreset\centering - \setcapwidth{0.8\textwidth} -\fi -\iflanguage{english}{ - \renewcaptionname{english}{\figurename}{Fig.} - \renewcaptionname{english}{\tablename}{Tab.} -}{}% -\iflanguage{ngerman}{ - \renewcaptionname{ngerman}{\figurename}{Abb.} - \renewcaptionname{ngerman}{\tablename}{Tab.} - \renewcaptionname{ngerman}{\abstractname}{Abstract} -}{}% - -%% styling for itemize -\renewcommand{\labelitemi}{$\bullet$} -\renewcommand{\labelitemii}{$\circ$} -\renewcommand{\labelitemiii}{$-$} -\renewcommand{\labelitemiv}{$\cdot$} - -%% do stuff -\setlength\parindent{0pt} -\raggedbottom -\let\layercontentsmeasure\relax - -%% define easy shorthands to switch pagenumbering -\newif\if@mainmatter\@mainmattertrue -\newcommand*\frontmatter{% - \if@twoside\cleardoubleoddpage\else\clearpage\fi - \@mainmatterfalse\pagenumbering{Roman}% -} -\newcommand*\mainmatter{% - \if@twoside\cleardoubleoddpage\else\clearpage\fi - \@mainmattertrue\pagenumbering{arabic}% -} -\newcommand*\backmatter{% - \if@openright\cleardoubleoddpage\else\clearpage\fi - \@mainmatterfalse\pagenumbering{roman}% -} - -%% custom commands -\newcommand{\uproman}[1]{\uppercase\expandafter{\romannumeral#1}} -\newcommand{\lowroman}[1]{\romannumeral#1\relax} - -%% load config at beginning of document -\AtBeginDocument{ - \makeatletter - \@ifpackageloaded{biblatex}{ - \renewcommand*{\mkbibacro}[1]{\MakeUppercase{#1}} - }{} - \@ifpackageloaded{subfigure}{ - \newcommand{\subfigureautorefname}{\figureautorefname} - }{} - \InputIfFileExists{HsH-classes.cfg}{ - \ClassInfo{\HsHClassName}{HsH-classes.cfg was found. Using it...} - }{ - \ClassInfo{\HsHClassName}{no HsH-classes.cfg!! I hope you configered it yourself.} - } - %% provide some usefull commands: - \providecommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} - \makeatother -} -%% nicer abstract --------------------------------------------------------------------------------- -\renewenvironment{abstract}{ - \quotation - \setlength\parindent{0pt} - \addchap{\abstractname} -}{% - \ifx\@keywords\@empty\else - \vskip 2em - \paragraph{% - \iflanguage{english}{Keywords}{}% - \iflanguage{ngerman}{Schlüsselwörter}{}% - } - \@keywords - \fi - \endquotation -} -%% declaration of Authorship ---------------------------------------------------------------------- -\iflanguage{english}{ - \setlocalecaption{english}{authorshipdeclaration}{Declaration of Authorship} -}{}% -\iflanguage{ngerman}{ - \setlocalecaption{ngerman}{authorshipdeclaration}{Selbstst\"andigkeitserkl\"arung} -}{}% -\newif\if@oneAuthor \@oneAuthortrue -\newcommand{\declarationofauthorship}[1][b]{ - \let\@param#1 - \renewcommand{\thanks}{\sbox0} - \foreach \x [count=\i] in \@author{\ifnum\i>1\global\@oneAuthorfalse\fi} - \thispagestyle{plain} - \if\@param b\vspace*{\fill}\fi - {\rule{\textwidth}{0.1pt}} - \vskip 3em - {\centering\huge\bfseries\authorshipdeclarationname\par} - \vskip 3em - \iflanguage{english}{ - \if@oneAuthor I\else We\fi\space hereby certify that the work \if@oneAuthor I\else we\fi\space \if@oneAuthor am\else are\fi\space submitting - is entirely of \if@oneAuthor my\else our\fi own making except where otherwise indicated. \if@oneAuthor I\else We\fi\space - \if@oneAuthor am\else are\fi\space aware of regulations concerning plagiarism, including disciplinary actions that may result from it. Any use - of the works of any other author, in any form, is properly acknowledged at their point of use. \par - }{}% - \iflanguage{ngerman}{ - Hiermit best{\"a}tige\if@oneAuthor\else n\fi\space \if@oneAuthor ich\else wir\fi, dass die folgende Arbeit eigenst{\"a}ndig von - \if@oneAuthor mir\else uns\fi\space allein erstellt und unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem - Arbeitsmaterial unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines Plagiats, inklusive - disziplinarischer Ma{\ss}nahmen, sind \if@oneAuthor mir\else uns\fi\space bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmen - als solche kenntlich gemacht. \par - }{}% - {\raggedleft - \foreach \x in \@author{ - \begin{tabular}[t]{r} - \\[3em] - \rule{4cm}{0.4pt}\\ - {\footnotesize\x} - \end{tabular} - } - \par} - \if\@param t\vspace*{\fill}\fi -} -\let\declarationAuthorship\declarationofauthorship - -%% reconfig Titlepage ----------------------------------------------------------------------------- -\iflanguage{english}{ - \setlocalecaption{english}{professor}{Professor} - \setlocalecaption{english}{firstexaminer}{First examiner} - \setlocalecaption{english}{secondexaminer}{Second examiner} -}{}% -\iflanguage{ngerman}{ - \setlocalecaption{ngerman}{professor}{Professor(in)/Lehrbeauftragte(r)} - \setlocalecaption{ngerman}{firstexaminer}{Erstpr{\"u}fer(in)} - \setlocalecaption{ngerman}{secondexaminer}{Zweitpr{\"u}fer(in)} -}{}% +\newcommand{\professortext}{Professor} +\newcommand{\firstexaminertext}{First examiner} +\newcommand{\secondexaminertext}{Second examiner} +\newcaptionname{english}\professortext{Professor} +\newcaptionname{english}\firstexaminertext{First examiner} +\newcaptionname{english}\secondexaminertext{Second examiner} +\newcaptionname{german,ngerman}\professortext{Professor(in)/Lehrbeauftragte(r)} +\newcaptionname{german,ngerman}\firstexaminertext{Erstpr{\"u}fer(in)} +\newcaptionname{german,ngerman}\secondexaminertext{Zweitpr{\"u}fer(in)} \newtoks\@tabtoks \newcommand\addtabtoks[1]{\global\@tabtoks\expandafter{\the\@tabtoks#1}} \newcommand\eaddtabtoks[1]{\edef\mytmp{#1}\expandafter\addtabtoks\expandafter{\mytmp}} \newcommand*\printtabtoks{\the\@tabtoks} \addtokomafont{publishers}{\normalsize} +\g@addto@macro\titlepage{\singlespacing} \renewcommand\maketitle[1][l]{ \expandafter\ifnum \csname scr@v@3.12\endcsname>\scr@compatibility\relax \else @@ -346,8 +422,9 @@ \begin{titlepage} \let\@param#1 \ifx\@param\@empty - \ClassError{\HsHClassName}{\maketitle\space with empty option}{ - \maketitle[] has been called with an empty parameter, this doesn't work. Use \maketitle instead. + \ClassError{\myClassName}{\maketitle\space with empty option}{ + \maketitle[] has been called (with an empty parameter), this doesn't work. + Use \maketitle instead. } \fi \if@titlepageiscoverpage @@ -450,9 +527,9 @@ \if\@param l\begin{tabular}{@{}l l}\fi \if\@param c\begin{tabular}{l l}\fi \if\@param r\begin{tabular}{r r@{}}\fi - \if\@professor\@empty\else\textbf{\professorname:}&\@professor\\\fi - \if\@firstexaminer\@empty\else\textbf{\firstexaminername:}&\@firstexaminer\\\fi - \if\@secondexaminer\@empty\else\textbf{\secondexaminername:}&\@secondexaminer\\\fi + \if\@professor\@empty\else\textbf{\professortext:}&\@professor\\\fi + \if\@firstexaminer\@empty\else\textbf{\firstexaminertext:}&\@firstexaminer\\\fi + \if\@secondexaminer\@empty\else\textbf{\secondexaminertext:}&\@secondexaminer\\\fi \end{tabular} } \par diff --git a/src/HsH-standalone.cls b/src/HsH-standalone.cls index 5a09a95bafb8756ea7b3b688d47854938a60bcd1..7d70d1a3e50a5a59f032c48bfbaf57a8437098ce 100644 --- a/src/HsH-standalone.cls +++ b/src/HsH-standalone.cls @@ -15,93 +15,225 @@ %% %% http://www.latex-project.org/lppl.txt %% -\typeout{Adapted from KOMA script for use in Hochschule Hannover <2023-08-12> Jan Wille} -\NeedsTeXFormat{LaTeX2e} -\newcommand{\HsHClassName}{HsH-standalone} -\ProvidesClass{\HsHClassName}[2023/08/12 v2.1 HsH-Class based on KOMA] - -%% commands for HsH-logo -\newcommand{\HsHlogoPath}{HSH-Logo.pdf} -\newcommand{\HsHlogoPage}{1} -\newcommand{\includeHsHlogohere}[1][5cm]{ - \IfFileExists{\HsHlogoPath}{}{ - \ClassError{\HsHClassName}{HsH-Logo.pdf not found!}{ - The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location - } - } - \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} -} -\newif\if@german% - -%% document options ------------------------------------------------------------------------------- -\DeclareOption{german}{ - \@germantrue +\NeedsTeXFormat{LaTeX2e}[2022-06-01] +\ProvidesClass{HsH-standalone} + [2024-04-23 3.00 HsH-class based on KOMA] +\let\HsHClassName\@currname +\def\HsHClassName@ParrentClass{% + standalone% } -\DeclareOption{ngerman}{ - \@germantrue +\RequirePackage{scrbase} +\RequirePackage{setspace} +\DefineFamily{HsH} +\DefineFamilyMember{HsH} +\newcommand{\HsH@Options@PassToParrent}[1]{% + \ClassInfoNoLine{\HsHClassName}{passing option to parrent class: #1}% + \PassOptionsToClass{#1}{\HsHClassName@ParrentClass}% } -\DeclareOption{english}{ - \@germanfalse +\newcommand{\HsH@Options@DeclareAlias}[3][HsH]{% + \DeclareOption{#2}{\FamilyExecuteOptions{#1}{#3}}% } -\DeclareOption{f1}{ - \renewcommand{\HsHlogoPage}{2} +\DefineFamilyKey{HsH}{fontfamily}{ + \begingroup + \FamilySetNumerical{HsH}{parskip}{@tmp}{% + {sans}{0}, {sans-serif}{0},% + {roman}{1}, {serif}{1},% + }{#1} + \ifx\FamilyKeyState\FamilyKeyStateProcessed + \aftergroup\FamilyKeyStateProcessed + \ifcase\@tmp% 0 + \endgroup + \renewcommand{\familydefault}{\sfdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \or% 1 + \endgroup + \renewcommand{\familydefault}{\rmdefault} + \if@atdocument\AfterKOMAoptions{\selectfont}\fi + \else% should never be + \endgroup + \fi + \else + \endgroup + \FamilyKeyStateUnknownValue + \fi } -\DeclareOption{f2}{ - \renewcommand{\HsHlogoPage}{3} +\HsH@Options@DeclareAlias{sans}{fontfamily=sans} +\HsH@Options@DeclareAlias{roman}{fontfamily=roman} +\def\HsH@opt@language{nil} +\FamilyStringKey{HsH}{language}{\HsH@opt@language} +\HsH@Options@DeclareAlias{english}{language=english} +\HsH@Options@DeclareAlias{german}{language=ngerman} +\HsH@Options@DeclareAlias{ngerman}{language=ngerman} +\def\HsH@opt@faculty{1} +\FamilyNumericalKey{HsH}{faculty}{HsH@opt@faculty}{% + {none}{1}, {false}{1},% + {f1}{2}, {1}{2},% + {f2}{3}, {2}{3},% + {f3}{4}, {3}{4},% + {f4}{5}, {4}{5},% + {f5}{6}, {5}{6},% } -\DeclareOption{f3}{ - \renewcommand{\HsHlogoPage}{4} +\HsH@Options@DeclareAlias{f1}{faculty=f1} +\HsH@Options@DeclareAlias{f2}{faculty=f2} +\HsH@Options@DeclareAlias{f3}{faculty=f3} +\HsH@Options@DeclareAlias{f4}{faculty=f4} +\HsH@Options@DeclareAlias{f5}{faculty=f5} +\FamilyBoolKey{HsH}{todos}{@todos} +\DefineFamilyKey{HsH}{fontsize}{% + \ClassInfoNoLine{\HsHClassName}{The `fontsize' option is only a mock, its has not effect} + \FamilyKeyStateProcessed } -\DeclareOption{f4}{ - \renewcommand{\HsHlogoPage}{5} +\DefineFamilyKey{HsH}{@else@}{ + \HsH@Options@PassToParrent{#1} + \FamilyKeyStateProcessed } -\DeclareOption{f5}{ - \renewcommand{\HsHlogoPage}{6} +\DeclareOption*{ + \HsH@Options@PassToParrent{\CurrentOption} } -\DeclareOption{sans}{ - \renewcommand{\familydefault}{\sfdefault} +\FamilyExecuteOptions{HsH}{% + fontfamily=sans-serif, + faculty=none, + margin=0.25cm, + multi=tikzpicture, + multi=circuitikz, } -\DeclareOption{roman}{ - \renewcommand{\familydefault}{\rmdefault} +\FamilyProcessOptions{HsH}\relax +\LoadClass{\HsHClassName@ParrentClass} +\RequirePackage[T1]{fontenc} +\RequirePackage{type1ec} +\RequirePackage[main=\HsH@opt@language]{babel} +\RequirePackage[autostyle=true]{csquotes} +\MakeOuterQuote{"} +\iflanguage{ngerman}{\RequirePackage{ziffer}}{}% +\RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' +\RequirePackage{bookmark} +\AtBeginDocument{ + \hypersetup{ + pdfinfo={ + Title={\@title}, + Author={\@author}, + Subject={\@subject}, + Keywords={\@keywords} + } + } } -%% defere all other options to the base class -\DeclareOption*{\expandafter\PassOptionsToClass\expandafter{\CurrentOption}{standalone}} -\ExecuteOptions{margin=0.25cm,fontsize=11pt,a4paper,ngerman,sans} % default options -\ProcessOptions\relax -%% Load KOMA class -\LoadClass[multi=tikzpicture,multi=circuitikz]{standalone} - -%% package loading and config --------------------------------------------------------------------- -\PassOptionsToPackage{utf8}{inputenc} -\RequirePackage{inputenc} -\PassOptionsToPackage{T1}{fontenc} -\RequirePackage{fontenc} -\RequirePackage{lmodern} +\if@todos + \PassOptionsToPackage{ + textsize=small, + figwidth=.6\textwidth + }{todonotes} + \RequirePackage{todonotes} +\else + \newcommand{\listoftodos}[1]{} + \newcommand{\todo}[2][]{} + \newcommand{\missingfigure}[2][]{} +\fi +\RequirePackage[hypcap=true]{caption} \RequirePackage{graphicx} -\RequirePackage{amsmath} -%% options for not loaded packages ---------------------------------------------------------------- +\RequirePackage{amsmath,amssymb,amsfonts} +\RequirePackage[svgnames]{xcolor} +\RequirePackage{scrhack} \PassOptionsToPackage{free-standing-units}{siunitx} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} - -%% typesetting indexes upright or standart -\def\subinrm#1{\sb{\mathrm{#1}}} -{\catcode`\_=13 \global\let_=\subinrm} -\newcommand\upsubscripts{\catcode`\_=12 } -\newcommand\normalsubscripts{\catcode`\_=8 } -\upsubscripts - -%% load config at beginning of document \AtBeginDocument{ \makeatletter \InputIfFileExists{HsH-classes.cfg}{ - \ClassInfo{\HsHClassName}{HsH-classes.cfg was found. Using it...} + \ClassInfo{\HsHClassName}{Local config file HsH-classes.cfg used.} }{ - \ClassInfo{\HsHClassName}{no HsH-classes.cfg!! I hope you configered it yourself.} + \ClassInfo{\HsHClassName}{No HsH-classes.cfg!! I hope you configered it yourself.} } - %% provide some usefull commands: - \providecommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} \makeatother } +\newcommand{\HsHlogoPath}{HSH-Logo.pdf} +\newcommand{\HsHlogoPage}{\HsH@opt@faculty} +\newcommand{\includeHsHlogohere}[1][5cm]{ + \IfFileExists{\HsHlogoPath}{ + \includegraphics[width=#1,page=\HsHlogoPage]{\HsHlogoPath} + }{ + \ClassError{\HsHClassName}{\HsHlogoPath\space not found!}{ + The HsH Logo is necasary for the titlepage! Try putting it next to your source file or use \HsHlogoPath to define the file location + } + } +} +\RequirePackage{pgffor} +\newcommand{\declarationofauthorship}[1][b]{ + \if#1b + \vspace*{\fill} + \hrule + \else\if#1t + \vspace*{2em} + \else + \ClassError{\HsHClassName}{Wrong Parameter for `\declarationofauthorship'}{ + `\string\declarationofauthorship' only accepts `t' and `b' as parameters. + } + \fi\fi + \vskip 3em + {\centering\bfseries\usekomafont{section}{\decofauthname}\par} + \vskip 3em + \decofauthtext\par + \begingroup + \renewcommand{\thanks}{\sbox0} + \raggedleft + \foreach \tmp@ in \@author { + \if\tmp@\empty\else + \hskip 1em \parbox{4cm}{ + \vskip 4em + \hrule\vskip 4pt + \raggedleft\footnotesize\tmp@ + }% + \fi + }\par + \endgroup +} +\newif\ifsingleauthor +\AtBeginDocument{ + \begingroup + \newcount\count@ + \count@=\z@ + \@for\tmp@:=\@author\do{\advance\count@\@ne} + \ifnum\count@>\@ne\global\singleauthorfalse\else\global\singleauthortrue\fi + \endgroup +} +\newcommand{\decofauthname}{Declaration of Authorship} +\newcaptionname{english}\decofauthname{Declaration of Authorship} +\newcaptionname{german,ngerman}\decofauthname{Selbstst\"andigkeitserkl\"arung} +\newcommand{\decofauthtext}{Language not supported!} +\newcaptionname{english}\decofauthtext{% + \ifsingleauthor{I}\else{We}\fi\space hereby certify that the work \ifsingleauthor{I}\else{we}\fi\space + \ifsingleauthor am\else are\fi\space submitting is entirely of \ifsingleauthor{my}\else{our}\fi own + making except where otherwise indicated. \ifsingleauthor{I}\else{We}\fi\space + \ifsingleauthor{am}\else{are}\fi\space aware of regulations concerning plagiarism, including + disciplinary actions that may result from it. Any use of the works of any other author, in any form, + is properly acknowledged at their point of use. +} +\newcaptionname{german,ngerman}\decofauthtext{% + Hiermit best{\"a}tige\ifsingleauthor\else{n}\fi\space \ifsingleauthor ich\else wir\fi, dass die + folgende Arbeit eigenst{\"a}ndig von \ifsingleauthor{mir}\else{uns}\fi\space allein erstellt und + unter Ber{\"u}cksichtigung der zur Verf{\"u}gung gestellten Aufgabenstellung sowie dem Arbeitsmaterial + unter Angabe aller verwendeten Quellen erarbeitet wurde. Die Regelungen und Konsequenzen eines + Plagiats, inklusive disziplinarischer Ma{\ss}nahmen, sind \ifsingleauthor{mir}\else{uns}\fi\space + bewusst. Insbesondere wurden alle Zitate und gedanklichen {\"U}bernahmenals solche kenntlich gemacht. +} +\def\declarationAuthorship{% + \ClassWarning{\HsHClassName}{% + Command \string\declarationAuthorship\space is deprecate.\MessageBreak + Replace it with \string\declarationofauthorship. + }% + \declarationofauthorship% +} +\newcommand{\abs}[1]{\ensuremath{\left\vert#1\right\vert}} +\def\@subinrm#1{\sb{\mathrm{#1}}} +{\catcode`\_=13 \global\let_=\@subinrm} +\newcommand\upsubscripts{\catcode`\_=12} +\newcommand\normalsubscripts{\catcode`\_=8} +\RequirePackage{lmodern} +\renewcommand{\labelitemi}{\raisebox{.3ex}{\scalebox{0.7}{$\bullet$}}} +\renewcommand{\labelitemii}{\raisebox{.3ex}{\scalebox{0.7}{$\circ$}}} +\renewcommand{\labelitemiii}{\raisebox{.1ex}{-}} +\renewcommand{\labelitemiv}{\raisebox{-.1ex}{\scalebox{1.3}{$\cdot$}}} +\upsubscripts +\raggedbottom +\let\layercontentsmeasure\relax \endinput %% %% End of file `HsH-standalone.cls'. diff --git a/test.pdf b/test.pdf index e2ea32f9e3e43065a0ac3aa49c7852412a3ecd5d..be274c920fac9b5325f6148c3a4428b345b5cbf1 100644 --- a/test.pdf +++ b/test.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5c00e8cc9be94f66bf79db9b358882f1adb98ee1802b60c959d987a893925157 -size 375174 +oid sha256:c27337dd88631c2f6af1750c85bc7798975abc3a0cab78bea8b4bd3dd8a46dc4 +size 59613 diff --git a/test.tex b/test.tex index 86e2ee9b25f4e3bbe763b8621a929638952f28ef..7c43a7b3ead61141fb1e03b8cb802658695c87a9 100644 --- a/test.tex +++ b/test.tex @@ -1,111 +1,71 @@ -\documentclass[todos,f1]{HsH-report} +\documentclass[todos=off]{HsH-report} -\usepackage{color} \usepackage{lipsum} -\usepackage{siunitx} -\usepackage{biblatex} -\usepackage{soul} -\addbibresource{bib/localBibliography.bib} +% \usepackage{showframe} %% documents personal data: \author{ Max Mustermann, Mira Musterfrau } -\matrikelnr{ - 1234567, - 9876543 -} \titlehead{titlehead} \subject{Subject} -\title[short title]{long and elaborate title that just goes on and on witout stopping} +\title{long and elaborate title that just goes on and on without stopping} \subtitle{Subtitle} \date{\today} -\professor{Professor} -\keywords{test, baum} +\keywords{test, wow} + +\defcaptionname{german,ngerman}\abstractname{Abstract} \begin{document} + \frontmatter + \maketitle + + \declarationofauthorship + + \begin{abstract} + \lipsum[3-5] + \end{abstract} + + \tableofcontents + \mainmatter + + \chapter{test} + \includeHsHlogohere + + Hällo\todo{drop the Ä?} "Welt", ist daß nicht schön? $3.1$ oder $3,2$ + + \begin{equation} + A_1 = \sum_{i=0}^{10} B_i + \abs{\frac{x}{2}} + \end{equation} + + \begin{itemize} + \item Hello World + \item test + \begin{itemize} + \item Hello World + \item test + \begin{itemize} + \item Hello World + \item test + \begin{itemize} + \item Hello World + \item test + \end{itemize} + \end{itemize} + \end{itemize} + \end{itemize} + + \section{superlong and elaborat title that will spand multiple lines, as it is just to big} + \lipsum[12-13] + \smallskip + + \lipsum[12-13] + + \todo[inline]{add another paragraph?} + + \lipsum[12-13] + -\pagenumbering{Roman} -\maketitle -\declarationAuthorship - -\begin{abstract} - \lipsum[5-8] -\end{abstract} - -\tableofcontents - -\cleardoublepage % unbedingt erforderlich bei Doppelseitigem layout vor neuer Seitennummerierung! -\pagenumbering{arabic} % Seitennummerierung normale zahlen - -\chapter{very precice chapterheading with a bounch of important information} - \label{chap: one} - {\color{red}test} und stuff - \begin{figure} - \centering - \includegraphics[width=.6\textwidth]{img/lorem-ipsum.jpg} - \caption{test} - \end{figure} - - title test: \ifx\@shorttitle\@empty\@title\else\@shorttitle\fi - - noch ein test \normalsubscripts$R_t$ \upsubscripts$R_t$ - - mit einheit: $R=200\,\mohm+ \SI{0.34567453}{\volt\per\metre}$ - \cite{laboranleitung:physik} - \vspace{2cm}\\ - eine zahl: $3,5+3.5$\footnote[1]{hello}\\ - - Tiny: {\tiny hello} \todo{test} Small: {\small hello} - - \makeatletter - \newcommand{\test}[1][l]{ - { - \def\t{#1} - \if\t l left - \else - right - \fi - } - } - \test; \test[right] \todo{super long todo that mus be going over multiple lines} - - \lipsum[5-6] - - \pagebreak - \begin{figure} - \centering - \includegraphics[width=0.6\textwidth, page=2]{plt/examplePlot.pdf} - \caption{a nice plot } - \end{figure} - - test text\todo{why this?} - - \begin{figure} - \centering - \includegraphics{crc/exampleCircuit.pdf} - \caption{a circuit diagramm} - \end{figure} - - \makeatletter - - \begin{figure} - \graphicspath{{svg/}} % double curly brackets needet for unknown reason - \input{svg/exampleSVG.pdf_tex} - \caption{made via inkscape} - \end{figure} - - \begin{table} - \caption{hello} - \begin{tabular}{c|c} - test & hello \\\hline\hline - 1 & 2 \\ - \multicolumn{2}{|c|}{temp} - \end{tabular} - \end{table} - -\printbibliography -\listoffigures \end{document}