Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

276 lignes
8.0KB

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