Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
8.0KB

  1. \ProvidesClass{lecture}
  2. \LoadClass[a4paper]{book}
  3. \RequirePackage{faktor}
  4. \RequirePackage{xparse}
  5. \RequirePackage{stmaryrd}
  6. \RequirePackage[utf8]{inputenc}
  7. \RequirePackage[T1]{fontenc}
  8. \RequirePackage{textcomp}
  9. \RequirePackage{babel}
  10. \RequirePackage{amsmath, amssymb, amsthm}
  11. \RequirePackage{mdframed}
  12. \RequirePackage{tikz-cd}
  13. \RequirePackage{geometry}
  14. \RequirePackage{import}
  15. \RequirePackage{pdfpages}
  16. \RequirePackage{transparent}
  17. \RequirePackage{xcolor}
  18. \RequirePackage{array}
  19. \RequirePackage[shortlabels]{enumitem}
  20. \RequirePackage{tikz}
  21. \RequirePackage{pgfplots}
  22. \RequirePackage[pagestyles, nobottomtitles]{titlesec}
  23. \RequirePackage{listings}
  24. \RequirePackage{mathtools}
  25. \RequirePackage{forloop}
  26. \RequirePackage{totcount}
  27. \RequirePackage[hidelinks, unicode]{hyperref} %[unicode, hidelinks]{hyperref}
  28. \RequirePackage{bookmark}
  29. \RequirePackage{wasysym}
  30. \RequirePackage{environ}
  31. \RequirePackage{stackrel}
  32. \RequirePackage{subcaption}
  33. \usetikzlibrary{quotes, angles, math}
  34. \pgfplotsset{
  35. compat=1.15,
  36. axis lines = middle,
  37. ticks = none,
  38. %default 2d plot/.style={%
  39. % ticks=none,
  40. % axis lines = middle,
  41. % grid=both,
  42. % minor tick num=4,
  43. % grid style={line width=.1pt, draw=gray!10},
  44. % major grid style={line width=.2pt,draw=gray!50},
  45. % axis lines=middle,
  46. % enlargelimits={abs=0.2}
  47. }
  48. \newcounter{curve}
  49. \NewDocumentCommand{\algebraiccurve}{ O{} O{$#5 = 0$} O{-4:4} O{-4:4} m }{
  50. \addplot[id=curve\arabic{curve}, raw gnuplot, smooth, #1] function{%
  51. f(x,y) = #5;
  52. set xrange [#3];
  53. set yrange [#4];
  54. set view 0,0;
  55. set isosample 1000,1000;
  56. set size square;
  57. set cont base;
  58. set cntrparam levels incre 0,0.1,0;
  59. unset surface;
  60. splot f(x,y)
  61. };
  62. \addlegendentry{#2}
  63. \stepcounter{curve}
  64. }%
  65. %\newcommand{\algebraiccurve}[3][][hi]{%
  66. % %\addlegendentry{#2}
  67. % \stepcounter{curve}
  68. %}%
  69. \geometry{
  70. bottom=35mm
  71. }
  72. %\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
  73. \DeclareOption{uebung}{
  74. \makeatletter
  75. \lhead{\@title}
  76. \rhead{\@author}
  77. \makeatother
  78. }
  79. \ProcessOptions\relax
  80. % PARAGRAPH no indent but skip
  81. %\setlength{\parskip}{3mm}
  82. %\setlength{\parindent}{0mm}
  83. \newtheorem{satz}{Proposition}[chapter]
  84. \newtheorem{theorem}[satz]{Theorem}
  85. \newtheorem{lemma}[satz]{Lemma}
  86. \newtheorem{korollar}[satz]{Corollary}
  87. \theoremstyle{definition}
  88. \newtheorem{definition}[satz]{Definition}
  89. \newtheorem{bsp}[satz]{Example}
  90. \newtheorem{bem}[satz]{Remark}
  91. \newtheorem{aufgabe}[satz]{Exercise}
  92. \counterwithin{figure}{chapter}
  93. % enable aufgaben counting
  94. %\regtotcounter{aufgabe}
  95. \newcommand{\N}{\mathbb{N}}
  96. \newcommand{\R}{\mathbb{R}}
  97. \newcommand{\Z}{\mathbb{Z}}
  98. \newcommand{\Q}{\mathbb{Q}}
  99. \newcommand{\C}{\mathbb{C}}
  100. % HEADERS
  101. %\newpagestyle{main}[\small]{
  102. % \setheadrule{.55pt}%
  103. % \sethead[\thepage]% even-left
  104. % []% even-center
  105. % [\thechapter~\chaptertitle]% even-right
  106. % {\thesection~\sectiontitle}% odd-left
  107. % {}% odd-center
  108. % {\thepage}% odd-right
  109. %}
  110. %\pagestyle{main}
  111. \newcommand{\incfig}[1]{%
  112. \def\svgwidth{\columnwidth}
  113. \import{./figures/}{#1.pdf_tex}
  114. }
  115. \pdfsuppresswarningpagegroup=1
  116. % horizontal rule
  117. \newcommand\hr{
  118. \noindent\rule[0.5ex]{\linewidth}{0.5pt}
  119. }
  120. % code listings, define style
  121. \lstdefinestyle{mystyle}{
  122. commentstyle=\color{gray},
  123. keywordstyle=\color{blue},
  124. numberstyle=\tiny\color{gray},
  125. stringstyle=\color{black},
  126. basicstyle=\ttfamily\footnotesize,
  127. breakatwhitespace=false,
  128. breaklines=true,
  129. captionpos=b,
  130. keepspaces=true,
  131. numbers=left,
  132. numbersep=5pt,
  133. showspaces=false,
  134. showstringspaces=false,
  135. showtabs=false,
  136. tabsize=2
  137. }
  138. % activate my colour style
  139. \lstset{style=mystyle}
  140. % better stackrel
  141. \let\oldstackrel\stackrel
  142. \renewcommand{\stackrel}[3][]{%
  143. \oldstackrel[\mathclap{#1}]{\mathclap{#2}}{#3}
  144. }%
  145. % integral d sign
  146. \makeatletter \renewcommand\d[2][]{\ensuremath{%
  147. \,\mathrm{d}^{#1}#2\@ifnextchar^{}{\@ifnextchar\d{}{\,}}}}
  148. \makeatother
  149. % remove page before chapters
  150. \let\cleardoublepage=\clearpage
  151. %josua
  152. \newcommand{\norm}[1]{\left\Vert#1\right\Vert}
  153. % contradiction
  154. \newcommand{\contr}{\text{\Large\lightning}}
  155. % people seem to prefer varepsilon over epsilon
  156. \renewcommand{\epsilon}{\varepsilon}
  157. \ExplSyntaxOn
  158. % S-tackrelcompatible ALIGN environment
  159. % some might also call it the S-uper ALIGN environment
  160. % uses regular expressions to calculate the widest stackrel
  161. % to put additional padding on both sides of relation symbols
  162. \NewEnviron{salign}
  163. {
  164. \begin{align}
  165. \lec_insert_padding:V \BODY
  166. \end{align}
  167. }
  168. % starred version that does no equation numbering
  169. \NewEnviron{salign*}
  170. {
  171. \begin{align*}
  172. \lec_insert_padding:V \BODY
  173. \end{align*}
  174. }
  175. % some helper variables
  176. \tl_new:N \l__lec_text_tl
  177. \seq_new:N \l_lec_stackrels_seq
  178. \int_new:N \l_stackrel_count_int
  179. \int_new:N \l_idx_int
  180. \box_new:N \l_tmp_box
  181. \dim_new:N \l_tmp_dim_a
  182. \dim_new:N \l_tmp_dim_b
  183. \dim_new:N \l_tmp_dim_c
  184. \dim_new:N \l_tmp_dim_needed
  185. % function to insert padding according to widest stackrel
  186. \cs_new_protected:Nn \lec_insert_padding:n
  187. {
  188. \tl_set:Nn \l__lec_text_tl { #1 }
  189. % get all stackrels in this align environment
  190. \regex_extract_all:nnN { \c{stackrel}(\[.*?\])?{(.*?)}{(.*?)} } { #1 } \l_lec_stackrels_seq
  191. % get number of stackrels
  192. \int_set:Nn \l_stackrel_count_int { \seq_count:N \l_lec_stackrels_seq }
  193. \int_set:Nn \l_idx_int { 1 }
  194. \dim_set:Nn \l_tmp_dim_needed { 0pt }
  195. % iterate over stackrels
  196. \int_while_do:nn { \l_idx_int <= \l_stackrel_count_int }
  197. {
  198. % calculate width of text
  199. \hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 1 }$}
  200. \dim_set:Nn \l_tmp_dim_a {\box_wd:N \l_tmp_box}
  201. \hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 2 }$}
  202. \dim_set:Nn \l_tmp_dim_c {\box_wd:N \l_tmp_box}
  203. \dim_set:Nn \l_tmp_dim_a {\dim_max:nn{ \l_tmp_dim_c} {\l_tmp_dim_a}}
  204. % calculate width of relation symbol
  205. \hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 3 }$}
  206. \dim_set:Nn \l_tmp_dim_b {\box_wd:N \l_tmp_box}
  207. % check if 0.5*(a-b) > minimum padding, if yes updated minimum padding
  208. \dim_compare:nNnTF
  209. { 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } > { \l_tmp_dim_needed }
  210. { \dim_set:Nn \l_tmp_dim_needed { 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } }
  211. { }
  212. % increment list index by three, as every stackrel produces three list entries
  213. \int_incr:N \l_idx_int
  214. \int_incr:N \l_idx_int
  215. \int_incr:N \l_idx_int
  216. \int_incr:N \l_idx_int
  217. }
  218. % replace all relations with align characters (&) and add the needed padding
  219. \regex_replace_all:nnN
  220. { (\c{simeq}&|&\c{simeq}|\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}&|>&|&>|<&|&<) }
  221. { \c{kern} \u{l_tmp_dim_needed} \1 \c{kern} \u{l_tmp_dim_needed} }
  222. \l__lec_text_tl
  223. \l__lec_text_tl
  224. }
  225. \cs_generate_variant:Nn \lec_insert_padding:n { V }
  226. \NewEnviron{leftright}
  227. {
  228. \lec_replace_parens:V \BODY
  229. }
  230. % function to replace parens with left right
  231. \cs_new_protected:Nn \lec_replace_parens:n
  232. {
  233. \tl_set:Nn \l__lec_text_tl { #1 }
  234. % replace all parantheses with \left( \right)
  235. \regex_replace_all:nnN { \( } { \c{left}( } \l__lec_text_tl
  236. \regex_replace_all:nnN { \) } { \c{right}) } \l__lec_text_tl
  237. \regex_replace_all:nnN { \[ } { \c{left}[ } \l__lec_text_tl
  238. \regex_replace_all:nnN { \] } { \c{right}] } \l__lec_text_tl
  239. \l__lec_text_tl
  240. }
  241. \cs_generate_variant:Nn \lec_replace_parens:n { V }
  242. \ExplSyntaxOff
  243. % add one equation tag to the current line to otherwise unnumbered environment
  244. \newcommand{\tageq}{\stepcounter{equation}\tag{\theequation}}