Selaa lähdekoodia

intial commit

master
flavis 5 vuotta sitten
commit
c730c10852
2 muutettua tiedostoa jossa 274 lisäystä ja 0 poistoa
  1. +9
    -0
      .gitignore
  2. +265
    -0
      lecture.cls

+ 9
- 0
.gitignore Näytä tiedosto

@@ -0,0 +1,9 @@
*.aux
*.log
*.fdb_latexmk
*.toc
*.synctex.*
*.fls
*.out
*.pdf
!analysisII.pdf

+ 265
- 0
lecture.cls Näytä tiedosto

@@ -0,0 +1,265 @@
\ProvidesClass{lecture}
\LoadClass[a4paper]{book}

\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{textcomp}
\RequirePackage[ngerman]{babel}
\RequirePackage{amsmath, amssymb, amsthm}
\RequirePackage{mdframed}
\RequirePackage{geometry}
\RequirePackage{import}
\RequirePackage{pdfpages}
\RequirePackage{transparent}
\RequirePackage{xcolor}
\RequirePackage{array}
\RequirePackage[shortlabels]{enumitem}
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\RequirePackage[pagestyles, nobottomtitles]{titlesec}
\RequirePackage{listings}
\RequirePackage{mathtools}
\RequirePackage{forloop}
\RequirePackage{totcount}
\RequirePackage[hidelinks, unicode]{hyperref} %[unicode, hidelinks]{hyperref}
\RequirePackage{bookmark}
\RequirePackage{wasysym}
\RequirePackage{environ}
\RequirePackage{stackrel}
\RequirePackage{subcaption}

\usetikzlibrary{quotes, angles, math}
\pgfplotsset{
compat=1.15,
default 2d plot/.style={%
grid=both,
minor tick num=4,
grid style={line width=.1pt, draw=gray!10},
major grid style={line width=.2pt,draw=gray!50},
axis lines=middle,
enlargelimits={abs=0.2}
},
}

\geometry{
bottom=35mm
}

%\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\DeclareOption{uebung}{
\makeatletter
\lhead{\@title}
\rhead{\@author}
\makeatother
}
\ProcessOptions\relax

% PARAGRAPH no indent but skip
\setlength{\parskip}{3mm}
\setlength{\parindent}{0mm}

\theoremstyle{definition}
\newmdtheoremenv{satz}{Satz}[chapter]
\newmdtheoremenv{lemma}[satz]{Lemma}
\newmdtheoremenv{korollar}[satz]{Korollar}
\newmdtheoremenv{definition}[satz]{Definition}

\newtheorem{bsp}[satz]{Beispiel}
\newtheorem{bem}[satz]{Bemerkung}
\newtheorem{aufgabe}{Aufgabe}

% enable aufgaben counting
\regtotcounter{aufgabe}

\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\renewcommand{\C}{\mathbb{C}}

% HEADERS

%\newpagestyle{main}[\small]{
% \setheadrule{.55pt}%
% \sethead[\thepage]% even-left
% []% even-center
% [\thechapter~\chaptertitle]% even-right
% {\thesection~\sectiontitle}% odd-left
% {}% odd-center
% {\thepage}% odd-right
%}
%\pagestyle{main}

\newcommand{\incfig}[1]{%
\def\svgwidth{\columnwidth}
\import{./figures/}{#1.pdf_tex}
}
\pdfsuppresswarningpagegroup=1

% horizontal rule
\newcommand\hr{
\noindent\rule[0.5ex]{\linewidth}{0.5pt}
}

% punkte tabelle
\newcommand{\punkte}{
\@punkten{\totvalue{aufgabe}}
}

\def\@punkten#1{
\newcounter{n}
\begin{tabular}{|c|*{#1}{m{1cm}|}m{1cm}|@{}m{0cm}@{}}
\hline
Aufgabe
\forloop{n}{1}{\not{\value{n} > #1}}{
& \centering A\then
}
& \centering $\sum$ & \\[5mm] \hline
Punkte
\forloop{n}{1}{\not{\value{n} > #1}}{
&
}
& & \\[5mm] \hline
\end{tabular}
}

% code listings, define style
\lstdefinestyle{mystyle}{
commentstyle=\color{gray},
keywordstyle=\color{blue},
numberstyle=\tiny\color{gray},
stringstyle=\color{black},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}

% activate my colour style
\lstset{style=mystyle}

% better stackrel
\let\oldstackrel\stackrel
\renewcommand{\stackrel}[3][]{%
\oldstackrel[\mathclap{#1}]{\mathclap{#2}}{#3}
}%

% integral d sign
\makeatletter \renewcommand\d[2][]{\ensuremath{%
\,\mathrm{d}^{#1}#2\@ifnextchar^{}{\@ifnextchar\d{}{\,}}}}
\makeatother

% remove page before chapters
\let\cleardoublepage=\clearpage

%josua
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}

% contradiction
\newcommand{\contr}{\text{\Large\lightning}}

% people seem to prefer varepsilon over epsilon
\renewcommand{\epsilon}{\varepsilon}

\ExplSyntaxOn

% S-tackrelcompatible ALIGN environment
% some might also call it the S-uper ALIGN environment
% uses regular expressions to calculate the widest stackrel
% to put additional padding on both sides of relation symbols
\NewEnviron{salign}
{
\begin{align}
\lec_insert_padding:V \BODY
\end{align}
}
% starred version that does no equation numbering
\NewEnviron{salign*}
{
\begin{align*}
\lec_insert_padding:V \BODY
\end{align*}
}

% some helper variables
\tl_new:N \l__lec_text_tl
\seq_new:N \l_lec_stackrels_seq
\int_new:N \l_stackrel_count_int
\int_new:N \l_idx_int
\box_new:N \l_tmp_box
\dim_new:N \l_tmp_dim_a
\dim_new:N \l_tmp_dim_b
\dim_new:N \l_tmp_dim_c
\dim_new:N \l_tmp_dim_needed

% function to insert padding according to widest stackrel
\cs_new_protected:Nn \lec_insert_padding:n
{
\tl_set:Nn \l__lec_text_tl { #1 }
% get all stackrels in this align environment
\regex_extract_all:nnN { \c{stackrel}(\[.*?\])?{(.*?)}{(.*?)} } { #1 } \l_lec_stackrels_seq
% get number of stackrels
\int_set:Nn \l_stackrel_count_int { \seq_count:N \l_lec_stackrels_seq }
\int_set:Nn \l_idx_int { 1 }
\dim_set:Nn \l_tmp_dim_needed { 0pt }
% iterate over stackrels
\int_while_do:nn { \l_idx_int <= \l_stackrel_count_int }
{
% calculate width of text
\hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 1 }$}
\dim_set:Nn \l_tmp_dim_a {\box_wd:N \l_tmp_box}
\hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 2 }$}
\dim_set:Nn \l_tmp_dim_c {\box_wd:N \l_tmp_box}
\dim_set:Nn \l_tmp_dim_a {\dim_max:nn{ \l_tmp_dim_c} {\l_tmp_dim_a}}
% calculate width of relation symbol
\hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 3 }$}
\dim_set:Nn \l_tmp_dim_b {\box_wd:N \l_tmp_box}
% check if 0.5*(a-b) > minimum padding, if yes updated minimum padding
\dim_compare:nNnTF
{ 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } > { \l_tmp_dim_needed }
{ \dim_set:Nn \l_tmp_dim_needed { 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } }
{ }
% increment list index by three, as every stackrel produces three list entries
\int_incr:N \l_idx_int
\int_incr:N \l_idx_int
\int_incr:N \l_idx_int
\int_incr:N \l_idx_int
}
% replace all relations with align characters (&) and add the needed padding
\regex_replace_all:nnN
{ (\c{leq}&|&\c{leq}|\c{geq}&|&\c{geq}|\c{iff}&|&\c{iff}|\c{impliedby}&|&\c{impliedby}|\c{implies}&|&\c{implies}|\c{approx}&|&\c{approx}|\c{equiv}&|&\c{equiv}|=&|&=|\c{le}&|&\c{le}|\c{ge}&|&\c{ge}|&\c{stackrel}(\[.*?\])?{.*?}{.*?}|\c{stackrel}(\[.*?\])?{.*?}{.*?}&|&\c{neq}|\c{neq}&|>&|&>|<&|&<) }
{ \c{kern} \u{l_tmp_dim_needed} \1 \c{kern} \u{l_tmp_dim_needed} }
\l__lec_text_tl
\l__lec_text_tl
}
\cs_generate_variant:Nn \lec_insert_padding:n { V }

\NewEnviron{leftright}
{
\lec_replace_parens:V \BODY
}

% function to replace parens with left right
\cs_new_protected:Nn \lec_replace_parens:n
{
\tl_set:Nn \l__lec_text_tl { #1 }
% replace all parantheses with \left( \right)
\regex_replace_all:nnN { \( } { \c{left}( } \l__lec_text_tl
\regex_replace_all:nnN { \) } { \c{right}) } \l__lec_text_tl
\regex_replace_all:nnN { \[ } { \c{left}[ } \l__lec_text_tl
\regex_replace_all:nnN { \] } { \c{right}] } \l__lec_text_tl
\l__lec_text_tl
}
\cs_generate_variant:Nn \lec_replace_parens:n { V }

\ExplSyntaxOff

% add one equation tag to the current line to otherwise unnumbered environment
\newcommand{\tageq}{\stepcounter{equation}\tag{\theequation}}

Loading…
Peruuta
Tallenna