Skip to content

Instantly share code, notes, and snippets.

@ksm2
Created November 15, 2013 11:31
Show Gist options
  • Save ksm2/7482970 to your computer and use it in GitHub Desktop.
Save ksm2/7482970 to your computer and use it in GitHub Desktop.
A small package for math and computer science students doing their homework :)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% MÖLLERS' MATHE PACKAGE FOR LATEX %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{MoellersMathe}
%%----------------------------------------------------------------------------------------
%% Requirements
%%----------------------------------------------------------------------------------------
\RequirePackage{parskip}
\RequirePackage{enumitem}
\RequirePackage{paralist}
\RequirePackage{ulem}
\RequirePackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\RequirePackage{hyperref}
\RequirePackage{pst-all}
\RequirePackage{iwona}
\RequirePackage{pgfplots}
\RequirePackage{tikz}
\RequirePackage{xcolor}
%%----------------------------------------------------------------------------------------
%% Setting Iwona font as default
%%----------------------------------------------------------------------------------------
\renewcommand{\familydefault}{cmr}
\renewcommand{\sfdefault}{iwona}
\setlength{\parskip}{10pt}
\normalem
\newcommand{\changefont}[3]{%
\fontfamily{#1} \fontseries{#2} \fontshape{#3} \selectfont}
%%----------------------------------------------------------------------------------------
%% erf-Function for pgf
%%----------------------------------------------------------------------------------------
\pgfmathdeclarefunction{erf}{1}{%
\begingroup
\pgfmathparse{#1 > 0 ? 1 : -1}%
\edef\sign{\pgfmathresult}%
\pgfmathparse{abs(#1)}%
\edef\x{\pgfmathresult}%
\pgfmathparse{1/(1+0.3275911*\x)}%
\edef\t{\pgfmathresult}%
\pgfmathparse{%
1 - (((((1.061405429*\t -1.453152027)*\t) + 1.421413741)*\t
-0.284496736)*\t + 0.254829592)*\t*exp(-(\x*\x))}%
\edef\y{\pgfmathresult}%
\pgfmathparse{(\sign)*\y}%
\pgfmath@smuggleone\pgfmathresult%
\endgroup
}
%%----------------------------------------------------------------------------------------
%% Exercise-Environment
%%----------------------------------------------------------------------------------------
\newcounter{aufgabe}
\newlist{ex}{enumerate}{4}
\setlist[ex,1]{label=\textbf{\sffamily Aufgabe \arabic{aufgabe}.}}
\setlist[ex,2]{label=(\alph*)}
\setlist[ex,3]{label=\textit{(\roman*)}}
\newenvironment{subex}{\begin{enumerate}[(i)]}{\end{enumerate}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Aufgabe}[1][0]{
\ifnum #1>0
\setcounter{aufgabe}{#1}
\else
\stepcounter{aufgabe}
\fi
\item
\ifnum\value{aufgabe}>0
\phantomsection
\addcontentsline{toc}{section}{Aufgabe \arabic{aufgabe}}
\fi
}
\DeclareMathOperator\e{e}
\DeclareMathOperator\erf{\text{erf}}
\makeatletter
% Author collection
\def\@Authors{}
\def\author#1#2#3{\g@addto@macro{\@Authors}{\sffamily\textsc{#1}, #2, {\fontseries{l}\selectfont #3} \\}}
% Blatt def
\def\@blatt{1}
\def\Blatt#1{\def\@blatt{#1}}
% Professor def
\def\@professor{N.N.}
\def\Professor#1{\def\@professor{#1}}
%%----------------------------------------------------------------------------------------
%% Custom title
%%----------------------------------------------------------------------------------------
\renewcommand{\maketitle}{%
\begin{center}
\begin{pspicture}(0,0)(0,0)
\pscharpath[linestyle=none,%
fillstyle=gradient,%
gradbegin=blue!40!green!60!white,%
gradend=blue!60!green!60!white,%
gradmidpoint=1,%
gradangle=0]%
{\changefont{iwona}{l}{n} \Huge \@title}
\end{pspicture}\\[6pt]
{\sffamily\bfseries \@professor}\par
{\sffamily Wintersemester 2013/14}\\
{\sffamily\bfseries Blatt \@blatt}\par
{\sffamily\bfseries Lösung von:}\\
\@Authors
\end{center}\par
}
\makeatother
%%----------------------------------------------------------------------------------------
%% Distribution-Environment
%%----------------------------------------------------------------------------------------
\newenvironment{distribution}[2]{\begin{tikzpicture}[xscale = 3, yscale = 6]
% GRID
\draw[very thin,color=gray!50!white,xstep=0.25, ystep=0.125] (-2.55,0) grid (2.55,1.15);
% AXES
\draw[->] (-2.6,0) -- node[at end,right] {#1}(2.6,0);
\draw[->] (0,0) -- node[at end, above] {#2} (0,1.2);
\foreach \x in {-2.5,-2,...,2.5} {%
\draw (\x,0.02) -- (\x,-0.02) node[below] {\sffamily \x};}
\foreach \y in {0.25,0.5,...,1} {%
\draw (-0.04,\y) -- (0.04,\y) node[at end, right] {\sffamily \y};}}{\end{tikzpicture}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment