Aktuelles PDF gibt's auch hier: https://flavigny.de/lecture/pdf/analysis2 zum bequemeren Lesen.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

266 行
7.6KB

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