Debian Codegraph @

texmf-dist/doc/fonts/alchemist/manual.sty

raw
1 %% ============================================================================
2 % !Mode:: "TeX:UK:UTF-8"
3 % !TEX program = XeLaTeX
4 % -----------------------------------------------------------------------------
5
6 % Private XeLaTeX style for scientific texts
7 % copyright 2019 by Dr Engelbert Buxbaum <[email protected]>
8 % This file may be shared under Gnu copyleft or the LaTeX the Project Public License.
9
10 \ProvidesPackage{manual}[2019/09/18 v1.01 standard packages for scientific texts]
11 \NeedsTeXFormat{LaTeX2e}
12
13 \RequirePackage{kpfonts-otf}
14 \usepackage{polyglossia}%foreign language support
15
16 \RequirePackage{acronym}%keep track of acronyms
17 %\RequirePackage{amssymb}%math symbols, not required with kpfonts-otf
18 \RequirePackage[backend=biber,bibencoding=UTF8,sorting=none,dateera=christian,style=numeric-comp]{biblatex}%bibliography
19 \RequirePackage{biochemistry-colors}%defines standard-conform colours for biochem entities
20 \RequirePackage{booktabs}%proper rules in tables
21 \RequirePackage{chemarrow}%arrows in chemical reactions
22 \RequirePackage{colortbl}%coloured background for tables
23 \RequirePackage{csquotes}%context-sensitive quotes, required for biblatex
24 \RequirePackage{css-colors}% defines web-safe colours
25 \RequirePackage{doi}%give DOIs as hyperlinks in bibliography
26 \RequirePackage{floatrow}%control float placement
27 \RequirePackage{fontspec}% font selecting commands
28 \RequirePackage{graphicx}%inclusion of images
29 \RequirePackage{hypcap} % anchors of captions
30 \RequirePackage[british]{isodate}%use international format for date and time
31 \RequirePackage{isotope}%correct typesetting of isotopes
32 \RequirePackage{letltxmacro}% change LaTeX commands with optional arguments
33 \RequirePackage{listings}%typeset computer code
34 \RequirePackage{lscape}%typeset wide material in lanscape mode
35 \RequirePackage{makeidx}%index generation
36 \RequirePackage{marvosym}%various symbols
37 \RequirePackage{mathbbol}%blackboard bold symbols (double line left)
38 \RequirePackage{mathtools}%extension of amsmath
39 \RequirePackage{media9}%include video or sound, currently doesn't work because flash-based
40 \RequirePackage{microtype}%micro-typesetting
41 \RequirePackage{multicol}%switching between one- and multicolumn
42 \RequirePackage{placeins}%allows FloatBarriers to be set
43 \RequirePackage{rotating}%rotate objects} sidewaystables/figures
44 \RequirePackage{siunitx}%correct typesetting of units
45 \RequirePackage[labelformat=empty,labelsep=none]{subfig}% several entries in one float
46 \RequirePackage{supertabular}%tables over several pages
47 \RequirePackage[breakable,skins,listings]{tcolorbox}%put text into coloured boxes
48 \RequirePackage[euler]{textgreek}%upright greek characters
49 \RequirePackage{ulem}%underlining and striking out
50 \RequirePackage{url}%typeset internet links (preloaded in beamer)
51 \RequirePackage{wasysym}
52 \RequirePackage{xcolor}%handle colours
53
54 %\RequirePackage{pdfcomment}% use pdf annotations
55
56 \RequirePackage{hyperref}%hyperrefs in PDF, must be last package called, preloaded in beamer
57 \hypersetup{final=true,
58 pdfauthor={Dr. Engelbert Buxbaum},
59 colorlinks=true,
60 citecolor=Blue,%bibliography, dark blue
61 linkcolor=Blue,%internal links, dark blue
62 urlcolor=DodgerBlue,%internet, middle blue
63 allbordercolors=White}
64
65 \newcommand{\EURO}{{\footnotesize{\EUR}}} % because \EUR is way too big
66
67 \DeclareSIUnit\angstrom{\text{Å}}
68 \sisetup{% set-up for siunitx and XeTeX
69 print-unity-mantissa = false,
70 separate-uncertainty,
71 negative-color = red
72 }
73
74 % special chars in listings environment under XeTeX
75 \lstset{literate=%
76 {Ö}{{\"O}}1
77 {Ä}{{\"A}}1
78 {Ü}{{\"U}}1
79 {ß}{{\ss}}1
80 {ü}{{\"u}}1
81 {ä}{{\"a}}1
82 {ö}{{\"o}}1
83 {~}{{\textasciitilde}}1
84 }
85
86 \let\wasymale\male % start to undo overwriting of wasy by kpfonts_otf
87 \let\wasyfemale\female % complete after \begin{document}
88 % after \begin{document} add:
89 %\let\male\wasymale
90 %\let\female\wasyfemale
91
92 \setmainlanguage{en-GB}
93 \setotherlanguage{arabic}
94 \setotherlanguage{russian}
95 \setotherlanguage{greek}
96
97 \newfontfamily\arabicfont[Script=Arabic]{FreeSerif}
98 \newfontfamily\russianfont{FreeSerif}
99 \newfontfamily\greekfont{FreeSerif}
100
101
102 \newcommand{\Name}[1]{\textsc{#1}} % proper names
103 \newcommand{\Foreign}[1]{\textit{#1}} % words from foreign languages
104 \newcommand{\Species}[1]{\textit{#1}} % biological species
105
106 % Fonts for math-entities
107 \newcommand{\skalar}[1]{\ensuremath{#1}}
108 \newcommand{\Vector}[1]{\ensuremath{\vec{\mathfrak{#1}}}}
109 \newcommand{\AbsVec}[1]{\ensuremath{\mathfrak{#1}}}
110 \newcommand{\arr}[1]{\ensuremath{\mathcal{#1}}}
111 \newcommand{\tensor}[1]{\textsf{\bfseries{#1}}}
112 \newcommand{\set}[1]{\ensuremath{\mathbb{#1}}}
113
114 % move super- and subscripts to make them more readable
115 \makeatletter
116 \frozen@everymath={\check@mathfonts
117 \fontdimen16 \textfont2=\fontdimen17 \textfont2
118 \the\everymath}
119 \frozen@everydisplay={\check@mathfonts
120 \fontdimen16 \textfont2=\fontdimen17 \textfont2
121 \the\everymath}
122 \makeatother
123
124 %% "closed" sqrt sign, https://tex.stackexchange.com/questions/29834/closed-square-root-symbol
125
126 \LetLtxMacro{\OldSqrt}{\sqrt}
127 \newcommand{\ClosedSqrt}[1][\hphantom{3}]{\def\DHLindex{#1}\mathpalette\DHLhksqrt}
128 \makeatletter
129 \newcommand*\bold@name{bold}
130 \def\DHLhksqrt#1#2{%
131 \setbox0=\hbox{$#1\OldSqrt{#2\,}$}\dimen0=\ht0\relax%
132 \advance\dimen0-0.2\ht0\relax% size of the added box is still 0.2 times ht0
133 \setbox2=\hbox{\vrule height\ht0 depth -\dimen0}%
134 {\hbox{$#1\expandafter\OldSqrt\expandafter[\DHLindex]{#2\,}$}
135 \lower\ifx\math@version\[email protected]\else0.4pt\fi\box2}
136 }
137 % root index positioning and added space at the end, mostly noticeable in inline math mode
138 \renewcommand*{\sqrt}[2][\ ]{\ClosedSqrt[\leftroot{-2}\uproot{1}#1]{#2}\kern0.1em}
139 \makeatother
140
141 \DeclareMathOperator{\logit}{logit}
142 \DeclareMathOperator{\sgn}{sgn}
143 \DeclareMathOperator{\diag}{diag}
144 \DeclareMathOperator{\var}{var}
145 \DeclareMathOperator{\cov}{Cov}
146 \DeclareMathOperator{\trace}{tr}
147 \DeclareMathOperator{\abs}{abs}
148 \DeclareMathOperator{\rk}{rk}
149 \DeclareMathOperator{\svd}{svd}
150 \DeclareMathOperator{\median}{median}
151 \DeclareMathOperator{\dist}{dist}
152 \DeclareMathOperator{\ld}{ld}
153 \DeclareMathOperator{\modulo}{modulo}
154
155 % physicochemical entities
156 \newcommand{\ph}{\Foreign{p}H}
157 \newcommand{\poh}{\Foreign{p}OH}
158 \newcommand{\pka}{\Foreign{p}K\textsubscript{a}}
159 \newcommand{\pkb}{\Foreign{p}K\textsubscript{b}}
160 \newcommand{\pkw}{\Foreign{p}K\textsubscript{w}}
161 \newcommand{\pkr}{\Foreign{p}K\textsubscript{r}}
162 \newcommand{\pI}{\Foreign{p}I}
163
164 % Chemical formulas in text
165 \makeatletter
166 \DeclareRobustCommand{\single}{\raisebox{0.25ex}{$\m@th-$}}
167 \DeclareRobustCommand{\dotted}{\raisebox{0.6ex}{$\m@th.. $}}
168 \DeclareRobustCommand{\Lewis}{\raisebox{0.6ex}{$\m@th.$}}
169 \DeclareRobustCommand{\double}{\raisebox{0.25ex}{$\m@th=$}}
170 \DeclareRobustCommand{\triple}{\raisebox{0.25ex}{$\m@th\equiv$}}
171 \DeclareRobustCommand*{\Doth}{\LARGE{.}}
172 \DeclareRobustCommand{\radic}{\hspace{-0.1em}{\raisebox{1.4ex}{\Doth}}}
173 \DeclareRobustCommand{\chemical}[1]{%
174 {\(\m@th
175 \edef\resetfontdimens{\noexpand\)%
176 \fontdimen16 \textfont2=\the\fontdimen16 \textfont2
177 \fontdimen17 \textfont2=\the\fontdimen17 \textfont2 \relax}%
178 \fontdimen16 \textfont2=2.7pt \fontdimen17 \textfont2=2.7pt
179 \mathsf{#1}%
180 \resetfontdimens}}
181 \makeatother
182 \renewcommand{\isotopestyle}{\mathsf}% if package isotope is used
183
184 % use academic colours: philosophers blue, physicians green, lawyers red, theologists black
185 \newtcolorbox{advanced}[1]{colback=blue!5!white,colframe=blue!75!black,fonttitle=\bfseries,title=#1,breakable}
186 \newtcolorbox{medical}{colback=green!5!white,colframe=green!75!black,breakable}
187 \newtcolorbox{medtitle}[1]{colback=green!5!white,colframe=green!75!black,fonttitle=\bfseries,title=#1,breakable}
188 \newtcolorbox{rules}{colback=red!5!white,colframe=red!75!black,breakable}
189
190 \lstloadlanguages{[Borland6]Pascal,R,[x86masm]assembler}
191 \lstset{backgroundcolor=\color{Cornsilk},
192 language=[Borland6]Pascal,
193 alsolanguage=[x86masm]assembler,
194 alsolanguage=R,
195 extendedchars=false, % chars 128-255 not printed
196 breaklines=true, % long lines broken
197 breakatwhitespace=true, % ... but only at whitespace
198 numbers=left, numberstyle=\tiny, stepnumber=1, numbersep=0pt,
199 basicstyle=\ttfamily\small\color{black}, % print listing small monospaced
200 keywordstyle=\bfseries,
201 identifierstyle=\color{DarkRed}, %
202 morecomment=[l]{//}, % allow inline comments from Object Pascal
203 commentstyle=\color{Blue},
204 stringstyle=\color{DodgerBlue},
205 showstringspaces=false % no special string spaces
206 }
207 \defaultfontfeatures{Scale=MatchLowercase}
208 \setmonofont{Fantasque Sans Mono} % 0O, 1Il -~ clearly distinguished, Jany Belluz <[email protected]>
209
210 % definitions for biblatex http://www.khirevich.com/latex/biblatex/, https://3d.bk.tudelft.nl/hledoux/blog/fiddling-biblatex/,
211 % [email protected] on comp.text.tex, https://tex.stackexchange.com/questions/211199/changing-the-position-of-the-editor-with-biblatex-inbook
212
213 \DeclareNameAlias{sortname}{last-first}
214
215 \renewcommand{\multinamedelim}{\addcomma\space}
216 \renewcommand{\finalnamedelim}{\addspace\&\space}
217
218 \DefineBibliographyStrings{british}{%
219 andothers = {\textit{et\addabbrvspace al\adddot}},
220 editor = {(ed\adddot):},
221 editors = {(eds\adddot):},
222 byeditor = {(ed\adddot):},
223 }
224
225 \DefineBibliographyStrings{german}{%
226 andothers = {\textit{et\addabbrvspace al\adddot}},
227 editor = {(Hrsg.):},
228 editors = {(Hrsg.):},
229 byeditor = {(Hrsg.):},
230 }
231
232 %(ed.) after name list:
233
234 \renewbibmacro*{byeditor+others}{%
235 \ifnameundef{editor}
236 {}
237 {\printnames[byeditor][1-1]{editor}%
238 \setunit{\addspace}%
239 \usebibmacro{byeditor+othersstrg}%
240 \clearname{editor}%
241 \newunit}%
242 \usebibmacro{byeditorx}%
243 \usebibmacro{bytranslator+others}}
244
245 \renewcommand{\emph}[1]{\textnormal{\textit{#1}}}
246 \renewcommand*{\mkbibnamefamily}[1]{\textnormal{\textsc{#1}}} %
247 \renewcommand{\newunitpunct}{\addspace\midsentence}
248 \DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space} %Doppelpunkt nach Namen, kein Punkt
249 \DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{\textnormal{#1}\addcomma} % keine Anführungszeichen um Titel und kursiv
250 \DeclareFieldFormat{journaltitle}{\mkbibemph{#1}} % italic journal title, no comma
251 \DeclareFieldFormat[inbook,thesis]{title}{\mkbibemph{#1\addcomma}} % italic title with comma
252 \DeclareFieldFormat[article]{title}{#1\addcomma} % title of journal article is printed as normal text
253 \DeclareFieldFormat{titlecase}{#1} % keine übermäßig vielen Großbuchstaben im Titel
254 \DeclareFieldFormat[article]{volume}{\mkbibbold{#1}} % Volume in bold
255 \DeclareFieldFormat[article]{number}{#1} % issue textnormal
256 \DeclareFieldFormat{pages}{#1} % Kein Präfix der Seitenzahlen
257
258 \renewbibmacro*{volume+number+eid}{%
259 \printfield{volume}%
260 \setunit{\addcolon}%
261 \printfield{number}%
262 }
263
264 \DeclareSourcemap{
265 \maps[datatype=bibtex]{
266 \map{
267 \step[fieldset=pagetotal, null]
268 }
269 }
270 }
271 \renewbibmacro{in:}{%
272 \ifentrytype{article}{}{\printtext{In\intitlepunct}}
273 }
274
275 % ------ setup for document
276
277 \floatsetup[table]{style=plaintop}
278 \setlength{\rotFPtop}{10pt plus 1fil} % quick fix for sidewaysfigures appearing to high, so that caption is cropped
279
280 \frenchspacing
281
282 \hyphenation{ATP-ase GTP-ase dia-be-tes phy-sio-logi-cal bio-lo-gy
283 pro-teo-ly-sis trans-cy-to-sis hy-dro-ly-sis telo-mere hy-dro-lysed
284 im-mu-no-glo-bu-lin Cali-for-nia mini-mum mini-ma phos-pha-ti-dyl pyro-phos-phate
285 phos-pho-pro-tein}
286
287 \makeatletter % \provideenvironment in analogy to \providecommand, https://tex.stackexchange.com/questions/20687/does-newenvironment-have-a-provideenvironment-cousin-as-newcommand-has-prov
288 \def\provideenvironment{\@star@or@long\provide@environment}
289 \def\provide@environment#1{%
290 \@ifundefined{#1}%
291 {\def\reserved@a{\newenvironment{#1}}}%
292 {\def\reserved@a{\renewenvironment{dummy@environ}}}%
293 \reserved@a
294 }
295 \def\dummy@environ{}
296 \makeatother
297
298 % Abstracts in book + scrbook
299 \providecommand\abstractname{Abstract}% doesn't change pre-existing command
300 \provideenvironment{abstract}[1]{%
301 \begin{center}\normalfont\bfseries\abstractname\end{center}
302 \begin{quotation} #1 \end{quotation}
303 }{%
304 \vspace{1cm}
305 }