Store to move back to normal tex files
This commit is contained in:
353
janishutz-helpers.sty
Normal file
353
janishutz-helpers.sty
Normal file
@@ -0,0 +1,353 @@
|
||||
%%
|
||||
%% Copyright (C) 2026 Janis Hutz
|
||||
%%
|
||||
%% This file may be distributed and/or modified under the
|
||||
%% conditions of the LaTeX Project Public License, either
|
||||
%% version 1.3 of this license or (at your option) any later
|
||||
%% version. The latest version of this license is in:
|
||||
%% http://www.latex-project.org/lppl.txt
|
||||
%% and version 1.3c or later is part of all distributions of
|
||||
%% LaTeX version 2008-05-04 or later.
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
|
||||
|
||||
\ProvidesPackage{janishutz-helpers}[2026-02-19 v1.0.0]
|
||||
|
||||
% Package imports
|
||||
\RequirePackage[table, dvipsnames]{xcolor}
|
||||
\RequirePackage{amsmath}
|
||||
\RequirePackage{graphicx}
|
||||
\RequirePackage{subcaption}
|
||||
\RequirePackage[export]{adjustbox}
|
||||
\RequirePackage[most]{tcolorbox}
|
||||
\RequirePackage{cancel}
|
||||
\RequirePackage{dsfont}
|
||||
\RequirePackage{amssymb}
|
||||
\RequirePackage{mathrsfs}
|
||||
\RequirePackage{lipsum}
|
||||
\RequirePackage{ulem}
|
||||
\RequirePackage{soul}
|
||||
\RequirePackage{parskip}
|
||||
\RequirePackage{fancyhdr}
|
||||
\RequirePackage{lastpage}
|
||||
\RequirePackage{tocloft}
|
||||
\RequirePackage{wasysym}
|
||||
\RequirePackage{wrapfig}
|
||||
\RequirePackage{multicol}
|
||||
\RequirePackage{ifthen}
|
||||
\RequirePackage[hidelinks]{hyperref}
|
||||
\RequirePackage{enumitem}
|
||||
\RequirePackage{gensymb}
|
||||
\RequirePackage{pifont}
|
||||
\RequirePackage{xstring}
|
||||
\RequirePackage{etoolbox}
|
||||
|
||||
\newcounter{descriptorShadeStrength}
|
||||
\newcounter{shadeStrength}
|
||||
\newcommand{\currentLanguage}{en}
|
||||
|
||||
\setcounter{secnumdepth}{4}
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ General config │
|
||||
% └ ┘
|
||||
% Configure your author name here
|
||||
\newcommand{\authorTitle}{Janis Hutz\\\url{https://janishutz.com}}
|
||||
\newcommand{\authorHeaders}{Janis Hutz}
|
||||
|
||||
% Configure your address here
|
||||
\newcommand{\name}{Janis Hutz}
|
||||
\newcommand{\street}{Street}
|
||||
\newcommand{\city}{City}
|
||||
\newcommand{\countrycode}{CH}
|
||||
|
||||
% Set the default language
|
||||
\renewcommand{\currentLanguage}{en}
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ Rendering │
|
||||
% └ ┘
|
||||
% Short descriptors are generated from the naming defined in naming.sty
|
||||
% You may here configure how they are generated. #1 is the full name.
|
||||
\newcommand{\shortDescriptorNameTemplate}[1]{\StrBefore[1]{#1}}
|
||||
|
||||
% Decide if the numbering should show a space preceding it.
|
||||
% \newcommand{\useSpaceBeforeNumbering}{true}
|
||||
% TODO: Remove above if works without
|
||||
|
||||
% Specify how the inline and short descriptors (e.g. Lemma, etc) are rendered.
|
||||
% - #1 is the name of the descriptor
|
||||
% - #2 is the number (correctly rendered according to settings and preceded with space if not disabled)
|
||||
% - #3 is the name passed (non-empty asserted)
|
||||
\newcommand{\shortDescriptorTemplate}[4]{\bg{#1color}{\shortDescriptorNameTemplate{#1}#2} \textit{(#3)}\ }
|
||||
\newcommand{\inlineDescriptorTemplate}[4]{\bg{#1color}{#1#2}: \textit{(#3)}\ }
|
||||
|
||||
% These are used if no name is provided and argument #4 from above is the missing argument
|
||||
\newcommand{\anonymousShortDescriptorTemplate}[3]{\bg{#1color}{\shortDescriptorNameTemplate{#1}#2}\ }
|
||||
\newcommand{\anonymousInlineDescriptorTemplate}[3]{\bg{#3color}{#1#2}\ }
|
||||
|
||||
% background command config (draws a small box around the content)
|
||||
\newcommand{\backgroundPadding}{2pt}
|
||||
\newcommand{\backgroundRounding}{0.1pt}
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ Colours │
|
||||
% └ ┘
|
||||
% The colour-saturation of the short / inline descriptors (default = 40)
|
||||
\setcounter{descriptorShadeStrength}{40}
|
||||
|
||||
% The colour-saturation of the shade command (default = 20)
|
||||
\setcounter{shadeStrength}{20}
|
||||
|
||||
% You may also use \definecolor{<name>}{rgb}{r, g, b} to define a fully custom color
|
||||
% see https://www.overleaf.com/learn/latex/Using_colors_in_LaTeX#Creating_your_own_colors for more information
|
||||
\colorlet{definitioncolor}{blue}
|
||||
\colorlet{theoremcolor}{ForestGreen}
|
||||
\colorlet{lemmacolor}{Aquamarine}
|
||||
\colorlet{corollarycolor}{teal}
|
||||
\colorlet{axiomcolor}{JungleGreen}
|
||||
\colorlet{factcolor}{SeaGreen}
|
||||
\colorlet{propositioncolor}{Cyan}
|
||||
\colorlet{examplecolor}{gray}
|
||||
\colorlet{formulacolor}{red}
|
||||
\colorlet{remarkcolor}{green}
|
||||
\colorlet{proofcolor}{magenta}
|
||||
\colorlet{intuitioncolor}{Emerald}
|
||||
\colorlet{termcolor}{orange}
|
||||
\colorlet{notationcolor}{Peach}
|
||||
\colorlet{taskcolor}{gray}
|
||||
\colorlet{usagecolor}{LimeGreen}
|
||||
\colorlet{recallcolor}{yellow}
|
||||
\colorlet{propertiescolor}{purple}
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ Numbering │
|
||||
% └ ┘
|
||||
% Set a preset, can be combined, separate or off.
|
||||
% If set to custom, all type specific commands need to be set below.
|
||||
\newcommand{\numberingpreset}{combined}
|
||||
|
||||
% Specify how elements are to be numbered. Can be (X is the current number of the element):
|
||||
% - none (X)
|
||||
% - section (section.X)
|
||||
% - subsection (section.subsection.X)
|
||||
% - subsubsection (section.subsection.subsubsection.X)
|
||||
% - paragraph (section.subsection.subsubsection.paragraph.X)
|
||||
\newcommand{\subsectionnumbering}{subsection}
|
||||
|
||||
|
||||
% Set for a specific type. Can each be combined, separate, default or off:
|
||||
% If set to anything but 'default', it will override the overarching style
|
||||
% set by \numberingpreset
|
||||
\newcommand{\definitionnumbering}{default}
|
||||
\newcommand{\theoremnumbering}{default}
|
||||
\newcommand{\lemmanumbering}{default}
|
||||
\newcommand{\corollarynumbering}{default}
|
||||
\newcommand{\axiomnumbering}{default}
|
||||
\newcommand{\factnumbering}{default}
|
||||
\newcommand{\propositionnumbering}{default}
|
||||
\newcommand{\examplenumbering}{default}
|
||||
\newcommand{\formulanumbering}{default}
|
||||
\newcommand{\remarknumbering}{default}
|
||||
\newcommand{\proofnumbering}{default}
|
||||
\newcommand{\intuitionnumbering}{default}
|
||||
\newcommand{\termnumbering}{default}
|
||||
\newcommand{\notationnumbering}{default}
|
||||
\newcommand{\tasknumbering}{default}
|
||||
\newcommand{\usagenumbering}{default}
|
||||
\newcommand{\recallnumbering}{default}
|
||||
\newcommand{\propertiesnumbering}{default}
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ Naming │
|
||||
% └ ┘
|
||||
% Here you may specify how each descriptor is named
|
||||
\newcommand{\definitionNamingEN}{Definition}
|
||||
\newcommand{\theoremNamingEN}{Theorem}
|
||||
\newcommand{\lemmaNamingEN}{Lemma}
|
||||
\newcommand{\corollaryNamingEN}{Corollary}
|
||||
\newcommand{\axiomNamingEN}{Axiom}
|
||||
\newcommand{\factNamingEN}{Fact}
|
||||
\newcommand{\propositionNamingEN}{Proposition}
|
||||
\newcommand{\exampleNamingEN}{Example}
|
||||
\newcommand{\formulaNamingEN}{Formula}
|
||||
\newcommand{\remarkNamingEN}{Remark}
|
||||
\newcommand{\proofNamingEN}{Proof}
|
||||
\newcommand{\intuitionNamingEN}{Intuition}
|
||||
\newcommand{\termNamingEN}{Term}
|
||||
\newcommand{\notationNamingEN}{Notation}
|
||||
\newcommand{\taskNamingEN}{Task}
|
||||
\newcommand{\usageNamingEN}{Usage}
|
||||
\newcommand{\recallNamingEN}{Recall}
|
||||
\newcommand{\propertiesNamingEN}{Properties}
|
||||
|
||||
\newcommand{\definitionNamingDE}{Definition}
|
||||
\newcommand{\theoremNamingDE}{Theorem}
|
||||
\newcommand{\lemmaNamingDE}{Lemma}
|
||||
\newcommand{\corollaryNamingDE}{Korollar}
|
||||
\newcommand{\axiomNamingDE}{Axiom}
|
||||
\newcommand{\factNamingDE}{Fakt}
|
||||
\newcommand{\propositionNamingDE}{Satz}
|
||||
\newcommand{\exampleNamingDE}{Beispiel}
|
||||
\newcommand{\formulaNamingDE}{Formel}
|
||||
\newcommand{\remarkNamingDE}{Bemerkung}
|
||||
\newcommand{\proofNamingDE}{Beweis}
|
||||
\newcommand{\intuitionNamingDE}{Intuition}
|
||||
\newcommand{\termNamingDE}{Begriff}
|
||||
\newcommand{\notationNamingDE}{Notation}
|
||||
\newcommand{\taskNamingDE}{Aufgabe}
|
||||
\newcommand{\usageNamingDE}{Nutzung}
|
||||
\newcommand{\recallNamingDE}{Repetition}
|
||||
\newcommand{\propertiesNamingDE}{Eigenschaften}
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ Translation │
|
||||
% └ ┘
|
||||
\newcommand{\translate}[2]{%
|
||||
\ifthenelse{\equal{\currentLanguage}{en}}{#1}{#2}
|
||||
}
|
||||
\newcommand{\tr}[2]{\translate{#1}{#2}}
|
||||
|
||||
% Translation aids (commonly used)
|
||||
\newcommand{\trif}{\translate{if }{falls }}
|
||||
\newcommand{\trIf}{\translate{If }{Falls }}
|
||||
\newcommand{\trLet}{\translate{Let }{Sei }}
|
||||
\newcommand{\trLets}{\translate{Let }{Seien }}
|
||||
\newcommand{\trFor}{\translate{For }{Für }}
|
||||
\newcommand{\trfor}{\translate{for }{für }}
|
||||
\newcommand{\trand}{\translate{and }{und }}
|
||||
\newcommand{\tror}{\translate{or }{oder }}
|
||||
\newcommand{\trst}{\translate{s.t. }{s.d. }}
|
||||
\newcommand{\trsuchthat}{\translate{such that }{so dass }}
|
||||
\newcommand{\trwith}{\translate{with }{mit }}
|
||||
|
||||
|
||||
\DeclareOption{de}{
|
||||
\RequirePackage[ngerman]{babel}
|
||||
\renewcommand{\currentLanguage}{de}
|
||||
}
|
||||
\ProcessOptions
|
||||
|
||||
|
||||
% ┌ ┐
|
||||
% │ STYLE: Globals │
|
||||
% └ ┘
|
||||
% Global style configs for tcolorbox (to reduce bloat)
|
||||
% \AtBeginDocument{
|
||||
% \tcbset{
|
||||
% mainboxstyle/.style={
|
||||
% arc=3mm,
|
||||
% colback=red!5!white,
|
||||
% colframe=red!75!black,
|
||||
% colbacktitle=red!75!black,
|
||||
% fonttitle=\bfseries,
|
||||
% enhanced,
|
||||
% attach boxed title to top left={yshift=-2mm,xshift=5mm},
|
||||
% breakable,
|
||||
% top=0.4cm,
|
||||
% }
|
||||
% }
|
||||
% \tikzset{
|
||||
% overlaystyle/.style={
|
||||
% draw=red!75!black,
|
||||
% thick,
|
||||
% fill=red!75!black,
|
||||
% left,
|
||||
% anchor=east,
|
||||
% text=white,
|
||||
% rounded corners=1mm,
|
||||
% font=\bfseries,
|
||||
% xshift=-5mm,
|
||||
% yshift=1mm,
|
||||
% inner xsep=3mm,
|
||||
% inner ysep=1.5mm
|
||||
% }
|
||||
% }
|
||||
% }
|
||||
|
||||
% ── Fonts ───────────────────────────────────────────────────────────
|
||||
\newcommand{\setFont}[1]{\fontfamily{#1}\selectfont}
|
||||
\newcommand{\setFontType}[1]{
|
||||
\ifthenelse{\equal{#1}{mono}}{
|
||||
\renewcommand{\familydefault}{\ttdefault}
|
||||
}{
|
||||
\ifthenelse{\equal{#1}{serif}}{
|
||||
\renewcommand{\familydefault}{\rmdefault}
|
||||
}{
|
||||
\renewcommand{\familydefault}{\sfdefault}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
% ── Small common style elements ─────────────────────────────────────
|
||||
% Spacing (vertical)
|
||||
% TODO: Rework
|
||||
\newcommand{\hrmvspace}{\vspace{-0.25pc}}
|
||||
\newcommand{\rmvspace}{\vspace{-0.5pc}}
|
||||
\newcommand{\mrmvspace}{\vspace{-0.75pc}}
|
||||
\newcommand{\drmvspace}{\vspace{-1pc}}
|
||||
\newcommand{\dhrmvspace}{\vspace{-1.25pc}}
|
||||
\newcommand{\dnrmvspace}{\vspace{-1.5pc}}
|
||||
\newcommand{\dmrmvspace}{\vspace{-1.75pc}}
|
||||
\newcommand{\ddrmvspace}{\vspace{-2pc}}
|
||||
|
||||
% Spacing (horizontal)
|
||||
\newcommand{\smallhspace}{\hspace{2mm}}
|
||||
\newcommand{\mediumhspace}{\hspace{5mm}}
|
||||
\newcommand{\largehspace}{\hspace{1cm}}
|
||||
|
||||
% other elements
|
||||
\renewcommand{\footrulewidth}{0.4pt}
|
||||
\newcommand{\TODO}{\color{red} \hl{TODO:} \color{black}}
|
||||
\newcommand{\bi}[1]{\textbf{\textit{#1}}}
|
||||
\renewcommand{\quote}[1]{``\textit{#1}''}
|
||||
|
||||
% Add a color shade (similar to \fhlc, but nicer boxes)
|
||||
\newcommand{\background}[3]{%
|
||||
\tcbox[on line,
|
||||
boxsep=\backgroundPadding,
|
||||
arc=\backgroundRounding,
|
||||
left=0pt,
|
||||
right=0pt,
|
||||
top=0pt,
|
||||
bottom=0pt,
|
||||
frame empty,
|
||||
colback=#1!#2!white,
|
||||
highlight math style={enhanced}
|
||||
] {\textbf{#3}}%
|
||||
}
|
||||
|
||||
% Abstraction of background, where the brightness is set to 20%
|
||||
\newcommand{\shade}[2]{\background{#1}{\arabic{shadeStrength}}{#2}}
|
||||
|
||||
% This command is used for the short and inline descriptors
|
||||
\newcommand{\bg}[2]{\background{#1}{\arabic{descriptorShadeStrength}}{#2}}
|
||||
|
||||
% Print a table of contents as a tcolorbox
|
||||
\newcommand{\printtoc}[1]{
|
||||
\renewcommand{\cfttoctitlefont}{}
|
||||
\renewcommand{\cftaftertoctitle}{\vspace{-0.75cm}}
|
||||
\renewcommand{\contentsname}{}
|
||||
\begin{tcolorbox}[
|
||||
colback=black!5!white,
|
||||
colbacktitle=#1!75!black,
|
||||
coltitle=black,
|
||||
enhanced,
|
||||
attach boxed title to top center={yshift=-2mm},
|
||||
title={\Large \tr{Contents}{Inhaltsverzeichnis}},
|
||||
fonttitle=\bfseries,
|
||||
breakable
|
||||
]
|
||||
\hspace{1cm}
|
||||
\tableofcontents
|
||||
\end{tcolorbox}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user