From ba5722bf85f4a7959d7197d54f97281b9f1cf34e Mon Sep 17 00:00:00 2001 From: Jan Wille <jan.wille@stud.hs-hannover.de> Date: Tue, 23 Apr 2024 22:14:09 +0200 Subject: [PATCH] move some settings from `HsH-classes.cfg` to class files --- src/HsH-article.cls | 31 +++++++++++++++++++++++------ src/HsH-classes.cfg | 8 -------- src/HsH-classes.dtx | 45 +++++++++++++++++++++++++++++++++++------- src/HsH-classes.pdf | 4 ++-- src/HsH-report.cls | 31 +++++++++++++++++++++++------ src/HsH-standalone.cls | 31 +++++++++++++++++++++++------ test.pdf | 4 ++-- test.tex | 6 ++++++ 8 files changed, 123 insertions(+), 37 deletions(-) diff --git a/src/HsH-article.cls b/src/HsH-article.cls index abb5657..07cf0e6 100644 --- a/src/HsH-article.cls +++ b/src/HsH-article.cls @@ -5,16 +5,16 @@ %% The original source files were: %% %% HsH-classes.dtx (with options: `article') -%% +%% %% Copyright (C) 2024 by Jan Wille <mail@janiwlle.de> -%% +%% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either %% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in the file: -%% +%% %% http://www.latex-project.org/lppl.txt -%% +%% \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesClass{HsH-article} [2024-04-23 3.00 HsH-class based on KOMA] @@ -171,7 +171,7 @@ \RequirePackage[main=\HsH@opt@language]{babel} \RequirePackage[autostyle=true]{csquotes} \MakeOuterQuote{"} -\iflanguage{ngerman}{\RequirePackage{ziffer}}{}% +\iflanguage{ngerman}{\RequirePackage{ziffer}}{} \RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' \RequirePackage{bookmark} \AtBeginDocument{ @@ -199,7 +199,6 @@ \RequirePackage{graphicx} \RequirePackage{amsmath,amssymb,amsfonts} \RequirePackage[svgnames]{xcolor} -\RequirePackage{scrhack} \PassOptionsToPackage{backend=biber}{biblatex} \AtBeginDocument{ \makeatletter @@ -209,6 +208,26 @@ \makeatother } \PassOptionsToPackage{free-standing-units}{siunitx} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{siunitx}{ + \iflanguage{ngerman}{ + \sisetup{output-decimal-marker={,}} + }{} + }{} + \makeatother +} +\RequirePackage{scrhack} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \RequirePackage{lstautogobble}\lstset{autogobble=true} + \iflanguage{ngerman}{ + \lstset{literate={Ö}{{\"O}}1{Ä}{{\"A}}1{Ü}{{\"U}}1{ß}{{\ss}}1{ü}{{\"u}}1{ä}{{\"a}}1{ö}{{\"o}}1} + }{} + }{} + \makeatother +} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} \AtBeginDocument{ \makeatletter diff --git a/src/HsH-classes.cfg b/src/HsH-classes.cfg index c3a352f..5b89473 100644 --- a/src/HsH-classes.cfg +++ b/src/HsH-classes.cfg @@ -14,9 +14,6 @@ } }{} \@ifpackageloaded{siunitx}{ - \iflanguage{ngerman}{ - \sisetup{output-decimal-marker={,}} % use comma as dezimal - }{}% \sisetup{ tight-spacing=true, per-mode=symbol, @@ -27,9 +24,6 @@ } }{} \@ifpackageloaded{listings}{ - \PassOptionsToPackage{svgnames}{xcolor} - \RequirePackage{xcolor} - \RequirePackage{lstautogobble} \lstset{ commentstyle=\color{gray}, keywordstyle=\color{FireBrick}\bfseries, @@ -37,9 +31,7 @@ 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}{ diff --git a/src/HsH-classes.dtx b/src/HsH-classes.dtx index 13cf50c..24148ae 100644 --- a/src/HsH-classes.dtx +++ b/src/HsH-classes.dtx @@ -861,7 +861,7 @@ http://www.latex-project.org/lppl.txt % 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}}{}% +\iflanguage{ngerman}{\RequirePackage{ziffer}}{} % \end{macrocode} % % @@ -908,12 +908,6 @@ http://www.latex-project.org/lppl.txt \RequirePackage[svgnames]{xcolor} % \end{macrocode} % -% For better compatibility with the \pkg{listings} package we load the -% \pkg{scrhack} package. -% \begin{macrocode} -\RequirePackage{scrhack} -% \end{macrocode} -% % \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. @@ -921,6 +915,9 @@ http://www.latex-project.org/lppl.txt % 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. +% +% For the \pkg{bibtex} we ensure the \emph{biber} backend is selcted, which matches +% the settings in |.latexmkrc|. % \begin{macrocode} %<*article|report> \PassOptionsToPackage{backend=biber}{biblatex} @@ -932,7 +929,41 @@ http://www.latex-project.org/lppl.txt \makeatother } %</article|report> +% \end{macrocode} +% +% For \pkg{bibtex} we load the free-stadnding units, mostly for backwards compatibility. +% We also ensure german language specific settings are applyed. +% \begin{macrocode} \PassOptionsToPackage{free-standing-units}{siunitx} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{siunitx}{ + \iflanguage{ngerman}{ + \sisetup{output-decimal-marker={,}} + }{} + }{} + \makeatother +} +% \end{macrocode} +% +% For better compatibility with the \pkg{listings} package we load the +% \pkg{scrhack} package. We also pass some configurations to if if it gets loaded. +% \begin{macrocode} +\RequirePackage{scrhack} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \RequirePackage{lstautogobble}\lstset{autogobble=true} + \iflanguage{ngerman}{ + \lstset{literate={Ö}{{\"O}}1{Ä}{{\"A}}1{Ü}{{\"U}}1{ß}{{\ss}}1{ü}{{\"u}}1{ä}{{\"a}}1{ö}{{\"o}}1} + }{} + }{} + \makeatother +} +% \end{macrocode} +% +% The \pkg{circuitikz} needs bo be configure so it matches typical european styles. +% \begin{macrocode} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} % \end{macrocode} % diff --git a/src/HsH-classes.pdf b/src/HsH-classes.pdf index 593ceca..c46cf0c 100644 --- a/src/HsH-classes.pdf +++ b/src/HsH-classes.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9fc4c73ce94b87b806dc3dab2f1d830277c372596b61e94d7c72ee647905a2f4 -size 310671 +oid sha256:5511976d0dbcde0b1cf2b63aaf4467734dc03f8c8574781d19cc506504445c63 +size 312970 diff --git a/src/HsH-report.cls b/src/HsH-report.cls index e808665..3548b21 100644 --- a/src/HsH-report.cls +++ b/src/HsH-report.cls @@ -5,16 +5,16 @@ %% The original source files were: %% %% HsH-classes.dtx (with options: `report') -%% +%% %% Copyright (C) 2024 by Jan Wille <mail@janiwlle.de> -%% +%% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either %% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in the file: -%% +%% %% http://www.latex-project.org/lppl.txt -%% +%% \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesClass{HsH-report} [2024-04-23 3.00 HsH-class based on KOMA] @@ -171,7 +171,7 @@ \RequirePackage[main=\HsH@opt@language]{babel} \RequirePackage[autostyle=true]{csquotes} \MakeOuterQuote{"} -\iflanguage{ngerman}{\RequirePackage{ziffer}}{}% +\iflanguage{ngerman}{\RequirePackage{ziffer}}{} \RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' \RequirePackage{bookmark} \AtBeginDocument{ @@ -199,7 +199,6 @@ \RequirePackage{graphicx} \RequirePackage{amsmath,amssymb,amsfonts} \RequirePackage[svgnames]{xcolor} -\RequirePackage{scrhack} \PassOptionsToPackage{backend=biber}{biblatex} \AtBeginDocument{ \makeatletter @@ -209,6 +208,26 @@ \makeatother } \PassOptionsToPackage{free-standing-units}{siunitx} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{siunitx}{ + \iflanguage{ngerman}{ + \sisetup{output-decimal-marker={,}} + }{} + }{} + \makeatother +} +\RequirePackage{scrhack} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \RequirePackage{lstautogobble}\lstset{autogobble=true} + \iflanguage{ngerman}{ + \lstset{literate={Ö}{{\"O}}1{Ä}{{\"A}}1{Ü}{{\"U}}1{ß}{{\ss}}1{ü}{{\"u}}1{ä}{{\"a}}1{ö}{{\"o}}1} + }{} + }{} + \makeatother +} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} \AtBeginDocument{ \makeatletter diff --git a/src/HsH-standalone.cls b/src/HsH-standalone.cls index cfcfa15..04decc2 100644 --- a/src/HsH-standalone.cls +++ b/src/HsH-standalone.cls @@ -5,16 +5,16 @@ %% The original source files were: %% %% HsH-classes.dtx (with options: `standalone') -%% +%% %% Copyright (C) 2024 by Jan Wille <mail@janiwlle.de> -%% +%% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License (LPPL), either %% version 1.3c of this license or (at your option) any later %% version. The latest version of this license is in the file: -%% +%% %% http://www.latex-project.org/lppl.txt -%% +%% \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesClass{HsH-standalone} [2024-04-23 3.00 HsH-class based on KOMA] @@ -104,7 +104,7 @@ \RequirePackage[main=\HsH@opt@language]{babel} \RequirePackage[autostyle=true]{csquotes} \MakeOuterQuote{"} -\iflanguage{ngerman}{\RequirePackage{ziffer}}{}% +\iflanguage{ngerman}{\RequirePackage{ziffer}}{} \RequirePackage[hidelinks]{hyperref} % must load before `bookmarks' \RequirePackage{bookmark} \AtBeginDocument{ @@ -132,8 +132,27 @@ \RequirePackage{graphicx} \RequirePackage{amsmath,amssymb,amsfonts} \RequirePackage[svgnames]{xcolor} -\RequirePackage{scrhack} \PassOptionsToPackage{free-standing-units}{siunitx} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{siunitx}{ + \iflanguage{ngerman}{ + \sisetup{output-decimal-marker={,}} + }{} + }{} + \makeatother +} +\RequirePackage{scrhack} +\AtBeginDocument{ + \makeatletter + \@ifpackageloaded{biblatex}{ + \RequirePackage{lstautogobble}\lstset{autogobble=true} + \iflanguage{ngerman}{ + \lstset{literate={Ö}{{\"O}}1{Ä}{{\"A}}1{Ü}{{\"U}}1{ß}{{\ss}}1{ü}{{\"u}}1{ä}{{\"a}}1{ö}{{\"o}}1} + }{} + }{} + \makeatother +} \PassOptionsToPackage{european,EFvoltages,straightvoltages,betterproportions}{circuitikz} \AtBeginDocument{ \makeatletter diff --git a/test.pdf b/test.pdf index bcb14ff..e849b84 100644 --- a/test.pdf +++ b/test.pdf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d5d9728aa5d9aec8d3dade86e36576ddc5b5bbbb44c71e5f2e0d3bf72e8c0a5 -size 192319 +oid sha256:840ea5ae3c85ee50216c6d560b7c9cdd83562b569a438ee6ff26d264d5387f96 +size 193375 diff --git a/test.tex b/test.tex index 7c43a7b..64a6726 100644 --- a/test.tex +++ b/test.tex @@ -1,6 +1,7 @@ \documentclass[todos=off]{HsH-report} \usepackage{lipsum} +\usepackage{siunitx} % \usepackage{showframe} %% documents personal data: @@ -40,6 +41,11 @@ A_1 = \sum_{i=0}^{10} B_i + \abs{\frac{x}{2}} \end{equation} + \begin{equation} + \frac{4\,\m}{12\,\s} = \frac{1}{3}\,\unit{m\per s} + \end{equation} + + \begin{itemize} \item Hello World \item test -- GitLab