Files
pixeldrain-bypass-downloader/paper/paper.sty
2025-08-25 16:32:23 +02:00

352 lines
8.1 KiB
TeX

\ProvidesPackage{paper}[2023/12/29]
%% Försättsbladsgrejer, setup
% Ställa in datum, om argumentet är 1 så visas klockslag med
\RequirePackage{datetime}
\renewcommand{\dateseparator}{-}
\newcommand{\setdate}[1]{
\newcommand{\temparg}{#1}
\ifnum\temparg=1
\date{\today\ (\currenttime)}
\else
\date{\today}
\fi
}
% Ställa in titel, om andra argumentet är tomt, skippa undertitel
\newcommand{\settitle}[2]{
\title{
\Huge #1 % titel
\if\relax\detokenize{#2}\relax
\else
\vspace{5mm} \\
\large #2 % undertitel
\fi
}
}
% Ställa in referensfil, om argumentet är 1 så laddas referensfilen referenser.bib
\newcommand{\setreferences}[2]{
\newcommand{\temparga}{#1}
\ifnum\temparga=1
\addbibresource{#2}
\fi
}
\newcommand{\printreferences}[2] {
\newcommand{\tempargas}{#1}
\ifnum\tempargas=1
\printbibliography[title=#2]
\fi
}
%% indentering
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
%% table of content-djup
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
%% kommentera sektioner, begin -- end
\RequirePackage{comment}
%% provides emulation of pdfTeX primitives for LuaTeX v0.85 needed by attachfile idk lmao
\RequirePackage{luatex85}
%% Inbäddade filer
\RequirePackage{attachfile}
\attachfilesetup{color=0 0 0.9}
%% Indexering från noll
\makeatletter
\def\@arabic#1{\number\numexpr#1-1\relax}
\renewcommand*{\theatfi@tmp}{\the\value{atfi@tmp}} % Workaround för att attachfile ska fungera trots omdefinieringen av arabic
\makeatother
%% Förfinar typografin, bland annat med marginalkerning.
\RequirePackage{microtype}
\RequirePackage{fontspec}
\setmainfont[Ligatures=TeX]{CMU Serif} % inkluderar kyriliska
\RequirePackage{polyglossia}
\setdefaultlanguage{swedish}
\setotherlanguages{greek,russian}
\newcommand{\E}[1]{\emph{#1}}
\newcommand{\B}[1]{\textbf{#1}}
\newcommand{\I}[1]{\textit{#1}}
\newcommand{\T}[1]{\texttt{#1}}
%% Ordnar så det går att nesta enumerations
\RequirePackage[inline]{enumitem}
%% Definiera färgnamn
\RequirePackage[hyperref, table, dvipsnames, svgnames, x11names]{xcolor}
%% Gör att mellanslag i bildfilnamn fungerar.
\RequirePackage[space]{grffile}
%% Matematik
\RequirePackage[intlimits]{mathtools}
\RequirePackage{amssymb}
%\RequirePackage{amsfonts} % <- inte så snygg
\RequirePackage{mathrsfs}
% \RequirePackage{unicode-math} % inaktiverad för den ger fula symboler
%% Satser, Definitioner, Exemplares och Anmärkningar
\RequirePackage{amsthm}
\RequirePackage{thmtools}
%% Exemplares
% Stil för exempel
\declaretheoremstyle[
headfont=\bfseries,
headpunct={\newline},
numbered=no,
bodyfont=\normalfont,
spaceabove=1em plus 0.75em minus 0.25em,
spacebelow=1em plus 0.75em minus 0.25em,
qed={\maltese},
]{examplestyle}
% Svenskt exempel
\declaretheorem[
style=examplestyle,
title=Exempel,
refname={exempel,exemplares},
Refname={Exempel,Exemplares}
]{exempel}
% Engelskt exempel
\declaretheorem[
style=examplestyle,
title=Example,
refname={example,examples},
Refname={Example,Examples}
]{example}
% Svenskt mot-exempel
\declaretheorem[
style=examplestyle,
title=Mot-exempel,
refname={mot-exempel,mot-exemplares},
Refname={Mot-exempel,Mot-exemplares}
]{mot-exempel}
% Engelskt mot-exempel
\declaretheorem[
style=examplestyle,
title=Counter-example,
refname={counter-example,counter-examples},
Refname={Counter-example,Counter-examples}
]{counter-example}
%% Anmärkelser
% Stil för anmärkelse
\declaretheoremstyle[
headfont=\itshape,
headpunct={.},
numbered=no,
bodyfont=\normalfont,
spaceabove=1em plus 0.75em minus 0.25em,
spacebelow=1em plus 0.75em minus 0.25em,
qed={},
]{remarkstyle}
% Svensk anmärkelse
\declaretheorem[
style=remarkstyle,
title=Anmärkelse,
refname={anmärkelse,anmärkelser},
Refname={Anmärkelse,Anmärkelser}
]{anmarkelse}
% Engelsk anmärkelse
\declaretheorem[
style=remarkstyle,
title=Remark,
refname={remark,remarks},
Refname={Remark,Remarks}
]{remark}
%% Definition, sats och bevis
% Stil för Definition och Sats
\declaretheoremstyle[
headfont=\bfseries,
headpunct={\newline},
numbered=yes,
bodyfont=\itshape,
spaceabove=1em plus 0.75em minus 0.25em,
spacebelow=1em plus 0.75em minus 0.25em,
qed={\maltese},
]{definitionstyle}
% Svensk definition
\declaretheorem[
style=definitionstyle,
title=Definition,
refname={definition,definitioner},
Refname={Definition,Definitioner}
]{definition}
% Engelsk definition är samma som svensk typ
\declaretheorem[
style=definitionstyle,
title=Definition,
refname={definition,definitions},
Refname={Definition,Definitions}
]{en-definition}
% Svenskt axiom
\declaretheorem[
style=definitionstyle,
title=Axiom,
refname={axiom,axiomata},
Refname={Axiom,Axiomata}
]{axiom}
% Svenskt postulat
\declaretheorem[
style=definitionstyle,
title=Postulat,
refname={postulat,postulat},
Refname={Postulat,Postulat}
]{postulat}
% Engelskt postulat
\declaretheorem[
style=definitionstyle,
title=Postulate,
refname={postulate,postulates},
Refname={Postulate,Postulates}
]{postulate}
% Svensk sats
\declaretheorem[
style=definitionstyle,
title=Sats,
refname={sats,satser},
Refname={Sats,Satser}
]{sats}
% Engelsk sats
\declaretheorem[
style=definitionstyle,
title=Theorem,
refname={theorem,theorems},
Refname={Theorem,Theorems}
]{theorem}
% Svenskt bevis
\declaretheorem[
style=examplestyle,
title=Bevis,
refname={bevis,bevis},
Refname={Bevis,Bevis}
]{bevis}
% Engelskt bevis
\declaretheorem[
style=examplestyle,
title=Proof,
refname={proof,proofs},
Refname={Proof,Proofs}
]{prooff}
%% Matematiska genvägar
% Mängder och Vektorrum
\newcommand{\Binary}{\mathbb{B}}
\newcommand{\Binaries}{\mathbb{B}}
\newcommand{\Natural}{\mathbb{N}}
\newcommand{\Naturals}{\mathbb{N}}
\newcommand{\Integer}{\mathbb{Z}}
\newcommand{\Integers}{\mathbb{Z}}
\newcommand{\Rational}{\mathbb{Q}}
\newcommand{\Rationals}{\mathbb{Q}}
\newcommand{\Real}{\mathbb{R}}
\newcommand{\Reals}{\mathbb{R}}
\newcommand{\Complex}{\mathbb{C}}
\newcommand{\Compleces}{\mathbb{C}}
\newcommand{\Hilbert}{\mathcal{H}}
\newcommand{\Galois}{\text{GF}}
% Analytisk mekanik
\newcommand{\Hamilton}{\mathscr{H}}
\newcommand{\hamiltonian}{\mathcal{H}}
\newcommand{\Lagrange}{\mathscr{L}}
\newcommand{\lagrangian}{\mathcal{L}}
% parenteser
\newcommand{\paren}[1]{\left(#1\right)}
\newcommand{\hakar}[1]{\left[#1\right]}
\newcommand{\krull}[1]{\left\{#1\right\}}
% diffgeometri
\newcommand{\tom}{\;\;}
\newcommand{\fbk}[3]{\Gamma^{#1}_{\tom #2#3}}
\newcommand{\riem}[4]{B^{#1}_{\tom #2#3#4}}
%% Gör hänvisningar inom dokumentet till länkar. Generera disposition.
\RequirePackage{hyperref}
%% Enheter
\RequirePackage{siunitx}
\sisetup{
output-decimal-marker = {,},
per-mode = symbol-or-fraction,
inter-unit-product = \ensuremath{\cdot},
exponent-product = \ensuremath{\cdot}
}
%% ta bort linje efter epigraf
\setlength{\epigraphrule}{0pt}
\setlength{\epigraphwidth}{0.8\textwidth}
%% citatgenvägar
\newcommand{\frq}[1]{ % franskt citat
\guillemotleft #1\guillemotright
}
%% referenser
\RequirePackage[
backend=biber,
style=alphabetic, % numeric om man inte vill ha
sorting=none % none sorterar i ordningen de citerades
]{biblatex}
%% ändrar fotnötter
\RequirePackage[perpage]{footmisc}
\makeatletter
\newcommand*{\myfnsymbolsingle}[1]{%
\ensuremath{%
\ifcase#1% 0
\or % 1
\dagger%
\or % 2
\sharp
\or % 3
\flat
\or % 4
\star
\or % 5
\ddagger
\or % 6
\wp
\or % 7
\top
\or % 8
\bot
\else % >= 9
\@ctrerr
\fi
}%
}
\makeatother
\newcommand*{\myfnsymbol}[1]{%
\myfnsymbolsingle{\value{#1}}%
}
% remove upper boundary by multiplying the symbols if needed
\RequirePackage{alphalph}
\newalphalph{\myfnsymbolmult}[mult]{\myfnsymbolsingle}{}
% använder tabellen ovan
\renewcommand*{\thefootnote}{%
\myfnsymbolmult{\value{footnote}}%
}
%% Lyrik
% tar en dikt som input
\newcommand{\dikt}[1]{
\begin{center}
\begin{minipage}{1\linewidth}
\emph{
#1
}
\end{minipage}
\end{center}
}
% skriver ut en strof
\newcommand{\strof}[1]{
\begin{verse}
#1
\end{verse}
}
\endinput % måste stå i avslutning av paket