選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

252 行
6.9KB

  1. \ProvidesClass{lecture}
  2. \LoadClass[a4paper, titlepage]{article}
  3. \RequirePackage[utf8]{inputenc}
  4. \RequirePackage[T1]{fontenc}
  5. \RequirePackage{textcomp}
  6. \RequirePackage[german]{babel}
  7. \RequirePackage{amsmath, amssymb, amsthm}
  8. \RequirePackage{mdframed}
  9. \RequirePackage{fancyhdr}
  10. \RequirePackage{geometry}
  11. \RequirePackage{import}
  12. \RequirePackage{pdfpages}
  13. \RequirePackage{transparent}
  14. \RequirePackage{xcolor}
  15. \RequirePackage{array}
  16. \RequirePackage[shortlabels]{enumitem}
  17. \RequirePackage{tikz}
  18. \RequirePackage{pgfplots}
  19. \RequirePackage[nobottomtitles]{titlesec}
  20. \RequirePackage{listings}
  21. \RequirePackage{mathtools}
  22. \RequirePackage{forloop}
  23. \RequirePackage{totcount}
  24. \RequirePackage{calc}
  25. \RequirePackage{wasysym}
  26. \RequirePackage{environ}
  27. \RequirePackage{bbm}
  28. \RequirePackage{mathrsfs}
  29. \usetikzlibrary{quotes, angles}
  30. \pgfplotsset{
  31. compat=1.15,
  32. default 2d plot/.style={%
  33. grid=both,
  34. minor tick num=4,
  35. grid style={line width=.1pt, draw=gray!10},
  36. major grid style={line width=.2pt,draw=gray!50},
  37. axis lines=middle,
  38. enlargelimits={abs=0.2}
  39. },
  40. }
  41. \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
  42. \DeclareOption{uebung}{
  43. \makeatletter
  44. \lhead{\@title}
  45. \rhead{\@author}
  46. \makeatother
  47. }
  48. \ProcessOptions\relax
  49. % PAGE GEOMETRY
  50. \geometry{
  51. left=15mm,
  52. right=40mm,
  53. top=20mm,
  54. bottom=20mm
  55. }
  56. % PARAGRAPH no indent but skip
  57. \setlength{\parskip}{3mm}
  58. \setlength{\parindent}{0mm}
  59. \theoremstyle{definition}
  60. \newmdtheoremenv{satz}{Satz}[section]
  61. \newmdtheoremenv{lemma}[satz]{Lemma}
  62. \newmdtheoremenv{korrolar}[satz]{Korrolar}
  63. \newmdtheoremenv{definition}[satz]{Definition}
  64. \newtheorem{bsp}[satz]{Beispiel}
  65. \newtheorem{bem}[satz]{Bemerkung}
  66. \newtheorem{aufgabe}{Aufgabe}
  67. % enable aufgaben counting
  68. \regtotcounter{aufgabe}
  69. % temporary calculation counter
  70. \newcounter{var}
  71. \newcommand{\N}{\mathbb{N}}
  72. \newcommand{\R}{\mathbb{R}}
  73. \newcommand{\Z}{\mathbb{Z}}
  74. \newcommand{\Q}{\mathbb{Q}}
  75. \newcommand{\C}{\mathbb{C}}
  76. % HEADERS
  77. \pagestyle{fancy}
  78. \newcommand{\incfig}[1]{%
  79. \def\svgwidth{\columnwidth}
  80. \import{./figures/}{#1.pdf_tex}
  81. }
  82. \pdfsuppresswarningpagegroup=1
  83. % horizontal rule
  84. \newcommand\hr{
  85. \noindent\rule[0.5ex]{\linewidth}{0.5pt}
  86. }
  87. % punkte tabelle
  88. \newcommand{\punkte}[1][1]{
  89. \newcounter{k}
  90. \setcounter{k}{#1}
  91. \@punkten{\value{k}}{\totvalue{aufgabe}}
  92. \setcounter{k}{#1-1}
  93. \setcounter{aufgabe}{\value{k}}
  94. \vspace{5mm}
  95. }
  96. \def\@punkten#1#2{
  97. \newcounter{n}
  98. % create a temporary calculation counter
  99. \setcounter{var}{#2-#1+1}
  100. \begin{tabular}{|c|*{\value{var}}{m{1cm}|}m{1cm}|@{}m{0cm}@{}}
  101. \hline
  102. Aufgabe
  103. \forloop{n}{#1}{\not{\value{n} > #2}}{
  104. & \centering A\then
  105. }
  106. & \centering $\sum$ & \\[5mm] \hline
  107. Punkte
  108. \forloop{n}{#1}{\not{\value{n} > #2}}{
  109. &
  110. }
  111. & & \\[5mm] \hline
  112. \end{tabular}
  113. }
  114. % code listings, define style
  115. \lstdefinestyle{mystyle}{
  116. commentstyle=\color{gray},
  117. keywordstyle=\color{blue},
  118. numberstyle=\tiny\color{gray},
  119. stringstyle=\color{black},
  120. basicstyle=\ttfamily\footnotesize,
  121. breakatwhitespace=false,
  122. breaklines=true,
  123. captionpos=b,
  124. keepspaces=true,
  125. numbers=left,
  126. numbersep=5pt,
  127. showspaces=false,
  128. showstringspaces=false,
  129. showtabs=false,
  130. tabsize=2
  131. }
  132. % activate my colour style
  133. \lstset{style=mystyle}
  134. % better stackrel
  135. \let\oldstackrel\stackrel
  136. \renewcommand{\stackrel}[2]{%
  137. \oldstackrel{\mathclap{#1}}{#2}
  138. }%
  139. % integral d sign
  140. \makeatletter \renewcommand\d[2][]{\ensuremath{%
  141. \,\mathrm{d}^{#1}#2\@ifnextchar^{}{\@ifnextchar\d{}{\,}}}}
  142. \makeatother
  143. % contradiction
  144. \newcommand{\contr}{\text{\Large\lightning}}
  145. % disjoint unions: provides cupdot and bigcupdot
  146. \makeatletter
  147. \def\moverlay{\mathpalette\mov@rlay}
  148. \def\mov@rlay#1#2{\leavevmode\vtop{%
  149. \baselineskip\z@skip \lineskiplimit-\maxdimen
  150. \ialign{\hfil$\m@th#1##$\hfil\cr#2\crcr}}}
  151. \newcommand{\charfusion}[3][\mathord]{
  152. #1{\ifx#1\mathop\vphantom{#2}\fi
  153. \mathpalette\mov@rlay{#2\cr#3}
  154. }
  155. \ifx#1\mathop\expandafter\displaylimits\fi}
  156. \makeatother
  157. \newcommand{\cupdot}{\charfusion[\mathbin]{\cup}{\cdot}}
  158. \newcommand{\bigcupdot}{\charfusion[\mathop]{\bigcup}{\cdot}}
  159. \ExplSyntaxOn
  160. % S-tackrelcompatible ALIGN environment
  161. % some might also call it the S-uper ALIGN environment
  162. % uses regular expressions to calculate the widest stackrel
  163. % to put additional padding on both sides of relation symbols
  164. \NewEnviron{salign}
  165. {
  166. \begin{align}
  167. \lec_insert_padding:V \BODY
  168. \end{align}
  169. }
  170. % starred version that does no equation numbering
  171. \NewEnviron{salign*}
  172. {
  173. \begin{align*}
  174. \lec_insert_padding:V \BODY
  175. \end{align*}
  176. }
  177. % some helper variables
  178. \tl_new:N \l__lec_text_tl
  179. \seq_new:N \l_lec_stackrels_seq
  180. \int_new:N \l_stackrel_count_int
  181. \int_new:N \l_idx_int
  182. \box_new:N \l_tmp_box
  183. \dim_new:N \l_tmp_dim_a
  184. \dim_new:N \l_tmp_dim_b
  185. \dim_new:N \l_tmp_dim_needed
  186. % function to insert padding according to widest stackrel
  187. \cs_new_protected:Nn \lec_insert_padding:n
  188. {
  189. \tl_set:Nn \l__lec_text_tl { #1 }
  190. % get all stackrels in this align environment
  191. \regex_extract_all:nnN { \c{stackrel}{(.*?)}{(.*?)} } { #1 } \l_lec_stackrels_seq
  192. % get number of stackrels
  193. \int_set:Nn \l_stackrel_count_int { \seq_count:N \l_lec_stackrels_seq }
  194. \int_set:Nn \l_idx_int { 1 }
  195. \dim_set:Nn \l_tmp_dim_needed { 0pt }
  196. % iterate over stackrels
  197. \int_while_do:nn { \l_idx_int <= \l_stackrel_count_int }
  198. {
  199. % calculate width of text
  200. \hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 1 }$}
  201. \dim_set:Nn \l_tmp_dim_a {\box_wd:N \l_tmp_box}
  202. % calculate width of relation symbol
  203. \hbox_set:Nn \l_tmp_box {$\seq_item:Nn \l_lec_stackrels_seq { \l_idx_int + 2 }$}
  204. \dim_set:Nn \l_tmp_dim_b {\box_wd:N \l_tmp_box}
  205. % check if 0.5*(a-b) > minimum padding, if yes updated minimum padding
  206. \dim_compare:nNnTF
  207. { 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } > { \l_tmp_dim_needed }
  208. { \dim_set:Nn \l_tmp_dim_needed { 1pt * \dim_ratio:nn { \l_tmp_dim_a - \l_tmp_dim_b } { 2pt } } }
  209. { }
  210. \quad
  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. }
  216. % replace all relations with align characters (&) and add the needed padding
  217. \regex_replace_all:nnN
  218. { (\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}&) }
  219. { \c{kern} \u{l_tmp_dim_needed} \1 \c{kern} \u{l_tmp_dim_needed} }
  220. \l__lec_text_tl
  221. \l__lec_text_tl
  222. }
  223. \cs_generate_variant:Nn \lec_insert_padding:n { V }
  224. \ExplSyntaxOff