refactor vocab command into own package - remove from script class

This commit is contained in:
Maximilian Keßler 2021-09-06 22:22:52 +02:00
parent b6b9916a2b
commit 8fdc480722
4 changed files with 24 additions and 203 deletions

View file

@ -1,112 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fancythm}[2021/03/31 - Theorem-Environment Package by Maximilian Kessler (private use)]
\newif\ifenglish\englishtrue
\DeclareOption{english}{\englishtrue}
\DeclareOption{german}{\englishfalse}
\DeclareOption*{\PackageWarning{fancythm}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
%Theorem-environments
\RequirePackage{amsthm}
\RequirePackage{mdframed}
\RequirePackage[skins]{tcolorbox}
\mdfsetup{skipabove=\topskip,skipbelow=\topskip}
%%%Define styles
\newtheoremstyle{own}%〈name〉
{3pt}%〈Space above〉1
{3pt}%〈Space below〉1
{}%〈Body font〉
{}%〈Indent amount〉2
{\bfseries}%〈Theorem head font〉
{.}%〈Punctuation after theorem head〉
{.5em}%〈Space after theorem head〉3
{}%〈Theorem head spec(can be left empty, meaning normal)〉
\theoremstyle{own}
%%%Define styles for mdframed
\global\mdfdefinestyle{thm}{linecolor=red,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, backgroundcolor=red!8, rightline=false, topline=false, bottomline=false}
\global\mdfdefinestyle{lemma}{linecolor=orange,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, backgroundcolor=orange!10, rightline=false, topline=false, bottomline=false}
\global\mdfdefinestyle{definition}{linecolor=blue,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, backgroundcolor=blue!7, rightline=false, topline=false, bottomline=false}
\global\mdfdefinestyle{example}{linecolor=green!70!black,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, rightline=false, topline=false, bottomline=false}
\global\mdfdefinestyle{remark}{linecolor=yellow!80!orange,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, rightline=false, topline=false, bottomline=false}
\global\mdfdefinestyle{notation}{linecolor=violet,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, backgroundcolor=violet!7, rightline=false, topline=false, bottomline=false}
\global\mdfdefinestyle{theoremdef}{linecolor=red,linewidth=2pt,leftmargin=0cm,rightmargin=0cm, backgroundcolor=blue!7, rightline=false, topline=false, bottomline=false}
%Theorem
\newtheorem{protothm}{\ifenglish Theorem\else Satz\fi}[section]
\newenvironment{theorem}{\begin{mdframed}[style=thm] \begin{protothm}}{\end{protothm}\end{mdframed}}
%Unnumbered Theorem
\newtheorem*{protothm*}{\ifenglish Theorem\else Satz\fi}
\newenvironment{theorem*}{\begin{mdframed}[style=thm] \begin{protothm*}}{\end{protothm*}\end{mdframed}}
%Proposition
\newtheorem{protoprop}[protothm]{Proposition}
\newenvironment{proposition}{\begin{mdframed}[style=thm] \begin{protoprop}}{\end{protoprop}\end{mdframed}}
%Unnumbered Proposition
\newtheorem{protoprop*}[protothm]{Proposition}
\newenvironment{proposition*}{\begin{mdframed}[style=thm] \begin{protoprop*}}{\end{protoprop*}\end{mdframed}}
%Corollary
\newtheorem{protocor}[protothm]{\ifenglish Corollary\else Korollar\fi}
\newenvironment{corollary}{\begin{mdframed}[style=thm] \begin{protocor}}{\end{protocor}\end{mdframed}}
%Unnumbered Corollary
\newtheorem{protocor*}[protothm]{\ifenglish Corollary\else Korollar\fi}
\newenvironment{corollary*}{\begin{mdframed}[style=thm] \begin{protocor*}}{\end{protocor*}\end{mdframed}}
%Lemma
\newtheorem{protolemma}[protothm]{Lemma}
\newenvironment{lemma}{\begin{mdframed}[style=lemma] \begin{protolemma}}{\end{protolemma}\end{mdframed}}
%Unnumbered Lemma
\newtheorem*{protlemma*}{Lemma}
\newenvironment{lemma*}{\begin{mdframed}[style=lemma] \begin{protolemma*}}{\end{protolemma*}\end{mdframed}}
%Definition
\newtheorem{protodefinition}[protothm]{Definition}
\newenvironment{definition}{\begin{mdframed}[style=definition] \begin{protodefinition}}{\end{protodefinition}\end{mdframed}}
%unnumbered Definition
\newtheorem*{protodefinition*}{Definition}
\newenvironment{definition*}{\begin{mdframed}[style=definition] \begin{protodefinition*}}{\end{protodefinition*}\end{mdframed}}
%Theorem + Definition
\newtheorem{prototheoremdef}[protothm]{\ifenglish Theorem and Definition\else Satz und Definition\fi}
\newenvironment{theoremdef}{\begin{mdframed}[style=theoremdef] \begin{prototheoremdef}}{\end{prototheoremdef}\end{mdframed}}
%Notation
\newtheorem*{protonotation}{Notation}
\newenvironment{notation}{\begin{mdframed}[style=notation] \begin{protonotation}}{\end{protonotation}\end{mdframed}}
%Example
\newtheorem*{protoexample}{\ifenglish Example\else Beispiel\fi}
\newenvironment{example}{\begin{mdframed}[style=example] \begin{protoexample}}{\end{protoexample}\end{mdframed}}
%Remark
\newtheorem*{protoremark}{\ifenglish Remark\else Bemerkung\fi}
\newenvironment{remark}{\begin{mdframed}[style=remark] \begin{protoremark}}{\end{protoremark}\end{mdframed}}
\newtcolorbox{recap}{before skip = 0.5cm, after skip = 0.5cm, enhanced, sharp corners = all, colback = white, colframe = gray, toprule=0pt, bottomrule=0pt, leftrule=0pt,rightrule=0pt, overlay = {
\draw[gray, line width = 2pt] (frame.north west) -- ++(0.5cm, 0pt);
\draw[gray, line width=2pt] (frame.south east) -- ++(-0.5cm, 0pt);
\draw[gray, line width=2pt] (frame.north west) -- ++ (0pt, -0.5cm);
\draw[gray, line width=2pt] (frame.south east) -- ++(0pt, 0.5cm);
}}
\newtheorem*{reminder}{\ifenglish Reminder\else Erinnerung\fi}

View file

@ -85,20 +85,6 @@
%%%Document-specific features that are provided
%%%%Management of vocabulary and corresponding index
\RequirePackage{imakeidx}
\makeindex[columns=2, title=\ifenglish Index\else Stichwortverzeichnis\fi, intoc]
%Emphasize \vocabulary
\RequirePackage{xparse}
\RequirePackage{expl3}
\ExplSyntaxOn
\NewDocumentCommand{\vocab}{O{} m}{
\textbf{\color{blue} #2}
\ifthenelse{\isempty{#1}}{\index{\text_titlecase_first:n{#2}}}{\index{#1}}
}
\ExplSyntaxOff
%%%%Bibliography management
\RequirePackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{bibliography.bib}

24
mkessler-vocab.sty Normal file
View file

@ -0,0 +1,24 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-vocab}[2021-09-06 - Package for emphasizing vocabulary]
%%%%%%%%%%%%%%%%%%
%%Provides a \vocab<[name in index]>{vocabulary} command to print vocabulary in bold blue and automatically index it.
\newif\ifenglish\englishtrue
\DeclareOption{german}{\englishfalse}
\DeclareOption{english}{\englishtrue}
\DeclareOption*{\PackageWarning{mkessler-vocab}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
%%%%Management of vocabulary and corresponding index
\RequirePackage{imakeidx}
\makeindex[columns=2, title=\ifenglish Index\else Stichwortverzeichnis\fi, intoc]
%Emphasize \vocabulary
\RequirePackage{xparse}
\RequirePackage{expl3}
\ExplSyntaxOn
\NewDocumentCommand{\vocab}{O{} m}{
\textbf{\color{blue} #2}
\ifthenelse{\isempty{#1}}{\index{\text_titlecase_first:n{#2}}}{\index{#1}}
}
\ExplSyntaxOff

View file

@ -1,77 +0,0 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sheet}[2021/03/31 Exercise-Sheet-Class by Maximilian Kessler (private use)]
\RequirePackage{scrbase}
\newif\iflargename\largenamefalse
\DeclareOption{large-name}{\largenametrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
\ProcessOptions\relax
\LoadClass{scrartcl}
\KOMAoption{fontsize}{12pt}
\KOMAoption{parskip}{half-}
\KOMAoption{DIV}{12}
\KOMAoption{headings}{normal}
\RequirePackage{mymath}
\RequirePackage{scrlayer-scrpage}
\RequirePackage{subfig}
\RequirePackage[shortlabels]{enumitem}
%\RequirePackage[hidelinks]{hyperref}
\RequirePackage{graphicx}
\RequirePackage{ifplatform}
\graphicspath{{./out/graphics/}}
\KOMAoption{headsepline}{:}
\AtBeginDocument{\maketitle}
\def\@course{}%
\DeclareRobustCommand*{\course}[1]{\gdef\@course{#1}}
\def\@sheetnumber{}%
\DeclareRobustCommand*{\sheetnumber}[1]{\gdef\@sheetnumber{\ifenglish Sheet #1 \else Übungsblatt #1\fi}}
\renewcommand*{\@date}{\today}
\renewcommand*{\maketitle}{
\thispagestyle{plain}
{\makebox[0pt][l]{\usekomafont{myauthor}\@author}\hfill\makebox[0pt][r]{\usekomafont{date}\@date}\par}
\vspace{0.5em}
{\centering\usekomafont{title}\@course\par}
{\centering\usekomafont{subtitle}\@sheetnumber \par}
\vspace{2em}
\hrule
\addvspace{2em}
}
\setkomafont{title}{\LARGE\bfseries}
\setkomafont{subtitle}{}
\newkomafont{myauthor}{}
\setkomafont{date}{}
\newkomafont{headtitle}{\itshape}
\setkomafont{pageheadfoot}{\footnotesize}
\setkomafont{descriptionlabel}{\bfseries}
\setkomafont{pagenumber}{\normalsize}
\pagestyle{scrheadings}
\ihead[]{\iflargename \usekomafont{myauthor}\@author \\ \@course\;- \@sheetnumber\else \usekomafont{myauthor}\@author\fi }
\chead[]{\iflargename \else \usekomafont{subtitle}\@course\;- \@sheetnumber\fi}
\ohead[]{\usekomafont{date}\@date}
\allowdisplaybreaks[1]
% Page layout
\setlength{\parindent}{0pt}
\RequirePackage{geometry}
\geometry{a4paper, left=2cm, right=2cm, top=3cm-15pt, bottom=3cm-15pt, head=15.0pt, headsep=10pt}
\setlength{\skip\footins}{15pt}
\setlength{\abovecaptionskip}{0cm}
\setlength{\belowcaptionskip}{0cm}
%Für Zeilenabstand 1,5
\RequirePackage[onehalfspacing]{setspace}