stb-math.sty 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. \NeedsTeXFormat{LaTeX2e}
  2. \ProvidesPackage{stb-math}[2019/03/16]
  3. % --- Upright/normal d (for derivatives and integrals) ---
  4. \newcommand*{\@dd}{\symnormal{d}}
  5. \newcommand*{\pd}{\symnormal{\partial}}
  6. \DeclareOption{normald}{
  7. \renewcommand*{\@dd}{\symnormal{d}}
  8. \renewcommand*{\pd}{\symnormal{\partial}}
  9. }
  10. \DeclareOption{uprightd}{
  11. \renewcommand*{\@dd}{\symup{d}}
  12. \renewcommand*{\pd}{\symup{\partial}}
  13. }
  14. % --- Re/Im or fraktur R and I (real part and imaginary part functions) ---
  15. \newif\if@plainpart
  16. \@plainparttrue
  17. \DeclareOption{normalReIm}{\@plainparttrue}
  18. \DeclareOption{frakturReIm}{\@plainpartfalse}
  19. % --- Pass options to stb-brackets ---
  20. \DeclareOption{setbar}{
  21. \PassOptionsToPackage{\CurrentOption}{stb-brackets}
  22. }
  23. \DeclareOption{setcolon}{
  24. \PassOptionsToPackage{\CurrentOption}{stb-brackets}
  25. }
  26. \DeclareOption{evalbar}{
  27. \PassOptionsToPackage{\CurrentOption}{stb-brackets}
  28. }
  29. \DeclareOption{evalbrackets}{
  30. \PassOptionsToPackage{\CurrentOption}{stb-brackets}
  31. }
  32. \ProcessOptions\relax
  33. \RequirePackage{stb-brackets} % Loaded after options are passed
  34. \RequirePackage{etoolbox}
  35. \RequirePackage[math-style=ISO, bold-style=ISO]{unicode-math} % Allow typing unicode characters in math mode
  36. \allowdisplaybreaks
  37. % --- Macro for display math immediately following \item ---
  38. \newif\if@nomathskip
  39. \@nomathskipfalse
  40. \newcommand*{\nomathskip}{\@nomathskiptrue}
  41. \newcommand*{\add@noskiphooks}[1]{
  42. \BeforeBeginEnvironment{#1}{
  43. \if@nomathskip
  44. \setlength{\abovedisplayskip}{0em}
  45. \leavevmode
  46. \vspace*{-\baselineskip}
  47. \fi
  48. }
  49. \AfterEndEnvironment{#1}{\@nomathskipfalse}
  50. }
  51. \add@noskiphooks{align}
  52. \add@noskiphooks{align*}
  53. \add@noskiphooks{alignat}
  54. \add@noskiphooks{alignat*}
  55. \add@noskiphooks{equation}
  56. \add@noskiphooks{equation*}
  57. \add@noskiphooks{gather}
  58. \add@noskiphooks{gather*}
  59. \add@noskiphooks{multline}
  60. \add@noskiphooks{multline*}
  61. % --- Intervals ---
  62. \DeclarePairedDelimiterX{\openint}[2]{\lparen}{\rparen}{#1, #2}
  63. \DeclarePairedDelimiterX{\closedint}[2]{\lbrack}{\rbrack}{#1, #2}
  64. \DeclarePairedDelimiterX{\openclosedint}[2]{\lparen}{\rbrack}{#1, #2}
  65. \DeclarePairedDelimiterX{\closedopenint}[2]{\lbrack}{\rparen}{#1, #2}
  66. % --- Group presentations ---
  67. \DeclarePairedDelimiterX{\gppres}[2]{\langle}{\rangle}{#1 \delimsize\mid \mathopen{} #2}
  68. % --- Operators ---
  69. \DeclareMathOperator{\Arg}{Arg}
  70. \DeclareMathOperator{\Aut}{Aut}
  71. \DeclareMathOperator{\cis}{cis}
  72. \DeclareMathOperator{\chr}{char} % \char is a Plain TeX command
  73. \DeclareMathOperator{\Ext}{Ext}
  74. \DeclareMathOperator{\Gal}{Gal}
  75. \DeclareMathOperator{\GL}{GL}
  76. \DeclareMathOperator{\Hom}{Hom}
  77. \DeclareMathOperator{\id}{id}
  78. \DeclareMathOperator{\im}{im}
  79. \DeclareMathOperator{\lcm}{lcm}
  80. \DeclareMathOperator{\Log}{Log}
  81. \DeclareMathOperator{\PGL}{PGL}
  82. \DeclareMathOperator{\PSL}{PSL}
  83. \DeclareMathOperator{\Res}{Res}
  84. \DeclareMathOperator{\res}{res}
  85. \DeclareMathOperator{\sgn}{sgn}
  86. \DeclareMathOperator{\SL}{SL}
  87. \DeclareMathOperator{\Sym}{Sym}
  88. \DeclareMathOperator{\Tor}{Tor}
  89. \DeclareMathOperator{\tr}{tr}
  90. \DeclareMathOperator{\Tr}{Tr}
  91. \DeclareMathOperator{\wt}{wt}
  92. \if@plainpart
  93. \AtBeginDocument{
  94. \undef\Im
  95. \undef\Re
  96. \DeclareMathOperator{\Im}{Im}
  97. \DeclareMathOperator{\Re}{Re}
  98. }
  99. \fi
  100. % --- Multichoose ---
  101. % Adapted from code by Paul Goborit: https://tex.stackexchange.com/a/5825
  102. \newcommand{\multibinom}[2]{\left( \kern-0.20em \left( \genfrac{}{}{0pt}{}{#1}{#2} \right) \kern-0.20em \right)}
  103. % --- Other binom-like notation ---
  104. \newcommand*{\bracketsbinom}[2]{\genfrac{\lbrack}{\rbrack}{0pt}{}{#1}{#2}}
  105. \newcommand*{\bracessbinom}[2]{\genfrac{\lbrack}{\rbrack}{0pt}{}{#1}{#2}}
  106. % --- Symbols ---
  107. % Number theory symbols
  108. \newcommand*{\divides}{\mid}
  109. \newcommand*{\ndivides}{\nmid}
  110. \newcommand*{\nequiv}{\not\equiv}
  111. % Normal subgroups
  112. \newcommand*{\normalsub}{\vartriangleleft}
  113. \newcommand*{\normalsubeq}{\trianglelefteq}
  114. \newcommand*{\normalsup}{\vartriangleright}
  115. \newcommand*{\normalsupeq}{\trianglerighteq}
  116. % Arrows for injections, surjections, and bijections
  117. \newcommand*{\injto}{\hookrightarrow}
  118. \newcommand*{\injgets}{\hookleftarrow}
  119. \newcommand*{\surjto}{\twoheadrightarrow}
  120. \newcommand*{\surjgets}{\twoheadleftarrow}
  121. \newcommand*{\bijto}{\similarrightarrow}
  122. \newcommand*{\bijgets}{\similarleftarrow}
  123. % --- Space for use after quantifiers ---
  124. \newcommand*{\st}{\ }
  125. % --- Derivatives ---
  126. \NewDocumentCommand{\dd}{s}{\IfBooleanT{#1}{\mathop{}}\@dd}
  127. \newcommand*{\deriv}[3][]{\frac{\dd^{#1} #2}{{\dd #3}^{#1}}}
  128. \newcommand*{\pderiv}[3][]{\frac{\pd^{#1} #2}{{\pd #3}^{#1}}}
  129. % --- Miscellaneous shortcuts ---
  130. \newcommand*{\cycgp}[1]{\ZZ / #1 \ZZ}
  131. \newcommand*{\mat}[1]{\begin{bmatrix} #1 \end{bmatrix}}
  132. \newcommand*{\ol}[1]{\overline{#1}}
  133. \newcommand*{\pfimplies}[2]{(\(#1 \implies #2\))}
  134. \newcommand*{\pfimpliedby}[2]{(\(#1 \impliedby #2\))}
  135. \newcommand*{\pfsubset}[2]{(\(#1 \subseteq #2\))}
  136. \newcommand*{\pfsupset}[2]{(\(#1 \supseteq #2\))}
  137. % --- Blackboard bold letters ---
  138. \newcommand*{\bbA}{\symbb{A}}
  139. \newcommand*{\bbB}{\symbb{B}}
  140. \newcommand*{\bbC}{\symbb{C}}
  141. \newcommand*{\bbD}{\symbb{D}}
  142. \newcommand*{\bbE}{\symbb{E}}
  143. \newcommand*{\bbF}{\symbb{F}}
  144. \newcommand*{\bbG}{\symbb{G}}
  145. \newcommand*{\bbH}{\symbb{H}}
  146. \newcommand*{\bbI}{\symbb{I}}
  147. \newcommand*{\bbJ}{\symbb{J}}
  148. \newcommand*{\bbK}{\symbb{K}}
  149. \newcommand*{\bbL}{\symbb{L}}
  150. \newcommand*{\bbM}{\symbb{M}}
  151. \newcommand*{\bbN}{\symbb{N}}
  152. \newcommand*{\bbO}{\symbb{O}}
  153. \newcommand*{\bbP}{\symbb{P}}
  154. \newcommand*{\bbQ}{\symbb{Q}}
  155. \newcommand*{\bbR}{\symbb{R}}
  156. \newcommand*{\bbS}{\symbb{S}}
  157. \newcommand*{\bbT}{\symbb{T}}
  158. \newcommand*{\bbU}{\symbb{U}}
  159. \newcommand*{\bbV}{\symbb{V}}
  160. \newcommand*{\bbW}{\symbb{W}}
  161. \newcommand*{\bbX}{\symbb{X}}
  162. \newcommand*{\bbY}{\symbb{Y}}
  163. \newcommand*{\bbZ}{\symbb{Z}}
  164. % --- Calligraphic letters ---
  165. \newcommand*{\calA}{\symcal{A}}
  166. \newcommand*{\calB}{\symcal{B}}
  167. \newcommand*{\calC}{\symcal{C}}
  168. \newcommand*{\calD}{\symcal{D}}
  169. \newcommand*{\calE}{\symcal{E}}
  170. \newcommand*{\calF}{\symcal{F}}
  171. \newcommand*{\calG}{\symcal{G}}
  172. \newcommand*{\calH}{\symcal{H}}
  173. \newcommand*{\calI}{\symcal{I}}
  174. \newcommand*{\calJ}{\symcal{J}}
  175. \newcommand*{\calK}{\symcal{K}}
  176. \newcommand*{\calL}{\symcal{L}}
  177. \newcommand*{\calM}{\symcal{M}}
  178. \newcommand*{\calN}{\symcal{N}}
  179. \newcommand*{\calO}{\symcal{O}}
  180. \newcommand*{\calP}{\symcal{P}}
  181. \newcommand*{\calQ}{\symcal{Q}}
  182. \newcommand*{\calR}{\symcal{R}}
  183. \newcommand*{\calS}{\symcal{S}}
  184. \newcommand*{\calT}{\symcal{T}}
  185. \newcommand*{\calU}{\symcal{U}}
  186. \newcommand*{\calV}{\symcal{V}}
  187. \newcommand*{\calW}{\symcal{W}}
  188. \newcommand*{\calX}{\symcal{X}}
  189. \newcommand*{\calY}{\symcal{Y}}
  190. \newcommand*{\calZ}{\symcal{Z}}
  191. % --- Script letters ---
  192. \newcommand*{\scrA}{\symscr{A}}
  193. \newcommand*{\scrB}{\symscr{B}}
  194. \newcommand*{\scrC}{\symscr{C}}
  195. \newcommand*{\scrD}{\symscr{D}}
  196. \newcommand*{\scrE}{\symscr{E}}
  197. \newcommand*{\scrF}{\symscr{F}}
  198. \newcommand*{\scrG}{\symscr{G}}
  199. \newcommand*{\scrH}{\symscr{H}}
  200. \newcommand*{\scrI}{\symscr{I}}
  201. \newcommand*{\scrJ}{\symscr{J}}
  202. \newcommand*{\scrK}{\symscr{K}}
  203. \newcommand*{\scrL}{\symscr{L}}
  204. \newcommand*{\scrM}{\symscr{M}}
  205. \newcommand*{\scrN}{\symscr{N}}
  206. \newcommand*{\scrO}{\symscr{O}}
  207. \newcommand*{\scrP}{\symscr{P}}
  208. \newcommand*{\scrQ}{\symscr{Q}}
  209. \newcommand*{\scrR}{\symscr{R}}
  210. \newcommand*{\scrS}{\symscr{S}}
  211. \newcommand*{\scrT}{\symscr{T}}
  212. \newcommand*{\scrU}{\symscr{U}}
  213. \newcommand*{\scrV}{\symscr{V}}
  214. \newcommand*{\scrW}{\symscr{W}}
  215. \newcommand*{\scrX}{\symscr{X}}
  216. \newcommand*{\scrY}{\symscr{Y}}
  217. \newcommand*{\scrZ}{\symscr{Z}}
  218. \endinput