Skip to content
Snippets Groups Projects
stdmath.sty 7.99 KiB
Newer Older
  • Learn to ignore specific revisions
  • % vim: set spelllang=de,en:
    % ----------------------------------------------
    % this package should provide a standard set of packages
    % and commands that are usually useful when writing
    % mathematical texts
    
    % options
    % -------
    % \renewcommand{\bibfile}{<your bibliography file>}
    % standard is bibliography.bib
    
    % tikz
    % also loads tikz
    
    % graphicx OR pictures
    % also loads package graphicx (for picture handling)
    
    % pdflatex
    % defines everything necessary to use neo2 possibilities with pdflatex
    
    % german
    % makes the names of environments german
    % otherwise they are in english
    
    % scriptLetters
    % loads the package mathrsfs that enables you to write curly letters as Sigma-Algebras
    % this is done via the command \scr
    % ----------------------------------------------
    
    \NeedsTeXFormat{LaTeX2e}
    \ProvidesPackage{stdmath}[2017/10/17 stdmath package]
    
    % optional:
    \newif\ifopt@german
    \opt@germanfalse % Standard
    \DeclareOption{german}{\opt@germantrue}
    
    \newif\ifopt@pics
    \opt@picsfalse
    \DeclareOption{graphicx}{\opt@picstrue}
    \DeclareOption{pictures}{\opt@picstrue}
    
    \newif\ifopt@tikz
    \opt@tikzfalse
    \DeclareOption{tikz}{\opt@tikztrue}
    
    \newif\ifopt@script
    \opt@scriptfalse
    \DeclareOption{scriptLetters}{\opt@scripttrue}
    
    \ProcessOptions\relax
    
    \ifopt@pics\RequirePackage{graphicx}\fi
    \ifopt@tikz\RequirePackage{tikz}\RequirePackage{tikz-cd}\fi
    \ifopt@script\RequirePackage{mathrsfs}\newcommand{\scr}[1]{\mathscr{#1}}\fi % for script A (sigma-Algebra-A)
    
    % ---------
    % Packages
    % ---------
    
    % ---------------------------------------------------
    %  this is a UTF8-symbol to LaTeX-formula-converting
    % ---------------------------------------------------
    \RequirePackage{.maindir/tex/header/specialChars}
    
    % maybe that works one day:
    % \RequirePackage{polyglossia}
    % \ifopt@german{\setdefaultlanguage{german}}\else{\setdefaultlanguage{english}}\fi
    \RequirePackage[\ifopt@german ngerman \else english \fi]{babel}
    \RequirePackage{amsmath, amsfonts} 
    
    Felix Hilsky's avatar
    Felix Hilsky committed
    \RequirePackage{aligned-overset}  % for nicely aligned text over relation symbols
    % with \overset{\text{Definition}}&{=} instead of &\stackrel{\text{Definition}}=
    
    \RequirePackage{mathtools}    % for := (defined as)
    \RequirePackage{amsthm}                   % for theorems environments
    \RequirePackage{enumerate}                  % for different kind of numbering in enumerations
    
    % bibliography
    
    \newcommand{\bibfile}{.maindir/tex/bibliography.bib}
    
    \RequirePackage{csquotes}
    \RequirePackage[backend=biber,
      style=alphabetic,
      backref=true,
      autocite=inline,
      sortlocale=de_DE.UTF-8,
      % sortlocale=en_GB,
      sorting=nty]{biblatex}
    \addbibresource{\bibfile}
    \AtEndDocument{\printbibliography}
    
    
    Felix Hilsky's avatar
    Felix Hilsky committed
    % to allow links to break over lines at hyphens
    % must be loaded before hyperref because hyperref loads package url
    \PassOptionsToPackage{hyphens}{url}
    
    %   colorlinks=true,
    %   linkcolor=black,
    %   citecolor=black,
    %   filecolor=black,
    %   %pagecolor=black,
    %   urlcolor=black,
    %   bookmarks=true,
    %   bookmarksopen=true,
    %   bookmarksopenlevel=3,
    %   plainpages=false,
    
    %   pdfpagelabels=true
       pdfencoding=auto
      ]{hyperref}
    
    %\parindent0.0em % = Einrueckungsweite des ersten Satzes eines Absatzes
    
    % ---------------------------------------------------------------
    % Custom commands, rougly grouped
    % ---------------------------------------------------------------
    
    % ----------------
    %  math operators
    % ----------------
    \DeclareMathOperator{\id}{id}               % identity map
    \DeclareMathOperator{\Id}{I}                % identity operator/ matrix
    \DeclareMathOperator{\Lin}{Lin}             % Linear span
    \DeclareMathOperator{\supp}{supp}           % support
    \DeclareMathOperator{\GL}{GL}               % general linear group
    %TODO: bin ir unsicher, ob das nicht kursiv geschriebn werden soll
    \DeclareMathOperator{\dom}{D}               % domain
    \DeclareMathOperator{\grad}{grad}           % gradient
    \DeclareMathOperator{\Rang}{Rang}             % Rang einer Matrix
    \DeclareMathOperator{\sign}{sign}           % signum (einer Permutation)
    % \newcommand{\card}[1]{\abs{#1}}             % cardinality
    \DeclareMathOperator{\gr}{gr}               % graph of a function f:A ⟶ B as a subset of A × B
    
    % -----------
    %  constants
    % -----------
    % Zahlmengen
    \newcommand{\Z}{\mathbb{Z}}             % integers
    \newcommand{\N}{\mathbb{N}}             % natural numbers
    \newcommand{\Q}{\mathbb{Q}}             % rationals
    \newcommand{\R}{\mathbb{R}}             % reals
    
    % \newcommand{\C}{\mathbb{C}}             % complex numbers  % does not work, is already defined
    
    \newcommand{\K}{\mathbb{K}}             % a field
    
    \newcommand{\im}{\ensuremath{\mathrm{i}}}       % imaginary number sqrt(-1)
    
    \newcommand{\chFct}{χ}                  % characteristic function of a set
    \newcommand{\kro}{\delta}                 % Kronecker-Symbol
    
    % ---------
    %  Symbols
    % ---------
    
    \newcommand{\definedas}{\coloneqq}    % left of this is defined to be the thing on the right
    \newcommand{\define}{\eqqcolon}       % same other way around
    
    % ---------------------
    %  analysis & topology
    % ---------------------
    
    \newcommand{\abs}[1]{\left\lvert#1\right\rvert}     % absolute value
    \newcommand{\norm}[1]{\left\lVert#1\right\rVert}    % norm
    \newcommand{\normiii}[1]{{\left\vert\kern-0.25ex\left\vert\kern-0.25ex\left\vert #1 
        \right\vert\kern-0.25ex\right\vert\kern-0.25ex\right\vert}}
        % from http://tex.stackexchange.com/questions/54385/spacing-between-triple-vertical-lines       % norm with 3 lines
    
    \newcommand{\rest}[2]{\left. #1 \right\vert_{#2}}   % restriction of a map #1 to the domain #2
    \newcommand{\scaProd}[1]{\left\langle #1 \right\rangle} % scalar product
    \newcommand{\conj}[1]{#1^{*}}             % (complex) conjugation
    
    \newcommand{\D}{\ensuremath{d}}             % d in \D x \D z ... at integrals
    % \newcommand{\D}{\ensuremath{\mathrm{d}}} %
    
    \newcommand{\cl}[1]{\overline{#1}}            % closure
    
    % ------------
    %  set theory
    % ------------
    
    \newcommand{\setDef}[2]{\left\{#1 
    \,\middle\vert\, #2\right\}}            % a typical set definition: #1 is the thing in the set #2 the condition on the variables {#1 | #2}
    \newcommand{\Union}{\bigcup}              % Summation-like set union
    \newcommand{\Disunion}{\bigsqcup}           % Summation-like disjoint set union
    \newcommand{\Isect}{\bigcap}              % Summation-like set intersection
    \newcommand{\Dsum}{\bigoplus}             % Summation-like direct sum
    
    % ---------
    %  algebra
    % ---------
    
    \newcommand{\Tens}{\bigotimes}              % Summation-like tensor product
    \newcommand{\normal}{\vartriangleleft}          % normal subgroup
    
    % ----------------
    %  Typografisches
    % ----------------
    
    \newcommand{\TODO}[1]{\marginpar{TODO (#1)}}      % TODOs
    \newcommand{\imp}[1]{\emph{#1}}             % important
    \newcommand{\newTerm}[1]{\emph{#1}}         % newly introduced
    % alternative: do nothing or \ul (underline)
    
    % ----------------------------------------------------
    % (Theorem) environments
    % ----------------------------------------------------
    
    \newtheorem {theorem} {\ifopt@german Satz \else Theorem \fi} [section]
    % \newtheorem {theorem} {Satz} [section]
    
    % das "`[theorem] "` bewirkt, dass es eine durchgehende
    % Nummerierung dieser environments gibt und nicht jede
    % Art seine eigene Nummerierung hat
    
    % Für Lemmas dieses environment:
    \newtheorem {lemma} [theorem] {Lemma}
    % Für Folgerungen/ Korollare dieses environment 
    \newtheorem {corollary} [theorem] {\ifopt@german Korollar \else Corollary \fi}
    
    % Definitionen sehen dann anders aus, siehe 
    % http://tex.stackexchange.com/questions/38260/non-italic-text-in-theorems-definitions-examples
    \theoremstyle {definition}
    % Für Definitionen dieses environment
    \newtheorem {definition} [theorem] {Definition}
    
    % Für Bemerkungen dieses environment
    \theoremstyle {remark}
    \newtheorem* {note} {\ifopt@german Bemerkung \else Remark \fi}
    
    % Beispiele kriegen eine andere Formatierung %ohne Nummerierung falls mit *:
    \newtheorem{example} [theorem] {\ifopt@german Beispiel \else Example \fi}
    
    
    Felix Hilsky's avatar
    Felix Hilsky committed
    % environment without any meaning
    % just text that can be folded in editor
    % the optional argument is ignored and can be used to give a summery of the folded content
    \newenvironment{textfold}[1][]{}{}