├── .gitignore ├── Makefile ├── README.md ├── asciitable ├── .gitignore ├── Makefile ├── ascii.tex ├── ascii_letter.patch ├── build_ascii.py └── latin1_symbols.txt ├── conda ├── .gitignore ├── Makefile ├── conda-a4.tex └── conda-letter.tex ├── fortran ├── .gitignore ├── Makefile ├── fortran_refcard.tex ├── fortran_refcard_letter.patch └── refcards.sty ├── my_vim_mappings ├── .gitignore ├── Makefile └── my_vim_mappings.tex ├── periodictable ├── .gitignore ├── Makefile └── periodictable.py ├── perl ├── perl_refcard.odt └── perl_refcard.pdf ├── powers_of_ten ├── .gitignore ├── Makefile └── powers_of_ten.tex ├── python24 ├── python_refcard.odt └── python_refcard.pdf ├── vim ├── .gitignore ├── Makefile └── vimqrc.tex └── vimlatex ├── .gitignore ├── Makefile └── vimlatexqrc.tex /.gitignore: -------------------------------------------------------------------------------- 1 | /pdf 2 | /collect 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ALL = asciitable conda fortran my_vim_mappings powers_of_ten vim vimlatex periodictable 2 | 3 | all: 4 | @for folder in $(ALL); do echo "\n\n-" $$folder; make -C $$folder; done 5 | 6 | clean: 7 | @for folder in $(ALL); do echo "\n\n-" $$folder; make -C $$folder clean; done 8 | 9 | distclean: clean 10 | @for folder in $(ALL); do echo "\n\n-" $$folder; make -C $$folder distclean; done 11 | rm -rf collect 12 | 13 | collect: all 14 | mkdir -p collect 15 | cp asciitable/ascii_a4.pdf $@/ 16 | cp asciitable/ascii_letter.pdf $@/ 17 | cp fortran/fortran_refcard_a4.pdf $@/ 18 | cp fortran/fortran_refcard_letter.pdf $@/ 19 | cp my_vim_mappings/my_vim_mappings.pdf $@/ 20 | cp periodictable/periodictable-a4.pdf $@/ 21 | cp periodictable/periodictable-letter.pdf $@/ 22 | cp perl/perl_refcard.odt $@/ 23 | cp perl/perl_refcard.pdf $@/ 24 | cp python24/python_refcard.odt $@/ 25 | cp python24/python_refcard.pdf $@/ 26 | cp vim/vimqrc.pdf $@/ 27 | cp vimlatex/vimlatexqrc.pdf $@/ 28 | cp powers_of_ten//powers_of_ten.pdf $@/ 29 | rm -f $@/*.png 30 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten ascii_a4.pdf[0] ascii.png) 31 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten ascii_a4.pdf[0] ascii_thumbnail.png) 32 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten fortran_refcard_a4.pdf[0] fortran_refcard_0.png) 33 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten fortran_refcard_a4.pdf[1] fortran_refcard_1.png) 34 | (cd $@ && montage fortran_refcard_*.png -tile 1x2 -geometry +0+0 fortran_refcard.png && rm fortran_refcard_*.png) 35 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten fortran_refcard_a4.pdf[0] fortran_refcard_thumbnail.png) 36 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten my_vim_mappings.pdf[0] my_vim_mappings_0.png) 37 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten my_vim_mappings.pdf[1] my_vim_mappings_1.png) 38 | (cd $@ && montage my_vim_mappings_*.png -tile 1x2 -geometry +0+0 my_vim_mappings.png && rm my_vim_mappings_*.png) 39 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten my_vim_mappings.pdf[0] my_vim_mappings_thumbnail.png) 40 | (cd $@ && convert -density 200 -background white -flatten periodictable-a4.pdf[0] periodictable.png) 41 | (cd $@ && convert -density 20 -background white -flatten periodictable-a4.pdf[0] periodictable_thumbnail.png) 42 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten perl_refcard.pdf[0] perl_refcard_0.png) 43 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten perl_refcard.pdf[1] perl_refcard_1.png) 44 | (cd $@ && montage perl_refcard_*.png -tile 1x2 -geometry +0+0 perl_refcard.png && rm perl_refcard_*.png) 45 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten perl_refcard.pdf[0] perl_refcard_thumbnail.png) 46 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten python_refcard.pdf[0] python_refcard_0.png) 47 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten python_refcard.pdf[1] python_refcard_1.png) 48 | (cd $@ && montage python_refcard_*.png -tile 1x2 -geometry +0+0 python_refcard.png && rm python_refcard_*.png) 49 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten python_refcard.pdf[0] python_refcard_thumbnail.png) 50 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten vimqrc.pdf[0] vimqrc_0.png) 51 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten vimqrc.pdf[1] vimqrc_1.png) 52 | (cd $@ && montage vimqrc_*.png -tile 1x2 -geometry +0+0 vimqrc.png && rm vimqrc_*.png) 53 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten vimqrc.pdf[0] vimqrc_thumbnail.png) 54 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten vimlatexqrc.pdf[0] vimlatexqrc_0.png) 55 | (cd $@ && convert -density 150 -background white -colorspace Gray -flatten vimlatexqrc.pdf[1] vimlatexqrc_1.png) 56 | (cd $@ && montage vimlatexqrc_*.png -tile 1x2 -geometry +0+0 vimlatexqrc.png && rm vimlatexqrc_*.png) 57 | (cd $@ && convert -density 20 -background white -colorspace Gray -flatten vimlatexqrc.pdf[0] vimlatexqrc_thumbnail.png) 58 | 59 | .PHONY: all clean distclean 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Refcards 2 | 3 | This repository contains the sources for various of my Reference Cards / Cheat 4 | Sheets, available at https://michaelgoerz.net/refcards/. 5 | 6 | Mostly, these are in LaTeX or Plain TeX (possibly generated through a Python 7 | script), although some of the older refcards were written in Open Office (before 8 | I wised up to the fact that text processors are not suitable for tightly 9 | typeset documents that you still want to be able to reproduce ten years later). 10 | 11 | ## Prerequisites 12 | 13 | * Full LaTeX installation ([texlive 2018](https://www.tug.org/texlive/) should do) 14 | * [Python >= 3.5](https://www.anaconda.com/download/) with [numpy](https://numpy.org), [pandas](https://pandas.pydata.org), [click](https://click.palletsprojects.com/) packages installed. 15 | * [Open Office](https://www.libreoffice.org) for *.odt files 16 | * gnu make (macOS: `xcode-select --install`) 17 | * [ImageMagick](http://www.imagemagick.org/script/index.php) (macOS: `brew install imagemagick`) 18 | 19 | 20 | ## Generate the refcards 21 | 22 | To generate *all* refcards, run 23 | 24 | make 25 | 26 | To return the repository to a clean state, removing all generated refcards, run 27 | 28 | make distclean 29 | 30 | You can also remove build-artifacts (such as tex-aux files) with 31 | 32 | make clean 33 | 34 | To collect the files for https://michaelgoerz.net/refcards/, I use 35 | 36 | make collect 37 | 38 | 39 | If you only want to generate a particular refcard, you can also run 40 | `make`/`make clean`/`make distclean` from within the folder for that refcard. 41 | -------------------------------------------------------------------------------- /asciitable/.gitignore: -------------------------------------------------------------------------------- 1 | /ascii.aux 2 | /ascii.log 3 | /ascii.out 4 | /ascii_a4.pdf 5 | /ascii_letter.aux 6 | /ascii_letter.log 7 | /ascii_letter.out 8 | /ascii_letter.pdf 9 | /ascii_letter.tex 10 | -------------------------------------------------------------------------------- /asciitable/Makefile: -------------------------------------------------------------------------------- 1 | all: ascii_a4.pdf ascii_letter.pdf 2 | 3 | ascii_a4.pdf: ascii.tex 4 | #xelatex -output-driver="xdvipdfmx -q -E -p a4 -l" $< 5 | pdflatex $< 6 | mv ascii.pdf $@ 7 | 8 | ascii_letter.pdf: ascii_letter.tex 9 | #xelatex -papersize=letter $< 10 | pdflatex $< 11 | 12 | ascii_letter.tex: ascii.tex ascii_letter.patch 13 | cp $< $@ 14 | patch $@ ascii_letter.patch 15 | 16 | clean: 17 | rm -f *.out 18 | rm -f *.log 19 | rm -f *.aux 20 | 21 | distclean: clean 22 | rm -f ascii_letter.tex 23 | rm -f *.pdf 24 | 25 | .PHONY: all clean distclean 26 | -------------------------------------------------------------------------------- /asciitable/ascii.tex: -------------------------------------------------------------------------------- 1 | % For very old releases of texlive, 2 | % pdflatex has a problem with the 'ascii' font that I'm using. It seems to work 3 | % with xetex: 4 | % xelatex -output-driver="xdvipdfmx -q -E -p a4 -l" ascii.tex 5 | % for A4 paper, or 6 | % xelatex -papersize=letter ascii.tex 7 | % for letter sized paper 8 | % Don't ask me why getting a page in landscape is so inconsistent and messy. 9 | 10 | \documentclass[a4paper, landscape, 10pt]{article} % for A4 size paper 11 | %\documentclass[letter, landscape, 10pt]{article} % for letter size paper 12 | 13 | % without using the hyperref package, the result is not in landscape for me 14 | \usepackage[ 15 | pdftitle={ASCII Table}, 16 | pdfauthor={Michael Goerz} 17 | ]{hyperref} 18 | 19 | \usepackage[landscape]{geometry} 20 | \usepackage[absolute]{textpos} 21 | 22 | \usepackage{ascii} 23 | \usepackage{textcomp} 24 | \usepackage{eurosym} 25 | \usepackage{cclicenses} 26 | 27 | \usepackage[T1]{fontenc} 28 | 29 | \TPGrid[10mm,5mm]{26}{20} 30 | 31 | \parindent=0pt 32 | \parskip=0.5\baselineskip 33 | 34 | 35 | \begin{document} 36 | \pagestyle{empty} 37 | 38 | \begin{textblock}{26}(0,-0.2) 39 | \center 40 | \textsc{Regular ASCII Chart} (character codes 0 -- 127) 41 | \end{textblock} 42 | 43 | %%%% 0: 000-015 %%%% 44 | \begin{textblock}{4}(0,1) 45 | {\tt 46 | \begin{tabular*}{\textwidth}{|cccc} 47 | \hline 48 | 000\textit{d} & 00\textit{h} & \NUL & (nul) \\ 49 | 001\textit{d} & 01\textit{h} & \SOH & (soh) \\ 50 | 002\textit{d} & 02\textit{h} & \STX & (stx) \\ 51 | 003\textit{d} & 03\textit{h} & \ETX & (etx) \\ 52 | 004\textit{d} & 04\textit{h} & \EOT & (eot) \\ 53 | 005\textit{d} & 05\textit{h} & \ENQ & (enq) \\ 54 | 006\textit{d} & 06\textit{h} & \ACK & (ack) \\ 55 | 007\textit{d} & 07\textit{h} & \BEL & (bel) \\ 56 | 008\textit{d} & 08\textit{h} & \BS & (bs) \\ 57 | 009\textit{d} & 09\textit{h} & ~ & (tab) \\ 58 | 010\textit{d} & 0A\textit{h} & \LF & (lf) \\ 59 | 011\textit{d} & 0B\textit{h} & \VT & (vt) \\ 60 | 012\textit{d} & 0C\textit{h} & ~ & (np) \\ 61 | 013\textit{d} & 0D\textit{h} & \CR & (cr) \\ 62 | 014\textit{d} & 0E\textit{h} & \SO & (so) \\ 63 | 015\textit{d} & 0F\textit{h} & \SI & (si) \\ 64 | \hline 65 | \end{tabular*} 66 | } 67 | \end{textblock} 68 | 69 | 70 | %%%% 1: 016-031 %%%% 71 | \begin{textblock}{4}(4,1) 72 | {\tt 73 | \begin{tabular*}{\textwidth}{|cccc} 74 | \hline 75 | 016\textit{d} & 10\textit{h} & \DLE & (dle) \\ 76 | 017\textit{d} & 11\textit{h} & \DCa & (dc1) \\ 77 | 018\textit{d} & 12\textit{h} & \DCb & (dc2) \\ 78 | 019\textit{d} & 13\textit{h} & \DCc & (dc3) \\ 79 | 020\textit{d} & 14\textit{h} & \DCd & (dc4) \\ 80 | 021\textit{d} & 15\textit{h} & \NAK & (nak) \\ 81 | 022\textit{d} & 16\textit{h} & \SYN & (syn) \\ 82 | 023\textit{d} & 17\textit{h} & \ETB & (etb) \\ 83 | 024\textit{d} & 18\textit{h} & \CAN & (can) \\ 84 | 025\textit{d} & 19\textit{h} & \EM & (em) \\ 85 | 026\textit{d} & 1A\textit{h} & ~ & (eof) \\ 86 | 027\textit{d} & 1B\textit{h} & \ESC & (esc) \\ 87 | 028\textit{d} & 1C\textit{h} & \FS & (fs) \\ 88 | 029\textit{d} & 1D\textit{h} & \GS & (gs) \\ 89 | 030\textit{d} & 1E\textit{h} & \RS & (rs) \\ 90 | 031\textit{d} & 1F\textit{h} & \US & (us) \\ 91 | \hline 92 | \end{tabular*} 93 | } 94 | \end{textblock} 95 | 96 | 97 | 98 | %%%% 2: 032-047 %%%% 99 | \begin{textblock}{3}(8,1) 100 | {\tt 101 | \begin{tabular*}{\textwidth}{|ccc} 102 | \hline 103 | 032\textit{d} & 20\textit{h} & \textvisiblespace \\ 104 | 033\textit{d} & 21\textit{h} & ! \\ 105 | 034\textit{d} & 22\textit{h} & " \\ 106 | 035\textit{d} & 23\textit{h} & \# \\ 107 | 036\textit{d} & 24\textit{h} & \$ \\ 108 | 037\textit{d} & 25\textit{h} & \% \\ 109 | 038\textit{d} & 26\textit{h} & \& \\ 110 | 039\textit{d} & 27\textit{h} & \textquotesingle \\ 111 | 040\textit{d} & 28\textit{h} & ( \\ 112 | 041\textit{d} & 29\textit{h} & ) \\ 113 | 042\textit{d} & 2A\textit{h} & * \\ 114 | 043\textit{d} & 2B\textit{h} & + \\ 115 | 044\textit{d} & 2C\textit{h} & \textquoteright \\ 116 | 045\textit{d} & 2D\textit{h} & - \\ 117 | 046\textit{d} & 2E\textit{h} & . \\ 118 | 047\textit{d} & 2F\textit{h} & / \\ 119 | \hline 120 | \end{tabular*} 121 | } 122 | \end{textblock} 123 | 124 | 125 | %%%% 3: 048-063 %%%% 126 | \begin{textblock}{3}(11,1) 127 | {\tt 128 | \begin{tabular*}{\textwidth}{|ccc} 129 | \hline 130 | 048\textit{d} & 30\textit{h} & 0 \\ 131 | 049\textit{d} & 31\textit{h} & 1 \\ 132 | 050\textit{d} & 32\textit{h} & 2 \\ 133 | 051\textit{d} & 33\textit{h} & 3 \\ 134 | 052\textit{d} & 34\textit{h} & 4 \\ 135 | 053\textit{d} & 35\textit{h} & 5 \\ 136 | 054\textit{d} & 36\textit{h} & 6 \\ 137 | 055\textit{d} & 37\textit{h} & 7 \\ 138 | 056\textit{d} & 38\textit{h} & 8 \\ 139 | 057\textit{d} & 39\textit{h} & 9 \\ 140 | 058\textit{d} & 3A\textit{h} & : \\ 141 | 059\textit{d} & 3B\textit{h} & ; \\ 142 | 060\textit{d} & 3C\textit{h} & < \\ 143 | 061\textit{d} & 3D\textit{h} & = \\ 144 | 062\textit{d} & 3E\textit{h} & > \\ 145 | 063\textit{d} & 3F\textit{h} & ? \\ 146 | \hline 147 | \end{tabular*} 148 | } 149 | \end{textblock} 150 | 151 | 152 | %%%% 4: 064-079 %%%% 153 | \begin{textblock}{3}(14,1) 154 | {\tt 155 | \begin{tabular*}{\textwidth}{|ccc} 156 | \hline 157 | 064\textit{d} & 40\textit{h} & @ \\ 158 | 065\textit{d} & 41\textit{h} & A \\ 159 | 066\textit{d} & 42\textit{h} & B \\ 160 | 067\textit{d} & 43\textit{h} & C \\ 161 | 068\textit{d} & 44\textit{h} & D \\ 162 | 069\textit{d} & 45\textit{h} & E \\ 163 | 070\textit{d} & 46\textit{h} & F \\ 164 | 071\textit{d} & 47\textit{h} & G \\ 165 | 072\textit{d} & 48\textit{h} & H \\ 166 | 073\textit{d} & 49\textit{h} & I \\ 167 | 074\textit{d} & 4A\textit{h} & J \\ 168 | 075\textit{d} & 4B\textit{h} & K \\ 169 | 076\textit{d} & 4C\textit{h} & L \\ 170 | 077\textit{d} & 4D\textit{h} & M \\ 171 | 078\textit{d} & 4E\textit{h} & N \\ 172 | 079\textit{d} & 4F\textit{h} & O \\ 173 | \hline 174 | \end{tabular*} 175 | } 176 | \end{textblock} 177 | 178 | 179 | %%%% 5: 080-095 %%%% 180 | \begin{textblock}{3}(17,1) 181 | {\tt 182 | \begin{tabular*}{\textwidth}{|ccc} 183 | \hline 184 | 080\textit{d} & 50\textit{h} & P \\ 185 | 081\textit{d} & 51\textit{h} & Q \\ 186 | 082\textit{d} & 52\textit{h} & R \\ 187 | 083\textit{d} & 53\textit{h} & S \\ 188 | 084\textit{d} & 54\textit{h} & T \\ 189 | 085\textit{d} & 55\textit{h} & U \\ 190 | 086\textit{d} & 56\textit{h} & V \\ 191 | 087\textit{d} & 57\textit{h} & W \\ 192 | 088\textit{d} & 58\textit{h} & X \\ 193 | 089\textit{d} & 59\textit{h} & Y \\ 194 | 090\textit{d} & 5A\textit{h} & Z \\ 195 | 091\textit{d} & 5B\textit{h} & [ \\ 196 | 092\textit{d} & 5C\textit{h} & \char`\\ \\ 197 | 093\textit{d} & 5D\textit{h} & ] \\ 198 | 094\textit{d} & 5E\textit{h} & \^{}\\ 199 | 095\textit{d} & 5F\textit{h} & \char`\_ \\ 200 | \hline 201 | \end{tabular*} 202 | } 203 | \end{textblock} 204 | 205 | 206 | 207 | %%%% 6: 096-111 %%%% 208 | \begin{textblock}{3}(20,1) 209 | {\tt 210 | \begin{tabular*}{\textwidth}{|ccc} 211 | \hline 212 | 096\textit{d} & 60\textit{h} & \textquoteleft \\ 213 | 097\textit{d} & 61\textit{h} & a \\ 214 | 098\textit{d} & 62\textit{h} & b \\ 215 | 099\textit{d} & 63\textit{h} & c \\ 216 | 100\textit{d} & 64\textit{h} & d \\ 217 | 101\textit{d} & 65\textit{h} & e \\ 218 | 102\textit{d} & 66\textit{h} & f \\ 219 | 103\textit{d} & 67\textit{h} & g \\ 220 | 104\textit{d} & 68\textit{h} & h \\ 221 | 105\textit{d} & 69\textit{h} & i \\ 222 | 106\textit{d} & 6A\textit{h} & j \\ 223 | 107\textit{d} & 6B\textit{h} & k \\ 224 | 108\textit{d} & 6C\textit{h} & l \\ 225 | 109\textit{d} & 6D\textit{h} & m \\ 226 | 110\textit{d} & 6E\textit{h} & n \\ 227 | 111\textit{d} & 6F\textit{h} & o \\ 228 | \hline 229 | \end{tabular*} 230 | } 231 | \end{textblock} 232 | 233 | 234 | %%%% 7: 112-127 %%%% 235 | \begin{textblock}{3}(23,1) 236 | {\tt 237 | \begin{tabular*}{\textwidth}{|ccc} 238 | \hline 239 | 112\textit{d} & 70\textit{h} & p \\ 240 | 113\textit{d} & 71\textit{h} & q \\ 241 | 114\textit{d} & 72\textit{h} & r \\ 242 | 115\textit{d} & 73\textit{h} & s \\ 243 | 116\textit{d} & 74\textit{h} & t \\ 244 | 117\textit{d} & 75\textit{h} & u \\ 245 | 118\textit{d} & 76\textit{h} & v \\ 246 | 119\textit{d} & 77\textit{h} & w \\ 247 | 120\textit{d} & 78\textit{h} & x \\ 248 | 121\textit{d} & 79\textit{h} & y \\ 249 | 122\textit{d} & 7A\textit{h} & z \\ 250 | 123\textit{d} & 7B\textit{h} & \char`\{ \\ 251 | 124\textit{d} & 7C\textit{h} & | \\ 252 | 125\textit{d} & 7D\textit{h} & \char`\} \\ 253 | 126\textit{d} & 7E\textit{h} & \~{} \\ 254 | 127\textit{d} & 7F\textit{h} & \DEL \\ 255 | \hline 256 | \end{tabular*} 257 | } 258 | \end{textblock} 259 | 260 | 261 | % use a dummy table to get the vertical line at the right edge 262 | \begin{textblock}{3}(26,1) 263 | {\tt 264 | \begin{tabular*}{\textwidth}{|c} 265 | ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ 266 | ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ 267 | \end{tabular*} 268 | } 269 | \end{textblock} 270 | 271 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 272 | 273 | \begin{textblock}{26}(0,7.8) 274 | \center 275 | \textsc{Extended ASCII Chart} (character codes 128 -- 255) \textsc{Latin1/CP1252} 276 | \end{textblock} 277 | 278 | %%%% 8: 128-143 %%%% 279 | \begin{textblock}{4}(0,9) 280 | {\tt 281 | \begin{tabular*}{\textwidth}{|cccc} 282 | \hline 283 | 128\textit{d} & 80\textit{h} & ~ & \euro \\ 284 | 129\textit{d} & 81\textit{h} & ~ & ~ \\ 285 | 130\textit{d} & 82\textit{h} & ~ & \quotesinglbase \\ 286 | 131\textit{d} & 83\textit{h} & ~ & \textit{f} \\ 287 | 132\textit{d} & 84\textit{h} & ~ & \quotedblbase \\ 288 | 133\textit{d} & 85\textit{h} & ~ & \dots \\ 289 | 134\textit{d} & 86\textit{h} & ~ & \dag \\ 290 | 135\textit{d} & 87\textit{h} & ~ & \ddag \\ 291 | 136\textit{d} & 88\textit{h} & ~ & \textasciicircum \\ 292 | 137\textit{d} & 89\textit{h} & ~ & \textperthousand \\ 293 | 138\textit{d} & 8A\textit{h} & ~ & \v{S} \\ 294 | 139\textit{d} & 8B\textit{h} & ~ & \guilsinglleft \\ 295 | 140\textit{d} & 8C\textit{h} & ~ & \OE \\ 296 | 141\textit{d} & 8D\textit{h} & ~ & ~ \\ 297 | 142\textit{d} & 8E\textit{h} & ~ & \v{Z} \\ 298 | 143\textit{d} & 8F\textit{h} & ~ & ~ \\ 299 | \hline 300 | \end{tabular*} 301 | } 302 | \end{textblock} 303 | 304 | 305 | %%%% 9: 144-143 %%%% 306 | \begin{textblock}{4}(4,9) 307 | {\tt 308 | \begin{tabular*}{\textwidth}{|cccc} 309 | \hline 310 | 144\textit{d} & 90\textit{h} & ~ & ~ \\ 311 | 145\textit{d} & 91\textit{h} & ~ & ` \\ 312 | 146\textit{d} & 92\textit{h} & ~ & ' \\ 313 | 147\textit{d} & 93\textit{h} & ~ & `` \\ 314 | 148\textit{d} & 94\textit{h} & ~ & '' \\ 315 | 149\textit{d} & 95\textit{h} & ~ & \textbullet \\ 316 | 150\textit{d} & 96\textit{h} & ~ & -- \\ 317 | 151\textit{d} & 97\textit{h} & ~ & --- \\ 318 | 152\textit{d} & 98\textit{h} & ~ & \textasciitilde \\ 319 | 153\textit{d} & 99\textit{h} & ~ & \texttrademark \\ 320 | 154\textit{d} & 9A\textit{h} & ~ & \v{s} \\ 321 | 155\textit{d} & 9B\textit{h} & ~ & \guilsinglright \\ 322 | 156\textit{d} & 9C\textit{h} & ~ & \oe \\ 323 | 157\textit{d} & 9D\textit{h} & ~ & ~ \\ 324 | 158\textit{d} & 9E\textit{h} & ~ & \v{z} \\ 325 | 159\textit{d} & 9F\textit{h} & ~ & \"{Y} \\ 326 | \hline 327 | \end{tabular*} 328 | } 329 | \end{textblock} 330 | 331 | 332 | 333 | %%%% 10: 160-175 %%%% 334 | \begin{textblock}{3}(8,9) 335 | {\tt 336 | \begin{tabular*}{\textwidth}{|ccc} 337 | \hline 338 | 160\textit{d} & A0\textit{h} & \NBSP \\ 339 | 161\textit{d} & A1\textit{h} & !` \\ 340 | 162\textit{d} & A2\textit{h} & \textcent \\ 341 | 163\textit{d} & A3\textit{h} & \pounds \\ 342 | 164\textit{d} & A4\textit{h} & \textcurrency \\ 343 | 165\textit{d} & A5\textit{h} & \textyen \\ 344 | 166\textit{d} & A6\textit{h} & \textbrokenbar \\ 345 | 167\textit{d} & A7\textit{h} & \S \\ 346 | 168\textit{d} & A8\textit{h} & \textasciidieresis \\ 347 | 169\textit{d} & A9\textit{h} & \textrm{\small\textcopyright} \\ 348 | 170\textit{d} & AA\textit{h} & \textordfeminine \\ 349 | 171\textit{d} & AB\textit{h} & \guillemotleft \\ 350 | 172\textit{d} & AC\textit{h} & \textlnot \\ 351 | 173\textit{d} & AD\textit{h} & \- \\ 352 | 174\textit{d} & AE\textit{h} & \textrm{\small\textregistered} \\ 353 | 175\textit{d} & AF\textit{h} & \textasciimacron \\ 354 | \hline 355 | \end{tabular*} 356 | } 357 | \end{textblock} 358 | 359 | 360 | %%%% 11: 176-191 %%%% 361 | \begin{textblock}{3}(11,9) 362 | {\tt 363 | \begin{tabular*}{\textwidth}{|ccc} 364 | \hline 365 | 176\textit{d} & B0\textit{h} & \textdegree \\ 366 | 177\textit{d} & B1\textit{h} & \textpm \\ 367 | 178\textit{d} & B2\textit{h} & \texttwosuperior \\ 368 | 179\textit{d} & B3\textit{h} & \textthreesuperior \\ 369 | 180\textit{d} & B4\textit{h} & \textasciiacute \\ 370 | 181\textit{d} & B5\textit{h} & \textmu \\ 371 | 182\textit{d} & B6\textit{h} & \P \\ 372 | 183\textit{d} & B7\textit{h} & \textperiodcentered \\ 373 | 184\textit{d} & B8\textit{h} & \c{} \\ 374 | 185\textit{d} & B9\textit{h} & \textonesuperior \\ 375 | 186\textit{d} & BA\textit{h} & \textordmasculine \\ 376 | 187\textit{d} & BB\textit{h} & \guillemotright \\ 377 | 188\textit{d} & BC\textit{h} & \textonequarter \\ 378 | 189\textit{d} & BD\textit{h} & \textonehalf \\ 379 | 190\textit{d} & BE\textit{h} & \textthreequarters \\ 380 | 191\textit{d} & BF\textit{h} & ?` \\ 381 | \hline 382 | \end{tabular*} 383 | } 384 | \end{textblock} 385 | 386 | 387 | %%%% 12: 192-207 %%%% 388 | \begin{textblock}{3}(14,9) 389 | {\tt 390 | \begin{tabular*}{\textwidth}{|ccc} 391 | \hline 392 | 192\textit{d} & C0\textit{h} & \`{A} \\ 393 | 193\textit{d} & C1\textit{h} & \'{A} \\ 394 | 194\textit{d} & C2\textit{h} & \^{A} \\ 395 | 195\textit{d} & C3\textit{h} & \~{A} \\ 396 | 196\textit{d} & C4\textit{h} & \"{A} \\ 397 | 197\textit{d} & C5\textit{h} & \AA \\ 398 | 198\textit{d} & C6\textit{h} & \AE \\ 399 | 199\textit{d} & C7\textit{h} & \c{C} \\ 400 | 200\textit{d} & C8\textit{h} & \`{E} \\ 401 | 201\textit{d} & C9\textit{h} & \'{E} \\ 402 | 202\textit{d} & CA\textit{h} & \^{E} \\ 403 | 203\textit{d} & CB\textit{h} & \"{E} \\ 404 | 204\textit{d} & CC\textit{h} & \`{I} \\ 405 | 205\textit{d} & CD\textit{h} & \'{I} \\ 406 | 206\textit{d} & CE\textit{h} & \^{I} \\ 407 | 207\textit{d} & CF\textit{h} & \"{I} \\ 408 | \hline 409 | \end{tabular*} 410 | } 411 | \end{textblock} 412 | 413 | 414 | %%%% 13: 208-223 %%%% 415 | \begin{textblock}{3}(17,9) 416 | {\tt 417 | \begin{tabular*}{\textwidth}{|ccc} 418 | \hline 419 | 208\textit{d} & D0\textit{h} & \DH \\ 420 | 209\textit{d} & D1\textit{h} & \~{N} \\ 421 | 210\textit{d} & D2\textit{h} & \`{O} \\ 422 | 211\textit{d} & D3\textit{h} & \'{O} \\ 423 | 212\textit{d} & D4\textit{h} & \^{O} \\ 424 | 213\textit{d} & D5\textit{h} & \~{O} \\ 425 | 214\textit{d} & D6\textit{h} & \"{O} \\ 426 | 215\textit{d} & D7\textit{h} & \texttimes \\ 427 | 216\textit{d} & D8\textit{h} & \O \\ 428 | 217\textit{d} & D9\textit{h} & \`{U} \\ 429 | 218\textit{d} & DA\textit{h} & \'{U} \\ 430 | 219\textit{d} & DB\textit{h} & \^{U} \\ 431 | 220\textit{d} & DC\textit{h} & \"{U} \\ 432 | 221\textit{d} & DD\textit{h} & \'{Y} \\ 433 | 222\textit{d} & DE\textit{h} & \TH \\ 434 | 223\textit{d} & DF\textit{h} & \ss \\ 435 | \hline 436 | \end{tabular*} 437 | } 438 | \end{textblock} 439 | 440 | 441 | 442 | %%%% 14: 224-223 %%%% 443 | \begin{textblock}{3}(20,9) 444 | {\tt 445 | \begin{tabular*}{\textwidth}{|ccc} 446 | \hline 447 | 224\textit{d} & E0\textit{h} & \`{a} \\ 448 | 225\textit{d} & E1\textit{h} & \'{a} \\ 449 | 226\textit{d} & E2\textit{h} & \^{a} \\ 450 | 227\textit{d} & E3\textit{h} & \~{a} \\ 451 | 228\textit{d} & E4\textit{h} & \"{a} \\ 452 | 229\textit{d} & E5\textit{h} & \aa \\ 453 | 230\textit{d} & E6\textit{h} & \ae \\ 454 | 231\textit{d} & E7\textit{h} & \c{c} \\ 455 | 232\textit{d} & E8\textit{h} & \`{e} \\ 456 | 233\textit{d} & E9\textit{h} & \'{e} \\ 457 | 234\textit{d} & EA\textit{h} & \^{e} \\ 458 | 235\textit{d} & EB\textit{h} & \"{e} \\ 459 | 236\textit{d} & EC\textit{h} & \`{i} \\ 460 | 237\textit{d} & ED\textit{h} & \'{i} \\ 461 | 238\textit{d} & EE\textit{h} & \^{i} \\ 462 | 239\textit{d} & EF\textit{h} & \"{i} \\ 463 | \hline 464 | \end{tabular*} 465 | } 466 | \end{textblock} 467 | 468 | 469 | %%%% 15: 240-255 %%%% 470 | \begin{textblock}{3}(23,9) 471 | {\tt 472 | \begin{tabular*}{\textwidth}{|ccc} 473 | \hline 474 | 240\textit{d} & F0\textit{h} & \dh \\ 475 | 241\textit{d} & F1\textit{h} & \~{n} \\ 476 | 242\textit{d} & F2\textit{h} & \`{o} \\ 477 | 243\textit{d} & F3\textit{h} & \'{o} \\ 478 | 244\textit{d} & F4\textit{h} & \^{o} \\ 479 | 245\textit{d} & F5\textit{h} & \~{o} \\ 480 | 246\textit{d} & F6\textit{h} & \"{o} \\ 481 | 247\textit{d} & F7\textit{h} & \textdiv \\ 482 | 248\textit{d} & F8\textit{h} & \o \\ 483 | 249\textit{d} & F9\textit{h} & \`{u} \\ 484 | 250\textit{d} & FA\textit{h} & \'{u} \\ 485 | 251\textit{d} & FB\textit{h} & \^{u} \\ 486 | 252\textit{d} & FC\textit{h} & \"{u} \\ 487 | 253\textit{d} & FD\textit{h} & \'{y} \\ 488 | 254\textit{d} & FE\textit{h} & \th \\ 489 | 255\textit{d} & FF\textit{h} & \"{y} \\ 490 | \hline 491 | \end{tabular*} 492 | } 493 | \end{textblock} 494 | 495 | 496 | % use a dummy table to get the vertical line at the right edge 497 | \begin{textblock}{3}(26,9) 498 | {\tt 499 | \begin{tabular*}{\textwidth}{|c} 500 | ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ 501 | ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ \\ ~ 502 | \end{tabular*} 503 | } 504 | \end{textblock} 505 | 506 | 507 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 508 | 509 | 510 | \begin{textblock}{6}(0,16) 511 | \center 512 | Hexadecimal to Binary 513 | \end{textblock} 514 | \begin{textblock}{6}(0,17.6) 515 | {\tt 516 | \begin{tabular}{|cc|cc||cc|cc|} 517 | \hline 518 | 0 & 0000 & 4 & 0100 & 8 & 1000 & C & 1100 \\ 519 | 1 & 0001 & 5 & 0101 & 9 & 1001 & D & 1101 \\ 520 | 2 & 0010 & 6 & 0110 & A & 1010 & E & 1110 \\ 521 | 3 & 0011 & 7 & 0111 & B & 1011 & F & 1111 \\ 522 | \hline 523 | \end{tabular} 524 | } 525 | \end{textblock} 526 | 527 | 528 | \begin{textblock}{6}(8,16) 529 | \center 530 | Groups of ASCII-Code in Binary 531 | \end{textblock} 532 | \begin{textblock}{6}(8,17.2) 533 | { 534 | \begin{tabular}{|c|c|l|} 535 | \hline 536 | Bit 6 & Bit 5 & Group \\ 537 | \hline 538 | {\tt 0} & {\tt 0} & Control Characters \\ 539 | {\tt 0} & {\tt 1} & Digits and Punctuation \\ 540 | {\tt 1} & {\tt 0} & Upper Case and Special \\ 541 | {\tt 1} & {\tt 1} & Lower Case and Special \\ 542 | \hline 543 | \end{tabular} 544 | } 545 | \end{textblock} 546 | 547 | \begin{textblock}{8}(17,17) 548 | \cc 2009 Michael Goerz \\ 549 | { \small 550 | This work is licensed under the Creative Commons \\ 551 | Attribution-Noncommercial-Share Alike 3.0 License.\\ 552 | To view a copy of this license, visit\\ 553 | http://creativecommons.org/licenses/by-nc-sa/ 554 | } 555 | \end{textblock} 556 | 557 | \end{document} 558 | -------------------------------------------------------------------------------- /asciitable/ascii_letter.patch: -------------------------------------------------------------------------------- 1 | --- ascii.tex 2018-12-13 13:27:21.000000000 -0500 2 | +++ ascii_letter.tex 2018-12-14 17:46:54.000000000 -0500 3 | @@ -7,8 +7,8 @@ 4 | % for letter sized paper 5 | % Don't ask me why getting a page in landscape is so inconsistent and messy. 6 | 7 | -\documentclass[a4paper, landscape, 10pt]{article} % for A4 size paper 8 | -%\documentclass[letter, landscape, 10pt]{article} % for letter size paper 9 | +%\documentclass[a4paper, landscape, 10pt]{article} % for A4 size paper 10 | +\documentclass[letter, landscape, 10pt]{article} % for letter size paper 11 | 12 | % without using the hyperref package, the result is not in landscape for me 13 | \usepackage[ 14 | -------------------------------------------------------------------------------- /asciitable/build_ascii.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Replace characters in ascii.tex with the data from latin1_symbols.txt 3 | 4 | If you were to change the information in the latin1_symbols.txt to 5 | something that is appropriate to another codepage, you could very easily 6 | create an ascii table for that codepage just by running this program. 7 | 8 | This program will save its result in ascii_out.tex 9 | """ 10 | 11 | import re 12 | 13 | ascii_file = "ascii.tex" 14 | char_file = "latin1_symbols.txt" 15 | 16 | ascii_fh = open(ascii_file) 17 | out_fh = open("ascii_out.tex", "w") 18 | char_fh = open(char_file) 19 | 20 | chars = {} # dict for code point -> latex expression 21 | 22 | char_line_pattern = re.compile(r'^([0-9]{1,})\s+(\S.*)$') 23 | ascii_line_pattern = re.compile( 24 | r'^\s*([0-9]{1,})\\textit\{d\}.*(&\s*\S.*\\\\)\s*$' 25 | # e.g. 26 | # 128\textit{d} & 80\textit{h} & ~ & x \\ 27 | ) 28 | 29 | # build chars data structure 30 | for (i, line) in enumerate(char_fh): 31 | cl_match = char_line_pattern.match(line) 32 | if cl_match: 33 | chars[cl_match.group(1)] = cl_match.group(2) 34 | else: 35 | print("Can't understand line %i in char file" % i) 36 | 37 | # go through ascii.tex and insert data 38 | for (i, line) in enumerate(ascii_fh): 39 | al_match = ascii_line_pattern.match(line) 40 | if al_match: 41 | try: 42 | replacement = "& %s \\\\" % chars[al_match.group(1)] 43 | line = line.replace(al_match.group(2), replacement) 44 | print( 45 | "Made replacement of '%s' with '%s' in line %i" 46 | % (al_match.group(2), replacement, i) 47 | ) 48 | except KeyError: 49 | print("No replacement found in line %i" % i) 50 | else: 51 | print("Left line %i unchanged" % i) 52 | out_fh.write(line) 53 | 54 | ascii_fh.close() 55 | out_fh.close() 56 | char_fh.close() 57 | -------------------------------------------------------------------------------- /asciitable/latin1_symbols.txt: -------------------------------------------------------------------------------- 1 | 128 \texteuro 2 | 129 ~ 3 | 130 \quotesinglbase 4 | 131 \textit{f} 5 | 132 \quotedblbase 6 | 133 \dots 7 | 134 \dag 8 | 135 \ddag 9 | 136 \textasciicircum 10 | 137 \textperthousand 11 | 138 \v{S} 12 | 139 \guilsinglleft 13 | 140 \OE 14 | 141 ~ 15 | 142 \v{Z} 16 | 143 ~ 17 | 144 ~ 18 | 145 ` 19 | 146 ' 20 | 147 `` 21 | 148 '' 22 | 149 \textbullet 23 | 150 -- 24 | 151 --- 25 | 152 \textasciitilde 26 | 153 \texttrademark 27 | 154 \v{s} 28 | 155 \guilsinglright 29 | 156 \oe 30 | 157 ~ 31 | 158 \v{z} 32 | 159 \"{Y} 33 | 160 \NBSP 34 | 161 !` 35 | 162 \textcent 36 | 163 \pounds 37 | 164 \textcurrency 38 | 165 \textyen 39 | 166 \textbrokenbar 40 | 167 \S 41 | 168 \textasciidieresis 42 | 169 \textcopyright 43 | 170 \textordfeminine 44 | 171 \guillemotleft 45 | 172 \textlnot 46 | 173 \- 47 | 174 \textregistered 48 | 175 \textasciimacron 49 | 176 \textdegree 50 | 177 \textpm 51 | 178 \texttwosuperior 52 | 179 \textthreesuperior 53 | 180 \textasciiacute 54 | 181 \textmu 55 | 182 \P 56 | 183 \textperiodcentered 57 | 184 \c{} 58 | 185 \textonesuperior 59 | 186 \textordmasculine 60 | 187 \guillemotright 61 | 188 \textonequarter 62 | 189 \textonehalf 63 | 190 \textthreequarters 64 | 191 ?` 65 | 192 \`{A} 66 | 193 \'{A} 67 | 194 \^{A} 68 | 195 \~{A} 69 | 196 \"{A} 70 | 197 \AA 71 | 198 \AE 72 | 199 \c{C} 73 | 200 \`{E} 74 | 201 \'{E} 75 | 202 \^{E} 76 | 203 \"{E} 77 | 204 \`{I} 78 | 205 \'{I} 79 | 206 \^{I} 80 | 207 \"{I} 81 | 208 \DH 82 | 209 \~{N} 83 | 210 \`{O} 84 | 211 \'{O} 85 | 212 \^{O} 86 | 213 \~{O} 87 | 214 \"{O} 88 | 215 \texttimes 89 | 216 \O 90 | 217 \`{U} 91 | 218 \'{U} 92 | 219 \^{U} 93 | 220 \"{U} 94 | 221 \'{Y} 95 | 222 \TH 96 | 223 \ss 97 | 224 \`{a} 98 | 225 \'{a} 99 | 226 \^{a} 100 | 227 \~{a} 101 | 228 \"{a} 102 | 229 \aa 103 | 230 \ae 104 | 231 \c{c} 105 | 232 \`{e} 106 | 233 \'{e} 107 | 234 \^{e} 108 | 235 \"{e} 109 | 236 \`{i} 110 | 237 \'{i} 111 | 238 \^{i} 112 | 239 \"{i} 113 | 240 \dh 114 | 241 \~{n} 115 | 242 \`{o} 116 | 243 \'{o} 117 | 244 \^{o} 118 | 245 \~{o} 119 | 246 \"{o} 120 | 247 \textdiv 121 | 248 \o 122 | 249 \`{u} 123 | 250 \'{u} 124 | 251 \^{u} 125 | 252 \"{u} 126 | 253 \'{y} 127 | 254 \th 128 | 255 \"{y} 129 | -------------------------------------------------------------------------------- /conda/.gitignore: -------------------------------------------------------------------------------- 1 | /conda-a4.aux 2 | /conda-a4.log 3 | /conda-a4.out 4 | /conda-a4.pdf 5 | /conda-cheatsheet.pdf 6 | /conda-letter.aux 7 | /conda-letter.log 8 | /conda-letter.out 9 | /conda-letter.pdf 10 | -------------------------------------------------------------------------------- /conda/Makefile: -------------------------------------------------------------------------------- 1 | all: conda-a4.pdf conda-letter.pdf 2 | 3 | conda-a4.pdf: conda-a4.tex conda-cheatsheet.pdf 4 | pdflatex conda-a4.tex 5 | 6 | conda-letter.pdf: conda-letter.tex conda-cheatsheet.pdf 7 | pdflatex conda-letter.tex 8 | 9 | conda-cheatsheet.pdf: 10 | wget https://conda.io/docs/_downloads/conda-cheatsheet.pdf 11 | 12 | clean: 13 | rm -f conda-a4.out 14 | rm -f conda-a4.log 15 | rm -f conda-a4.aux 16 | rm -f conda-letter.out 17 | rm -f conda-letter.log 18 | rm -f conda-letter.aux 19 | 20 | distclean: clean 21 | rm -f conda-a4.pdf 22 | rm -f conda-letter.pdf 23 | rm -f conda-cheatsheet.pdf 24 | 25 | .PHONY: all clean distclean 26 | -------------------------------------------------------------------------------- /conda/conda-a4.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} % for A4 size paper 2 | \usepackage[a4paper,margin=8mm]{geometry} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{pdfpages} 5 | \usepackage{hyperref} 6 | \hypersetup{% 7 | unicode=true, 8 | pdfpagelabels=true, 9 | pdftitle={Conda cheat sheet}, 10 | pdfauthor={Continuum Analytics}, 11 | } 12 | 13 | \begin{document} 14 | \thispagestyle{empty} 15 | \includepdf[pages={1-2},nup=1x2,landscape=true,noautoscale,height=210mm]{conda-cheatsheet.pdf} 16 | \end{document} 17 | -------------------------------------------------------------------------------- /conda/conda-letter.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage[letterpaper,margin=0cm]{geometry} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{pdfpages} 5 | \usepackage{hyperref} 6 | \hypersetup{% 7 | unicode=true, 8 | pdfpagelabels=true, 9 | pdftitle={Conda cheat sheet}, 10 | pdfauthor={Continuum Analytics}, 11 | } 12 | 13 | \begin{document} 14 | \thispagestyle{empty} 15 | \includepdf[pages={1-2},nup=1x2,landscape=true,noautoscale,height=216mm]{conda-cheatsheet.pdf} 16 | \end{document} 17 | -------------------------------------------------------------------------------- /fortran/.gitignore: -------------------------------------------------------------------------------- 1 | /fortran_refcard.aux 2 | /fortran_refcard.log 3 | /fortran_refcard.out 4 | /fortran_refcard_a4.pdf 5 | /fortran_refcard_letter.aux 6 | /fortran_refcard_letter.log 7 | /fortran_refcard_letter.out 8 | /fortran_refcard_letter.pdf 9 | /fortran_refcard_letter.tex 10 | -------------------------------------------------------------------------------- /fortran/Makefile: -------------------------------------------------------------------------------- 1 | all: fortran_refcard_a4.pdf fortran_refcard_letter.pdf 2 | 3 | fortran_refcard_a4.pdf: fortran_refcard.tex 4 | pdflatex $< 5 | mv fortran_refcard.pdf $@ 6 | 7 | fortran_refcard_letter.pdf: fortran_refcard_letter.tex 8 | pdflatex $< 9 | 10 | fortran_refcard_letter.tex: fortran_refcard.tex fortran_refcard_letter.patch 11 | cp $< $@ 12 | patch $@ fortran_refcard_letter.patch 13 | 14 | clean: 15 | rm -f *.out 16 | rm -f *.log 17 | rm -f *.aux 18 | 19 | distclean: clean 20 | rm -f fortran_refcard_letter.tex 21 | rm -f *.pdf 22 | 23 | .PHONY: all clean distclean 24 | -------------------------------------------------------------------------------- /fortran/fortran_refcard.tex: -------------------------------------------------------------------------------- 1 | \documentclass[8pt]{extarticle} % extarticle: font sizes < 10 2 | 3 | \usepackage[ 4 | pdftitle={Modern Fortran Reference Card}, 5 | pdfauthor={Michael Goerz}, 6 | pdfkeywords={Fortran 90, Fortran 95, Fortran 2003, Fortran 2008, Quick Reference, Refcard, Cheat Sheet}, 7 | pdfsubject={Quick Reference Card for Fortran 90/95/2003/2008} 8 | ]{hyperref} 9 | 10 | \usepackage{refcards} 11 | 12 | \usepackage{vmargin} 13 | % A4 14 | \setpapersize[landscape]{A4} 15 | \setmarginsrb% 16 | {1.5cm} % left 17 | {1.0cm} % top 18 | {1.5cm} % right 19 | {1.0cm} % bottom 20 | {0ex} % header height 21 | {0ex} % header separation 22 | {0ex} % footer height 23 | {0ex} % footser separation 24 | \setlength\columnsep{7mm} 25 | 26 | % Letter 27 | %\setpapersize[landscape]{USletter} 28 | %\setmarginsrb% 29 | %{1.1cm} % left 30 | %{1.1cm} % top 31 | %{0.9cm} % right 32 | %{0.9cm} % bottom 33 | %{0ex} % header height 34 | %{0ex} % header separation 35 | %{0ex} % footer height 36 | %{0ex} % footser separation 37 | %\setlength\columnsep{4mm} 38 | 39 | \begin{document} 40 | \raggedright 41 | 42 | \begin{multicols}{3} 43 | 44 | \title{Modern Fortran Reference Card} 45 | 46 | {\small 47 | (c) 2014 Michael Goerz \url{}\\ 48 | \url{http://www.michaelgoerz.net} 49 | 50 | This work is licensed under the Creative Commons Attribution-Noncommercial-Share 51 | Alike 3.0 License. To view a copy of this license, visit 52 | \url{http://creativecommons.org/licenses/by-nc-sa/} 53 | } 54 | 55 | \vspace*{1pt} 56 | 57 | \section{Data Types} 58 | 59 | \vspace{1ex} 60 | \subsection{Simple Data Types} 61 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 62 | \tt integer(\itt{specs})\itt{[,attrs]}~::~i & integer \\ 63 | \end{tabular} 64 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 65 | \tt real(\itt{specs})\itt{[,attrs]}~::~r & real number \\ 66 | \tt complex(\itt{specs})\itt{[,attrs]}~::~z & complex number \\ 67 | \tt logical(\itt{specs})\itt{[,attrs]}~::~b & boolean variable \\ 68 | \tt character(\itt{specs})\itt{[,attrs]}~::~s & string \\ 69 | \tt real, parameter~::\ c = 2.9e1 & constant declaration \\ 70 | \tt real(idp)~::~d;~d~=~1.0d0 & double precision real \\ 71 | \tt s2=s(2:5);~s2=s(:5);~s2=s(5:) & substring extraction 72 | \end{tabular} 73 | 74 | \textbf{attributes:} {\tt parameter, pointer, target, allocatable, \\ 75 | dimension, public, private, intent, optional, save, external, intrinsic} 76 | 77 | \textbf{specs:} {\tt kind=\dots}, \textbf{for character:} {\tt len=\dots} 78 | 79 | \vspace*{1ex} 80 | double precision: {\tt integer,~parameter~::~idp~=~kind(1.0d0)} 81 | 82 | \vspace*{1ex} 83 | \subsection{Derived Data Types} 84 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 85 | \tt type person\_t & define derived data type \\ 86 | \tt ~~character(len=10)~::~name & \\ 87 | \tt ~~integer~::~age & \\ 88 | \tt end~type~person\_t & \\ 89 | \tt type group\_t & \\ 90 | \tt ~~type(person\_t),allocatable~\& & \textit{F2008}: allocatable \dots \\ 91 | \tt ~~\&~::~members(:) & \dots components \\ 92 | \tt end type group\_t & \\ 93 | \tt name~=~group\%members(1)\%name & access structure component 94 | \end{tabular} 95 | 96 | \vspace*{1ex} 97 | \subsection{Arrays and Matrices} 98 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 99 | \tt real~::~v(5) & explicit array, index 1..5 \\ 100 | \tt real~::~a(-1:1,3) & 2D array, index -1..1, 1..3 \\ 101 | \tt real,~allocatable~::~a(:) & ``deferred shape'' array \\ 102 | \tt a=(/1.2,b(2:6,:),3.5/) & array constructor \\ 103 | \tt v~=~1/v~+~a(1:5,5) & array expression \\ 104 | \tt allocate(a(5),b(2:4),stat=e) & array allocation \\ 105 | \tt dealloate(a,b) & array de-allocation 106 | \end{tabular} 107 | 108 | \vspace*{1ex} 109 | \subsection{Pointers} 110 | \vspace*{-10pt}\hspace{2cm} (avoid!) 111 | 112 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 113 | \tt real,~pointer~::~p & declare pointer \\ 114 | \tt real,~pointer~::~a(:) & ``deferred shape'' array \\ 115 | \tt real,~target~::~r & define target \\ 116 | \tt p~=>~r & set pointer p to r \\ 117 | \tt associated(p,~\itt{[target]}) & pointer assoc.\ with target? \\ 118 | \tt nullify(p) & associate pointer with NUL 119 | \end{tabular} 120 | 121 | \vspace*{1ex} 122 | \subsection{Operators} 123 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 124 | \tt .lt.~.le.~.eq.~.ne.~.gt.~.ge. & relational operators \\ 125 | \tt ~<~~~~<=~~~==~~~/=~~~>~~~~>= & relational op aliases \\ 126 | \tt .not.\ .and.\ .or.\ .eqv.\ .neqv. & logical operators \\ 127 | \tt x**(-y) & exponentiation \\ 128 | \tt 'AB'//'CD' & string concatenation 129 | \end{tabular} 130 | 131 | \section{Control Constructs} 132 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 133 | \tt \textbf{if}~(\dots)~\itt{action} & if statement \\ 134 | \tt \textbf{if}~(\dots)~then & if-construct \\ 135 | \tt ~~\itt{block} & \\ 136 | \tt else~if~(\dots)~then;~\itt{block} & \\ 137 | \tt else;~\itt{block} & \\ 138 | \tt end~if & \\ 139 | \tt \textbf{select case}~(number) & select-construct \\ 140 | \tt ~~case~(:0) & everything up to 0 (incl.) \\ 141 | \tt ~~~~\itt{block} & \\ 142 | \tt ~~case~(1:2); \itt{block} & number is 1 or 2 \\ 143 | \tt ~~case~(3); \itt{block} & number is 3 \\ 144 | \tt ~~case~(4:); \itt{block} & everything up from 4 (incl.)\\ 145 | \tt ~~case~default; \itt{block} & fall-through case \\ 146 | \tt end~select & \\ 147 | \tt outer:~\textbf{do} & controlled do-loop \\ 148 | \tt ~~inner:~do~i=from,to,step & counter do-loop \\ 149 | \tt ~~~~if~(\dots)~cycle inner & next iteration \\ 150 | \tt ~~~~if~(\dots)~exit outer & exit from named loop \\ 151 | \tt ~~end~do~inner & \\ 152 | \tt end~do~outer & \\ 153 | \tt \textbf{do while}~(\dots);\itt{block};end do & do-while loop \\ 154 | \end{tabular} 155 | 156 | \section{Program Structure} 157 | 158 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 159 | \tt \textbf{program}~myprog & main program \\ 160 | \tt ~~use~foo,~lname~=>~usename & used module, with rename \\ 161 | \tt ~~use~foo2,~only:~\itt{[only-list]} & selective use \\ 162 | \tt ~~implicit~none & require variable declaration \\ 163 | \tt ~~interface;\dots;end interface & explicit interfaces \\ 164 | \tt ~~\itt{specification-statements} & var/type declarations etc. \\ 165 | \tt ~~\itt{exec-statements} & statements \\ 166 | \tt ~~stop~'message' & terminate program \\ 167 | \tt contains & \\ 168 | \tt ~~\itt{internal-subprograms} & subroutines, functions \\ 169 | \tt end~program~myprog & 170 | \end{tabular} 171 | 172 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 173 | \tt \textbf{module}~foo & module \\ 174 | \tt ~~use~bar & used module \\ 175 | \tt ~~public~::~f1,~f2,~\dots & list public subroutines \\ 176 | \tt ~~private & make private by default \\ 177 | \tt ~~interface;\dots;end interface & explicit interfaces \\ 178 | \tt ~~\itt{specification~statements} & var/type declarations, etc. \\ 179 | \tt contains & \\ 180 | \tt ~~\itt{internal-subprograms} & ``module subprograms'' \\ 181 | \tt end~module~foo & 182 | \end{tabular} 183 | 184 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 185 | \tt \textbf{function}~f(a,g) result r & function definition \\ 186 | \tt ~~real,~intent(in)~::~a & input parameter \\ 187 | \tt ~~real~::~r & return type \\ 188 | \tt ~~interface & explicit interface block \\ 189 | \tt ~~~~real~function~g(x) & dummy var {\tt g} is function \\ 190 | \tt ~~~~~~real,~intent(in)~::~x & \\ 191 | \tt ~~~~end~function~g & \\ 192 | \tt ~~end~interface & \\ 193 | \tt ~~r = g(a) & function call \\ 194 | \tt end~function~f & 195 | \end{tabular} 196 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 197 | \tt recursive~function f(x)~\dots & allow~recursion \\ 198 | \tt elemental~function f(x)~\dots & work on args of any rank 199 | \end{tabular} 200 | 201 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 202 | \tt \textbf{subroutine}~s(n,i,j,a,b,c,d,r,e) & subroutine definition \\ 203 | \tt ~~integer,~intent(in)~::~n & read-only dummy variable \\ 204 | \tt ~~integer,~intent(inout)~::~i & read-write dummy variable \\ 205 | \tt ~~integer,~intent(out)~::~j & write-only dummy variable \\ 206 | \tt ~~real(idp)~::~a(n) & explicit shape dummy array \\ 207 | \tt ~~real(idp) ::~b(2:,:) & assumed shape dummy array \\ 208 | \tt ~~real(idp) ::~c(10,*) & assumed size dummy array \\ 209 | \tt ~~real,~allocatable~::~d(:) & deferred shape (\textit{F2008}) \\ 210 | \tt ~~character(len=*)~::~r & assumed length string \\ 211 | \tt ~~integer,~optional~::~e & optional dummy variable \\ 212 | \tt ~~integer~::~m~=~1 & same as {\tt integer,save::m=1} \\ 213 | \tt ~~if~(present(e))~... & presence check \\ 214 | \tt ~~return & forced exit \\ 215 | \tt end~subroutine~s & 216 | \end{tabular} 217 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 218 | \tt call~s(1,i,j,a,b,c,d,e=1,r="s") & subroutine call 219 | \end{tabular} 220 | Notes:\\ 221 | \textbullet{} explicit shape allows for reshaping trick (no copies!):\\ 222 | \hspace*{1em}you can pass array of any dim/shape, but matching size.\\ 223 | \textbullet{} assumed shape ignores lbounds/ubounds of actual argument \\ 224 | \textbullet{} deferred shape keeps lbounds/ubounds of actual argument \\ 225 | \textbullet{} subroutines/functions may be declared as {\tt pure} (no side effects) 226 | 227 | \vspace{1ex} 228 | \textbf{Use of interfaces:} \\ 229 | \textbullet{} \textit{explicit interface} for external or dummy procedures\\ 230 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 231 | \tt interface & \\ 232 | \tt ~~\itt{interface~body} & sub/function specs \\ 233 | \tt end~interface & \\ 234 | \end{tabular} 235 | \textbullet{} \textit{generic/operator/conversion interface} \\ 236 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 237 | \tt interface~\itt{generic-spec} & \\ 238 | \tt ~~module~procedure~\itt{list} & internal subs/functions \\ 239 | \tt end~interface & \\ 240 | \end{tabular}\vspace*{0.5ex} 241 | 242 | \itt{generic-spec} can be any of the following:\vspace*{0.5ex} 243 | 244 | 1. ``generic name'', for overloading routines \\ 245 | 2. operator name ({\tt + -}, etc) for defining ops on derived types \\ 246 | \hspace*{1em} You can also define new operators names, e.g.\ {\tt .cross.}\\ 247 | \hspace*{1em} Procedures must be one- or two-argument functions.\\ 248 | 3. {\tt assignment (=)} for defining assignments for derived types. \\ 249 | \hspace*{1em} Procedures must be two-argument subroutines. 250 | 251 | \vspace{1ex} 252 | The \itt{generic-spec} interfaces should be used inside of a module; 253 | otherwise, use full sub/function specs instead of module procedure list. 254 | 255 | \section{Intrinsic Procedures} 256 | 257 | \subsection{Transfer and Conversion Functions} 258 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 259 | \tt abs(a) & absolute value \\ 260 | \tt aimag(z) & imag.\ part of complex z \\ 261 | \tt aint(x,~kind),~anint(x,~kind) & to whole number real \\ 262 | \tt dble(a) & to double precision \\ 263 | \tt cmplx(x,~y,~kind) & create {\tt x +} $i$ {\tt y} \\ 264 | \tt cmplx(x,~kind=idp) & real to dp complex\\ 265 | \tt int(a,~kind),~nint(a,~kind) & to int (truncated/rounded) \\ 266 | \tt real(x,~kind) & to real (i.e.\ real part) \\ 267 | \tt char(i,~kind),~achar(i) & char of ASCII code \\ 268 | \tt ichar(c),~iachar(c) & ASCII code of character \\ 269 | \tt logical(l,~kind) & change kind of logical {\tt l} \\ 270 | \tt ibits(i,~pos,~len) & extract sequence of bits \\ 271 | \tt transfer(source,~mold,~size) & reinterpret data 272 | \end{tabular} 273 | 274 | \subsection{Arrays and Matrices} 275 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 276 | \tt allocated(a) & check if array is allocated \\ 277 | \tt lbound(a,dim) & lowest index in array \\ 278 | \tt ubound(a,dim) & highest index in array \\ 279 | \tt shape(a) & shape (dimensions) of array \\ 280 | \tt size(array,dim) & extent of array along dim \\ 281 | \tt all(mask,dim) & all {\tt .true.} in logical array?\\ 282 | \tt any(mask,dim) & any {\tt .true.} in logical array?\\ 283 | \tt count(mask,dim) & number of true elements \\ 284 | \tt maxval(a,d,m) & max value in masked array \\ 285 | \tt minval(a,d,m) & min value in masked array \\ 286 | \tt product(a,dim,mask) & product along masked dim \\ 287 | \tt sum(array,dim,mask) & sum along masked dim \\ 288 | \tt merge(tsrc,fsrc,mask) & combine arrays as mask says \\ 289 | \tt pack(array,mask,vector) & packs masked array into vect. \\ 290 | \tt unpack(vect,mask,field) & unpack {\tt vect} into masked field \\ 291 | \tt spread(source,dim,n) & extend source array into dim. \\ 292 | \tt reshape(src,shp,pad,ord) & make array of shape from src \\ 293 | \tt cshift(a,s,d) & circular shift \\ 294 | \tt eoshift(a,s,b,d) & ``end-off'' shift \\ 295 | \tt transpose(matrix) & transpose a matrix \\ 296 | \tt maxloc(a,mask) & find pos of max in array \\ 297 | \tt minloc(a,mask) & find pos of min in array 298 | \end{tabular} 299 | 300 | \vspace{1ex} 301 | \subsection{Computation Functions} 302 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 303 | \tt ceiling(a),~floor(a) & to next higher/lower int \\ 304 | \tt conjg(z) & complex conjugate \\ 305 | \tt dim(x,y) & max(x-y, 0) \\ 306 | \tt max(a1,a2,..),~min(a1,..) & maximum/minimum \\ 307 | \tt dprod(a,b) & dp product of sp a, b \\ 308 | \tt mod(a,p) & a mod p \\ 309 | \tt modulo(a,p) & modulo with sign of a/p \\ 310 | \tt sign(a,b) & make sign of a = sign of b \\ 311 | \tt matmul(m1,m2) & matrix multiplication \\ 312 | \tt dot\_product(a,b) & dot product of vectors 313 | \end{tabular} 314 | \textbf{more:} {\tt sin, cos, tan, acos, asin, atan, atan2, \\ 315 | sinh, cosh, tanh, exp, log, log10, sqrt} 316 | 317 | \vspace{1ex} 318 | \subsection{Numeric Inquiry and Manipulation Functions} 319 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 320 | \tt kind(x) & kind-parameter of variable {\tt x} \\ 321 | \tt digits(x) & significant digits in model \\ 322 | \tt bit\_size(i) & no.\ of bits for int in model \\ 323 | \tt epsilon(x) & small pos. number in model \\ 324 | \tt huge(x) & largest number in model \\ 325 | \tt minexponent(x) & smallest exponent in model \\ 326 | \tt maxexponent(x) & largest exponent in model \\ 327 | \tt precision(x) & decimal precision for reals in \\ 328 | \tt radix(x) & base of the model \\ 329 | \tt range(x) & dec. exponent range in model \\ 330 | \tt tiny(x) & smallest positive number \\ 331 | \tt exponent(x) & exponent part of x in model \\ 332 | \tt fraction(x) & fractional part of x in model \\ 333 | \tt nearest(x) & nearest machine number \\ 334 | \tt rrspacing(x) & reciprocal of relative spacing \\ 335 | \tt scale(x,i) & \tt x b**i \\ 336 | \tt set\_exponent(x,i) & \tt x b**(i-e) \\ 337 | \tt spacing(x) & absolute spacing of model 338 | \end{tabular} 339 | 340 | 341 | 342 | \subsection{String Functions} 343 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 344 | \tt lge(s1,s2),~lgt,~lle,~llt & string comparison \\ 345 | \tt adjustl(s), adjustr(s) & left- or right-justify string \\ 346 | \tt index(s,sub,from\_back) & find substr. in string (or 0) \\ 347 | \tt trim(s) & s without trailing blanks \\ 348 | \tt len\_trim(s) & length of {\tt trim(s)} \\ 349 | \tt scan(s,setd,from\_back) & search for any char in set \\ 350 | \tt verify(s,set,from\_back) & check for presence of set-chars \\ 351 | \tt len(string) & length of string \\ 352 | \tt repeat(string,n) & concat n copies of string 353 | \end{tabular} 354 | 355 | 356 | \subsection{Bit Functions} 357 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 358 | \tt btest(i,pos) & test bit of integer value \\ 359 | \tt iand(i,j),ieor(i,j),ior(i,j) & and, xor, or of bit in 2 integers \\ 360 | \tt ibclr(i,pos),ibset(i,pos) & set bit of integer to 0 / 1 \\ 361 | \tt ishft(i,sh),ishftc(i,sh,s) & shift bits in i \\ 362 | \tt not(i) & bit-reverse integer 363 | \end{tabular} 364 | 365 | \subsection{Misc Intrinsic Subroutines} 366 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 367 | \tt date\_and\_time(d,t,z,v) & put current time in {\tt d,t,z,v} \\ 368 | \tt mvbits(f,fpos,len,t,tpos) & copy bits between int vars \\ 369 | \tt random\_number(harvest) & fill harvest randomly \\ 370 | \tt random\_seed(size,put,get) & restart/query random generator \\ 371 | \tt system\_clock(c,cr,cm) & get processor clock info 372 | \end{tabular} 373 | 374 | 375 | \section{Input/Output} 376 | 377 | \subsection{Format Statements} 378 | \begin{tabular}{L{0.5\linewidth} L{0.5\linewidth}} 379 | \tt fmt~=~"(F10.3,A,ES14.7)" & format string \\ 380 | \tt I\itt{w}~I\itt{w}.\itt{m} & integer form \\ 381 | \tt B\itt{w}.\itt{m} O\itt{w}.\itt{m} Z\itt{w}.\itt{m} & binary, octal, hex integer form \\ 382 | \tt F\itt{w}.\itt{d} & decimal form real format \\ 383 | \tt E\itt{w}.\itt{d} & exponential form ({\tt 0.12E-11}) \\ 384 | \tt E\itt{w}.\itt{d}E\itt{e} & specified exponent length \\ 385 | \tt ES\itt{w}.\itt{d}~ES\itt{w}.\itt{d}E\itt{e} & scientific form ({\tt 1.2E-10}) \\ 386 | \tt EN\itt{w}.\itt{d}~EN\itt{w}.\itt{d}E\itt{e} & engineer. form ({\tt 123.4E-12}) \\ 387 | \tt G\itt{w}.\itt{d} & generalized form \\ 388 | \tt G\itt{w}.\itt{d}E\itt{e} & generalized exponent form \\ 389 | \tt L\itt{w} & logical format ({\tt T, F}) \\ 390 | \tt A~A\itt{w} & characters format \\ 391 | \tt nX & horizontal positioning (skip) \\ 392 | \tt T\itt{c} TL\itt{c} TR\itt{c} & move (absolute, left, right) \\ 393 | \tt \itt{r}/ & vert. positioning (skip lines) \\ 394 | \tt \itt{r}(...) & grouping / repetition \\ 395 | \tt : & format scanning control \\ 396 | \tt S~SP~SS & sign control \\ 397 | \tt BN~BZ & blank control (blanks as zeros) 398 | \end{tabular} 399 | 400 | \vspace{1ex} 401 | \itt{w} full length, 402 | \itt{m} minimum digits, 403 | \itt{d} dec.\ places, 404 | \itt{e} exponent length, 405 | \itt{n} positions to skip, 406 | \itt{c} positions to move, 407 | \itt{r} repetitions 408 | 409 | \vspace{1ex} 410 | \subsection{Argument Processing / OS Interaction} 411 | \begin{verbatim} 412 | n = command_argument_count() 413 | call get_command_argument(2, value) ! get 2nd arg 414 | call get_environment_variable(name, & 415 | & value, length, status, trim_name) ! optional 416 | call execute_command_line(command, & 417 | & wait, exitstat, cmdstat, cmdmsg) ! optional 418 | \end{verbatim} 419 | 420 | \vspace{-2ex} 421 | These are part of \textit{F2003}/\textit{F2008}. Older Fortran compilers might 422 | have vendor extensions: {\tt iargc, getarg, getenv, system} 423 | 424 | \subsection{Reading and Writing to Files} 425 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 426 | \tt print~'(I10)',~2 & print to stdout with format \\ 427 | \tt print~*,~"Hello~World" & list-directed I/O (stdout)\\ 428 | \tt write(*,*)~"Hello~World" & list-directed I/O (stdout)\\ 429 | \tt write(unit,~fmt,~spec)~list & write list to unit \\ 430 | \tt read(unit,~fmt,~spec)~list & read list from unit \\ 431 | \tt open(unit,~specifiers) & open file \\ 432 | \tt close(unit,~specifiers) & close file \\ 433 | \tt inquire(unit,~spec) & inquiry by unit \\ 434 | \tt inquire(file=filename,~spec) & inquiry by filename \\ 435 | \tt inquire(iolength=iol)~outlist & inquiry by output item list \\ 436 | \tt backspace(unit,~spec) & go back one record \\ 437 | \tt endfile(unit,~spec) & write eof record \\ 438 | \tt rewind(unit,~spec) & jump to beginning of file 439 | \end{tabular} 440 | 441 | 442 | \subsection{I/O Specifiers} 443 | \vspace*{-10pt}\hspace{2.5cm} ({\tt open} statement) 444 | 445 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 446 | \tt iostat=error & save int error code to {\tt error}\\ 447 | \tt err=label & label to jump to on error \\ 448 | \tt file='filename' & name of file to open \\ 449 | \tt status='old'~'new'~'replace' & status of input file \\ 450 | \tt ~~~~~~~'scratch'~'unknown' & \\ 451 | \tt access='sequential'~'direct' & access method \\ 452 | \tt form='formatted'~'unformatted' & formatted/unformatted I/O \\ 453 | \tt recl=integer & length of record \\ 454 | \tt blank='null'~'zero' & ignore blanks/treat as 0 \\ 455 | \tt position='asis' 'rewind' & position, if sequential I/O \\ 456 | \tt ~~~~~~~~~'append' & \\ 457 | \tt action='read'~'write' & read/write mode \\ 458 | \tt ~~~~~~~'readwrite' & \\ 459 | \tt delim='quote'~'apostrophe'~ & delimiter for char constants \\ 460 | \tt ~~~~~~'none' & \\ 461 | \tt pad='yes' 'no' & pad with blanks \\ 462 | \end{tabular} 463 | \textbf{close-specifiers:} {\tt iostat, err, status='keep' 'delete'}\\ 464 | \textbf{inquire-specifiers:} {\tt access, action, blank, delim, direct, 465 | exist, form, formatted, iostat, name, named, nextrec, number, opened, pad, 466 | position, read, readwrite, recl, sequential, unformatted, write, iolength}\\ 467 | \textbf{backspace-, endfile-, rewind-specifiers:} {\tt iostat, err} 468 | 469 | \vspace{1ex} 470 | \subsection{Data Transfer Specifiers} 471 | \begin{tabular}{L{0.55\linewidth} L{0.45\linewidth}} 472 | \tt iostat=error & save int error code to {\tt error}\\ 473 | \tt advance='yes'~'no' & new line? \\ 474 | \tt err=label & label to jump to on error \\ 475 | \tt end=label & label to jump to on EOF\\ 476 | \tt eor=label & label for end of record \\ 477 | \tt rec=integer & record number to read/write \\ 478 | \tt size=integer-variable & number of characters read 479 | \end{tabular} 480 | 481 | \vspace*{3ex} 482 | \vfill 483 | 484 | For a complete reference, see: \\ 485 | $\Rightarrow$ 486 | Adams, Brainerd, Martin, Smith, Wagener,\\ 487 | \hspace*{1.2em} \textit{Fortran 90 Handbook}, Intertext Publications, 1992. \\ 488 | There are also editions for Fortran 95, and Fortran 2003. \\ 489 | For Fortran 2008 features, please consult: \\ 490 | $\Rightarrow$ 491 | Reid, \textit{The new features of Fortran 2008}.\\ 492 | \hspace*{1.2em} ACM Fortran Forum 27, 8 (2008).\\ 493 | $\Rightarrow$ 494 | Szymanski. Mistakes in Fortran that might surprise you:\\ 495 | \hspace*{1.2em} \url{http://t.co/SPa0Y5uB} 496 | 497 | 498 | \end{multicols} 499 | \end{document} 500 | -------------------------------------------------------------------------------- /fortran/fortran_refcard_letter.patch: -------------------------------------------------------------------------------- 1 | --- fortran_refcard.tex 2018-12-12 19:51:46.000000000 -0500 2 | +++ fortran_refcard_letter.tex 2018-12-13 12:55:24.000000000 -0500 3 | @@ -11,30 +11,30 @@ 4 | 5 | \usepackage{vmargin} 6 | % A4 7 | -\setpapersize[landscape]{A4} 8 | -\setmarginsrb% 9 | -{1.5cm} % left 10 | -{1.0cm} % top 11 | -{1.5cm} % right 12 | -{1.0cm} % bottom 13 | -{0ex} % header height 14 | -{0ex} % header separation 15 | -{0ex} % footer height 16 | -{0ex} % footser separation 17 | -\setlength\columnsep{7mm} 18 | - 19 | -% Letter 20 | -%\setpapersize[landscape]{USletter} 21 | +%\setpapersize[landscape]{A4} 22 | %\setmarginsrb% 23 | -%{1.1cm} % left 24 | -%{1.1cm} % top 25 | -%{0.9cm} % right 26 | -%{0.9cm} % bottom 27 | +%{1.5cm} % left 28 | +%{1.0cm} % top 29 | +%{1.5cm} % right 30 | +%{1.0cm} % bottom 31 | %{0ex} % header height 32 | %{0ex} % header separation 33 | %{0ex} % footer height 34 | %{0ex} % footser separation 35 | -%\setlength\columnsep{4mm} 36 | +%\setlength\columnsep{7mm} 37 | + 38 | +% Letter 39 | +\setpapersize[landscape]{USletter} 40 | +\setmarginsrb% 41 | +{1.1cm} % left 42 | +{1.1cm} % top 43 | +{0.9cm} % right 44 | +{0.9cm} % bottom 45 | +{0ex} % header height 46 | +{0ex} % header separation 47 | +{0ex} % footer height 48 | +{0ex} % footser separation 49 | +\setlength\columnsep{4mm} 50 | 51 | \begin{document} 52 | \raggedright 53 | -------------------------------------------------------------------------------- /fortran/refcards.sty: -------------------------------------------------------------------------------- 1 | \ProvidesPackage{refcards}[2014/04/01 Refcards] 2 | 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | % General font definitions 5 | % font definition from 2009/10/30 v1.6 Latin Modern Fonts 6 | 7 | \renewcommand{\rmdefault}{lmr} 8 | \renewcommand{\sfdefault}{lmss} 9 | \renewcommand{\ttdefault}{lmtt} 10 | 11 | % use lighttt 12 | \let\lmtt@use@light@as@normal\@empty 13 | 14 | \SetSymbolFont{operators} {normal}{OT1}{lmr} {m}{n} 15 | \SetSymbolFont{letters} {normal}{OML}{lmm} {m}{it} 16 | \SetSymbolFont{symbols} {normal}{OMS}{lmsy}{m}{n} 17 | \SetSymbolFont{largesymbols}{normal}{OMX}{lmex}{m}{n} 18 | \SetSymbolFont{operators} {bold} {OT1}{lmr} {bx}{n} 19 | \SetSymbolFont{letters} {bold} {OML}{lmm} {b}{it} 20 | \SetSymbolFont{symbols} {bold} {OMS}{lmsy}{b}{n} 21 | \SetSymbolFont{largesymbols}{bold} {OMX}{lmex}{m}{n} 22 | 23 | \SetMathAlphabet{\mathbf}{normal}{OT1}{lmr}{bx}{n} 24 | \SetMathAlphabet{\mathsf}{normal}{OT1}{lmss}{m}{n} 25 | \SetMathAlphabet{\mathit}{normal}{OT1}{lmr}{m}{it} 26 | \SetMathAlphabet{\mathtt}{normal}{OT1}{lmtt}{m}{n} 27 | \SetMathAlphabet{\mathbf}{bold} {OT1}{lmr}{bx}{n} 28 | \SetMathAlphabet{\mathsf}{bold} {OT1}{lmss}{bx}{n} 29 | \SetMathAlphabet{\mathit}{bold} {OT1}{lmr}{bx}{it} 30 | \SetMathAlphabet{\mathtt}{bold} {OT1}{lmtt}{m}{n} 31 | 32 | \def\mathsterling{\mathit{\mathchar"70BF}} 33 | 34 | \newcommand{\itt}[1]{{\fontshape{sl}\selectfont{}#1}} 35 | 36 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 37 | % Tabular with fixed tabcolumn width 38 | \usepackage{array} 39 | \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} 40 | \newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} 41 | \newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} 42 | 43 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 44 | % Formatting (font for sections, etc.) 45 | \usepackage{titlesec} 46 | \titlespacing*{\section}{0pt}{1ex}{0pt} 47 | \titleformat{\section} 48 | {\normalfont\sffamily\large\bfseries} 49 | {\thesection}{1em}{} 50 | \titlespacing*{\subsection}{0pt}{0pt}{0pt} 51 | \titleformat{\subsection} 52 | {\normalfont\sffamily\bfseries} 53 | {\thesubsection}{1em}{} 54 | 55 | \renewcommand{\title}[1]{{\normalfont\sffamily\huge\bfseries #1}\vspace{1ex}} 56 | 57 | \parindent=0pt 58 | \parskip=0pt 59 | \topsep=0pt 60 | \partopsep=0pt 61 | \pagestyle{empty} % no page number 62 | 63 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 64 | % Tight multicol formatting 65 | \usepackage{multicol} 66 | \setlength{\tabcolsep}{0pt} % horizontal padding in tables 67 | 68 | \usepackage[none]{hyphenat} 69 | \def\bs{$\backslash$} 70 | 71 | \endinput 72 | -------------------------------------------------------------------------------- /my_vim_mappings/.gitignore: -------------------------------------------------------------------------------- 1 | /my_vim_mappings.log 2 | /my_vim_mappings.pdf 3 | -------------------------------------------------------------------------------- /my_vim_mappings/Makefile: -------------------------------------------------------------------------------- 1 | my_vim_mappings.pdf: my_vim_mappings.tex 2 | pdftex my_vim_mappings.tex 3 | 4 | clean: 5 | rm -f my_vim_mappings.log 6 | 7 | distclean: clean 8 | rm -f my_vim_mappings.pdf 9 | 10 | .PHONY: all clean distclean 11 | -------------------------------------------------------------------------------- /my_vim_mappings/my_vim_mappings.tex: -------------------------------------------------------------------------------- 1 | % VIM Personal Keymappings 2 | % Copyright (c) 2010 Michael Goerz. 3 | % TeX Format 4 | 5 | % compile as 'pdftex vimqrc.tex' 6 | 7 | % \pdfoutput=1 8 | \pdfpageheight=21cm 9 | \pdfpagewidth=29.7cm 10 | 11 | % Font definitions 12 | \font\bigbf=cmbx12 13 | \font\smallrm=cmr8 14 | \font\smalltt=cmtt8 15 | \font\tinyit=cmmi5 16 | 17 | \def\title#1{\hfil{\bf #1}\hfil\par\vskip 2pt\hrule} 18 | \def\cm#1#2#3{{\it#1} {\tt#2 }\dotfill#3\par} 19 | \def\dcm#1#2#3#4#5{{\it#1} {\tt#2 } {\it#3} {\tt#4 }\dotfill#5\par} 20 | \def\cn#1{\hfill$\lfloor$ #1\par} 21 | \def\section#1{\vskip 0.7cm {\it#1\/}\par} 22 | 23 | % Characters definitions 24 | \def\\{\hfil\break} 25 | \def\backspace{$\leftarrow$} 26 | \def\ctrl{{\rm\char94}\kern-1pt} 27 | \def\enter{$\hookleftarrow$} 28 | \def\or{\thinspace{\tinyit{or}}\thinspace} 29 | \def\key#1{$\langle${\rm{\it#1\/}}$\rangle$} 30 | \def\rapos{\char125} 31 | \def\lapos{\char123} 32 | \def\bs{\char92} 33 | %\def\leader{\char92} 34 | \def\leader{} 35 | \def\locleader{} 36 | \def\ileader{\ctrl L} 37 | \def\tilde{\char126} 38 | \def\lbracket{[} 39 | \def\rbracket{]} 40 | 41 | % Three columns definitions 42 | \parindent 0pt 43 | \nopagenumbers 44 | \hoffset=-1.56cm 45 | \voffset=-1.54cm 46 | \newdimen\fullhsize 47 | \fullhsize=27.9cm 48 | \hsize=8.5cm 49 | \vsize=19cm 50 | \def\fullline{\hbox to\fullhsize} 51 | \let\lr=L 52 | \newbox\leftcolumn 53 | \newbox\midcolumn 54 | \output={ 55 | \if L\lr 56 | \global\setbox\leftcolumn=\columnbox 57 | \global\let\lr=M 58 | \else\if M\lr 59 | \global\setbox\midcolumn=\columnbox 60 | \global\let\lr=R 61 | \else 62 | \tripleformat 63 | \global\let\lr=L 64 | \fi\fi 65 | \ifnum\outputpenalty>-20000 66 | \else 67 | \dosupereject 68 | \fi} 69 | \def\tripleformat{ 70 | \shipout\vbox{\fullline{\box\leftcolumn\hfil\box\midcolumn\hfil\columnbox}} 71 | \advancepageno} 72 | \def\columnbox{\leftline{\pagebody}} 73 | 74 | % Card content 75 | % Header 76 | %\hrule\vskip 3pt 77 | \title{VIM PERSONAL MAPPINGS} 78 | 79 | \vskip 0.4cm 80 | (CC) 2012 Michael Goerz ({\tt www.michaelgoerz.net}) 81 | \vskip 0.4cm 82 | 83 | {\tt \leader}: {\tt ,} \hskip1cm {\tt \locleader}: {\tt \bs{}} 84 | 85 | \vskip -0.3cm 86 | 87 | \section{Misc} 88 | \cm{n:}{\leader{}t}{Show or hide Taglist} 89 | \dcm{n:}{\leader d}{i:}{\ileader d}{Insert date stamp} 90 | \dcm{n,v:}{\leader p}{i:}{\ileader p}{toggle paste} 91 | \cm{n,v:}{\leader{}s}{Send to b:sendToProgramName} 92 | \cm{i:}{\ctrl J}{Jump to next placeholder} 93 | \cm{n:}{\leader{}w}{Write current file} 94 | \cm{}{:SuperTabHelp}{Set behavior of Tab key} 95 | \cm{}{:Bclose}{Delete current buffer w/o closing window} 96 | \cm{}{:German}{activate spell checking in German} 97 | \cm{}{:English}{activate spell checking in English} 98 | \cm{}{:ManualFolding}{Activate folding, {\tt fdm=manual}} 99 | \cm{}{:Errors}{Open syntastic list of errors} 100 | \cm{}{:SyntasticCheck}{Manually cause syntastic check} 101 | \cm{n:}{\leader{}u}{Toggle Gundo window} 102 | \cm{}{:GundoToggle}{Toggle Gundo window} 103 | 104 | 105 | \section{Sudo} 106 | \cm{}{:e sudo:/etc/passwd}{Edit file with sudo perms} 107 | \cm{}{:w sudo:/etc/passwd}{Write file with sudo perms} 108 | \cm{}{:w sudo:\%}{Write current file with sudo permissions} 109 | 110 | 111 | \vskip -0.1cm 112 | \section{Filters} 113 | \cm{}{:ListFilters}{List filters for filetype} 114 | \cm{}{:'a,'b Filter}{Filter range} 115 | \cm{}{:Filter}{Filter entire file} 116 | \dcm{n:}{\leader{}f}{v:}{\ileader f}{{Filter entire file/selection}} 117 | 118 | 119 | \section{NerdCommenter} 120 | \cm{n:}{\leader{}cc}{comment line or selection} 121 | \cm{n:}{\leader{}cn}{comment line or selection (nested)} 122 | \cm{n:}{\leader{}c\$}{comment to end of line} 123 | \cm{n,v:}{\leader{}c}{toggle line or selection} 124 | \cm{n,v:}{\leader{}ci}{toggle individual lines} 125 | \cm{n,v:}{\leader{}cs}{``sexy'' commenting} 126 | \cm{n,v:}{\leader{}cu}{uncomment line or selection} 127 | \cm{i:}{\ctrl{}c}{Insert comment} 128 | 129 | 130 | \section{Git} 131 | \cm{}{:Git [args]}{Run git} 132 | \cm{n:}{\leader gd}{git diff} 133 | \cm{n:}{\leader gD}{git diff --cached} 134 | \cm{n:}{\leader gs}{git status} 135 | \cm{n:}{\leader gl}{git log} 136 | \cm{n:}{\leader gL}{git log --all --graph --decorate} 137 | \cm{n:}{\leader ga}{git add} 138 | \cm{n:}{\leader gc}{git commit} 139 | \cm{n:}{\leader gb}{git blame} 140 | 141 | 142 | \section{Snippets} 143 | \cm{}{:ListSnippets}{List snippets for filetype} 144 | \cm{}{:ApppendSnippet}{Append snippet after cursor} 145 | \cm{}{:InsertSnippet}{Insert snippet before cursor} 146 | \dcm{n:}{\leader{}ni}{i:}{\ileader ni}{{\tt :InsertSnippet}} 147 | \dcm{n:}{\leader{}na}{i:}{\ileader na}{{\tt :AppendSnippet}} 148 | 149 | 150 | \section{\TeX} 151 | \cm{}{:LatexFold}{Fold up LaTeX (fdm=manual)} 152 | \dcm{n,v:}{\locleader e}{i:}{\ileader e}{insert or wrap in {\tt \bs{}emph}} 153 | \dcm{n,v:}{\locleader o}{i:}{\ileader o}{insert or wrap in {\tt \bs{}Op}} 154 | \cm{i:}{\ileader k}{insert {\tt \bs{}Ket}} 155 | \cm{i:}{\ileader 2}{insert {\tt \bs{}sqrt}} 156 | \cm{i:}{\ileader v}{insert {\tt \bs{}vec}} 157 | \cm{i:}{\ileader h}{insert {\tt \bs{}hat}} 158 | \cm{i:}{\ileader `}{insert {\tt \bs{}verb}} 159 | \dcm{n:}{\locleader i}{i:}{\ileader i}{insert env/math function} 160 | \cm{i:}{\ileader t}{{\tt \bs{}text}} 161 | \cm{}{:let b:leftquote = '"`'}{German left quotes} 162 | \cm{}{:let b:rightquote="\bs{}"'"}{German right quotes} 163 | \cm{}{:setlocal makeprg=\dots}{change compiler} 164 | \cm{i:}{`a \dots`o}{$\alpha \dots \omega$} 165 | \cm{i:}{`c}{$\chi$} 166 | \cm{i:}{`f}{$\phi$} 167 | \cm{i:}{`q}{$\theta$} 168 | \cm{i:}{`w}{$\omega$} 169 | \cm{i:}{`v}{$\vee$} 170 | \cm{i:}{'\&}{$\wedge$} 171 | \cm{i:}{`D`F`G`L`O`P`Q`U`X`Y`P`S}{$\Delta \Phi \Gamma \Lambda \Omega \Pi \Theta \Upsilon \Xi \Psi \Sigma$} 172 | \cm{i:}{`I}{$\int_{a}^{b}$} 173 | \cm{i:}{`N}{$\nabla$} 174 | \cm{i:}{`E}{$\varepsilon$ (var-$\epsilon$)} 175 | \cm{i:}{`H}{$\varphi$ (var-$\phi$)} 176 | \cm{i:}{`R}{$\varrho$ (var-$\rho$)} 177 | \cm{i:}{`T}{$\vartheta$ (var-$\theta$)} 178 | \cm{i:}{`Z}{$\sum_{a}^{b}$} 179 | \cm{i:}{`1}{{\tt \bs unity}} 180 | \cm{i:}{`6}{{\tt \bs difquo}} 181 | \cm{i:}{`8}{$\infty$} 182 | \cm{i:}{`/\or `\%}{{\tt $\backslash$frac\lapos\rapos\lapos\rapos}} 183 | \cm{i:}{`@}{$\circ$} 184 | \cm{i:}{`$|$}{\bs$|$} 185 | \cm{i:}{`$|$}{{\tt \bs Big\bs $|$}} 186 | \cm{i:}{`=}{$\equiv$} 187 | \cm{i:}{`\bs}{$\setminus$} 188 | \cm{i:}{`.}{{\tt \bs cdot}} 189 | \cm{i:}{`*}{$\times$} 190 | \cm{i:}{`-}{$\bigcap$} 191 | \cm{i:}{`+}{$\bigcup$} 192 | \cm{i:}{`(}{{\tt \bs left( \bs right)}} 193 | \cm{i:}{`$[$}{{\tt \bs left$[$ \bs right$]$}} 194 | \cm{i:}{`<}{$\leq$} 195 | \cm{i:}{`>}{$\geq$} 196 | \cm{i:}{`,}{{\tt \bs nonumber}} 197 | \cm{i:}{`:}{{\tt \bs cdots}} 198 | \cm{i:}{`\tilde}{{\tt \bs tilde\lapos\rapos}} 199 | \cm{i:}{`;}{{\tt \bs dot\lapos\rapos}} 200 | \cm{i:}{`\_}{{\tt \bs bar\lapos\rapos}} 201 | \cm{i:}{`\ctrl E}{{\tt \bs exp()}} 202 | \cm{i:}{`\ctrl L}{{\tt \bs lim\_\lapos\rapos}} 203 | \cm{i:}{}{$\uparrow$} 204 | \cm{i:}{}{$\downarrow$} 205 | \cm{i:}{}{$\leftarrow$} 206 | \cm{i:}{}{$\longrightarrow$} 207 | \cm{i:}{\ctrl F}{$\to$} 208 | 209 | \vskip0.2cm 210 | \section{C} 211 | \cm{n,v:}{\locleader{}cc}{Open reference TOC} 212 | \cm{n,v:}{\locleader{}cr}{View reference for keyword} 213 | \cm{n,v:}{\locleader{}cw}{View reference (ask keyword)} 214 | 215 | 216 | \vskip0.1cm 217 | \section{Perl} 218 | \cm{n:}{K}{Look up 'perldoc -f' for word} 219 | \cm{}{:make}{Check for syntax errors} 220 | 221 | 222 | \vskip0.2cm 223 | \section{Python} 224 | \cm{n:}{\locleader{}pw}{View reference for keyword} 225 | \cm{n,v:}{K}{Look up documentation for word} 226 | \cm{}{:Pydoc {\it name}}{Look up name in documentation} 227 | \cm{}{:make}{Run through pylint} 228 | 229 | 230 | \section{Fortran} 231 | \dcm{n:}{\locleader i}{i:}{\ileader i}{Complete construct} 232 | \cm{}{:FortranFold}{Fold up Fortran code (fdm=manual)} 233 | 234 | \section{XML/HTML} 235 | \dcm{n:}{\locleader i}{i:}{\ileader i}{Insert/convert to tag} 236 | 237 | \section{Misc} 238 | \cm{n,v:}{++}{sum/avg numbers ({\tt:set nosmd})} 239 | 240 | % Footer 241 | \vfill \hrule\smallskip 242 | {\smallrm This work is licensed under the Creative Commons 243 | Attribution-Noncommercial-Share Alike 3.0 License. 244 | To view a copy of this license, visit 245 | http://creativecommons.org/licenses/by-nc-sa/ \\--- 246 | (CC) {\oldstyle 2012} by Michael Goerz. 247 | % Ending 248 | \supereject 249 | \if L\lr \else\null\vfill\eject\fi 250 | \if L\lr \else\null\vfill\eject\fi 251 | \bye 252 | 253 | 254 | % EOF 255 | -------------------------------------------------------------------------------- /periodictable/.gitignore: -------------------------------------------------------------------------------- 1 | /periodictable-a4.aux 2 | /periodictable-a4.log 3 | /periodictable-a4.out 4 | /periodictable-a4.pdf 5 | /periodictable-a4.tex 6 | /periodictable-letter.aux 7 | /periodictable-letter.log 8 | /periodictable-letter.out 9 | /periodictable-letter.pdf 10 | /periodictable-letter.tex 11 | -------------------------------------------------------------------------------- /periodictable/Makefile: -------------------------------------------------------------------------------- 1 | all: periodictable-a4.pdf periodictable-letter.pdf 2 | 3 | periodictable-a4.tex: periodictable.py 4 | ./periodictable.py --a4 periodictable-a4.tex 5 | 6 | periodictable-letter.tex: periodictable.py 7 | ./periodictable.py --letter periodictable-letter.tex 8 | 9 | periodictable-a4.pdf: periodictable-a4.tex 10 | pdflatex periodictable-a4.tex 11 | 12 | periodictable-letter.pdf: periodictable-letter.tex 13 | pdflatex periodictable-letter.tex 14 | 15 | clean: 16 | rm -f periodictable-a4.out 17 | rm -f periodictable-a4.log 18 | rm -f periodictable-a4.aux 19 | rm -f periodictable-letter.out 20 | rm -f periodictable-letter.log 21 | rm -f periodictable-letter.aux 22 | 23 | distclean: clean 24 | rm -f periodictable-a4.tex 25 | rm -f periodictable-a4.pdf 26 | rm -f periodictable-letter.tex 27 | rm -f periodictable-letter.pdf 28 | 29 | .PHONY: all clean distclean 30 | -------------------------------------------------------------------------------- /periodictable/periodictable.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Generate a tex file that renders to a Periodic Table of Elements""" 3 | import re 4 | from collections import defaultdict 5 | from textwrap import dedent 6 | from io import StringIO 7 | 8 | import numpy as np 9 | import pandas as pd 10 | import click 11 | 12 | 13 | DATA = pd.read_csv( 14 | StringIO( 15 | r''' 16 | atomic number,symbol,name,atomic mass,electron configuration,phase,category,period,group,mass number,radioactive,valence electrons 17 | 1,H,Hydrogen,1.00794,1s1,gas,nonmetal,1,IA,1,False,1 18 | 2,He,Helium,4.002602,1s2,gas,noble gas,1,VIIIA,4,False,0 19 | 3,Li,Lithium,6.941,[He] 2s1,solid,alkali metal,2,IA,7,False,1 20 | 4,Be,Beryllium,9.012182,[He] 2s2,solid,alkaline earth metal,2,IIA,9,False,2 21 | 5,B,Boron,10.811,[He] 2s2 2p1,solid,metalloid,2,IIIA,11,False,3 22 | 6,C,Carbon,12.0107,[He] 2s2 2p2,solid,nonmetal,2,IVA,12,False,4 23 | 7,N,Nitrogen,14.0067,[He] 2s2 2p3,gas,nonmetal,2,VA,14,False,5 24 | 8,O,Oxygen,15.9994,[He] 2s2 2p4,gas,nonmetal,2,VIA,16,False,6 25 | 9,F,Fluorine,18.9984032,[He] 2s2 2p5,gas,halogen,2,VIIA,19,False,7 26 | 10,Ne,Neon,20.1797,[He] 2s2 2p6,gas,noble gas,2,VIIIA,20,False,0 27 | 11,Na,Sodium,22.98976928,[Ne] 3s1,solid,alkali metal,3,IA,23,False,1 28 | 12,Mg,Magne-sium,24.3050,[Ne] 3s2,solid,alkaline earth metal,3,IIA,24,False,2 29 | 13,Al,Aluminum,26.9815386,[Ne] 3s2 3p1,solid,post-transition metal,3,IIIA,27,False,3 30 | 14,Si,Silicon,28.0855,[Ne] 3s2 3p2,solid,metalloid,3,IVA,28,False,4 31 | 15,P,Phosphor-us,30.973762,[Ne] 3s2 3p3,solid,nonmetal,3,VA,31,False,5 32 | 16,S,Sulfur,32.065,[Ne] 3s2 3p4,solid,nonmetal,3,VIA,32,False,6 33 | 17,Cl,Chlorine,35.453,[Ne] 3s2 3p5,gas,halogen,3,VIIA,35,False,7 34 | 18,Ar,Argon,39.948,[Ne] 3s2 3p6,gas,noble gas,3,VIIIA,40,False,0 35 | 19,K,Potassium,39.0983,[Ar] 4s1,solid,alkali metal,4,IA,39,False,1 36 | 20,Ca,Calcium,40.078,[Ar] 4s2,solid,alkaline earth metal,4,IIA,40,False,2 37 | 21,Sc,Scandium,44.955912,[Ar] 3d1 4s2,solid,transition metal,4,IIIB,45,False,3 38 | 22,Ti,Titanium,47.867,[Ar] 3d2 4s2,solid,transition metal,4,IVB,48,False,4 39 | 23,V,Vanadium,50.9415,[Ar] 3d3 4s2,solid,transition metal,4,VB,51,False,5 40 | 24,Cr,Chromium,51.9961,[Ar] 3d5 4s1,solid,transition metal,4,VIB,52,False,6 41 | 25,Mn,Manga-nese,54.938045,[Ar] 3d5 4s2,solid,transition metal,4,VIIB,55,False,7 42 | 26,Fe,Iron,55.845,[Ar] 3d6 4s2,solid,transition metal,4,VIIIB,56,False,8 43 | 27,Co,Cobalt,58.933195,[Ar] 3d7 4s2,solid,transition metal,4,VIIIB,59,False,9 44 | 28,Ni,Nickel,58.6934,[Ar] 3d8 4s2,solid,transition metal,4,VIIIB,58,False,10 45 | 29,Cu,Copper,63.546,[Ar] 3d10 4s1,solid,transition metal,4,IB,63,False,11 46 | 30,Zn,Zinc,65.38,[Ar] 3d10 4s2,solid,transition metal,4,IIB,64,False,12 47 | 31,Ga,Gallium,69.723,[Ar] 3d10 4s2 4p1,solid,post-transition metal,4,IIIA,69,False,3 48 | 32,Ge,German-ium,72.64,[Ar] 3d10 4s2 4p2,solid,metalloid,4,IVA,74,False,4 49 | 33,As,Arsenic,74.92160,[Ar] 3d10 4s2 4p3,solid,metalloid,4,VA,75,False,5 50 | 34,Se,Selenium,78.96,[Ar] 3d10 4s2 4p4,solid,nonmetal,4,VIA,80,False,6 51 | 35,Br,Bromine,79.904,[Ar] 3d10 4s2 4p5,liquid,halogen,4,VIIA,79,False,7 52 | 36,Kr,Krypton,83.798,[Ar] 3d10 4s2 4p6,gas,noble gas,4,VIIIA,84,False,0 53 | 37,Rb,Rubidium,85.4678,[Kr] 5s1,solid,alkali metal,5,IA,85,False,1 54 | 38,Sr,Strontium,87.62,[Kr] 5s2,solid,alkaline earth metal,5,IIA,88,False,2 55 | 39,Y,Yttrium,88.90585,[Kr] 4d1 5s2,solid,transition metal,5,IIIB,89,False,3 56 | 40,Zr,Zirconium,91.224,[Kr] 4d2 5s2,solid,transition metal,5,IVB,90,False,4 57 | 41,Nb,Niobium,92.90638,[Kr] 4d4 5s1,solid,transition metal,5,VB,93,False,5 58 | 42,Mo,Molybde-num,95.96,[Kr] 4d5 5s1,solid,transition metal,5,VIB,98,False,6 59 | 43,Tc,Technetium,98,[Kr] 4d5 5s2,solid,transition metal,5,VIIB,98,True,7 60 | 44,Ru,Ruthenium,101.07,[Kr] 4d7 5s1,solid,transition metal,5,VIIIB,102,False,8 61 | 45,Rh,Rhodium,102.90550,[Kr] 4d8 5s1,solid,transition metal,5,VIIIB,103,False,9 62 | 46,Pd,Palladium,106.42,[Kr] 4d10,solid,transition metal,5,VIIIB,106,False,12 63 | 47,Ag,Silver,107.8682,[Kr] 4d10 5s1,solid,transition metal,5,IB,107,False,11 64 | 48,Cd,Cadmium,112.411,[Kr] 4d10 5s2,solid,transition metal,5,IIB,114,False,12 65 | 49,In,Indium,114.818,[Kr] 4d10 5s2 5p1,solid,post-transition metal,5,IIIA,115,False,3 66 | 50,Sn,Tin,118.710,[Kr] 4d10 5s2 5p2,solid,post-transition metal,5,IVA,120,False,4 67 | 51,Sb,Antimony,121.760,[Kr] 4d10 5s2 5p3,solid,metalloid,5,VA,121,False,5 68 | 52,Te,Tellurium,127.60,[Kr] 4d10 5s2 5p4,solid,metalloid,5,VIA,130,False,6 69 | 53,I,Iodine,126.90447,[Kr] 4d10 5s2 5p5,solid,halogen,5,VIIA,127,False,7 70 | 54,Xe,Xenon,131.293,[Kr] 4d10 5s2 5p6,gas,noble gas,5,VIIIA,132,False,0 71 | 55,Cs,Cesium,132.9054519,[Xe] 6s1,solid,alkali metal,6,IA,133,False,1 72 | 56,Ba,Barium,137.327,[Xe] 6s2,solid,alkaline earth metal,6,IIA,138,False,2 73 | 57,La,Lanthanum,138.90547,[Xe] 5d1 6s2,solid,lanthanide,6,,139,False,2 74 | 58,Ce,Cerium,140.116,[Xe] 4f1 5d1 6s2,solid,lanthanide,6,,140,False,2 75 | 59,Pr,Praseo-dymium,140.90765,[Xe] 4f3 6s2,solid,lanthanide,6,,141,False,2 76 | 60,Nd,Neo-dymium,144.242,[Xe] 4f4 6s2,solid,lanthanide,6,,142,False,2 77 | 61,Pm,Prome-thium,145,[Xe] 4f5 6s2,solid,lanthanide,6,,145,True,2 78 | 62,Sm,Samarium,150.36,[Xe] 4f6 6s2,solid,lanthanide,6,,152,False,2 79 | 63,Eu,Europium,151.964,[Xe] 4f7 6s2,solid,lanthanide,6,,153,False,2 80 | 64,Gd,Gadolinium,157.25,[Xe] 4f7 5d1 6s2,solid,lanthanide,6,,158,False,2 81 | 65,Tb,Terbium,158.92535,[Xe] 4f9 6s2,solid,lanthanide,6,,159,False,2 82 | 66,Dy,Dyspro-sium,162.500,[Xe] 4f10 6s2,solid,lanthanide,6,,164,False,2 83 | 67,Ho,Holmium,164.93032,[Xe] 4f11 6s2,solid,lanthanide,6,,165,False,2 84 | 68,Er,Erbium,167.259,[Xe] 4f12 6s2,solid,lanthanide,6,,166,False,2 85 | 69,Tm,Thulium,168.93421,[Xe] 4f13 6s2,solid,lanthanide,6,,169,False,2 86 | 70,Yb,Ytterbium,173.054,[Xe] 4f14 6s2,solid,lanthanide,6,,174,False,2 87 | 71,Lu,Lutetium,174.9668,[Xe] 4f14 5d1 6s2,solid,transition metal,6,IIIB,175,False,3 88 | 72,Hf,Hafnium,178.49,[Xe] 4f14 5d2 6s2,solid,transition metal,6,IVB,180,False,4 89 | 73,Ta,Tantalum,180.94788,[Xe] 4f14 5d3 6s2,solid,transition metal,6,VB,181,False,5 90 | 74,W,Tungsten,183.84,[Xe] 4f14 5d4 6s2,solid,transition metal,6,VIB,184,False,6 91 | 75,Re,Rhenium,186.207,[Xe] 4f14 5d5 6s2,solid,transition metal,6,VIIB,187,False,7 92 | 76,Os,Osmium,190.23,[Xe] 4f14 5d6 6s2,solid,transition metal,6,VIIIB,192,False,8 93 | 77,Ir,Iridium,192.217,[Xe] 4f14 5d7 6s2,solid,transition metal,6,VIIIB,193,False,9 94 | 78,Pt,Platinum,195.084,[Xe] 4f14 5d9 6s1,solid,transition metal,6,VIIIB,195,False,10 95 | 79,Au,Gold,196.966569,[Xe] 4f14 5d10 6s1,solid,transition metal,6,IB,197,False,11 96 | 80,Hg,Mercury,200.59,[Xe] 4f14 5d10 6s2,liquid,transition metal,6,IIB,202,False,12 97 | 81,Tl,Thallium,204.3833,[Xe] 4f14 5d10 6s2 6p1,solid,post-transition metal,6,IIIA,205,False,3 98 | 82,Pb,Lead,207.2,[Xe] 4f14 5d10 6s2 6p2,solid,post-transition metal,6,IVA,208,False,4 99 | 83,Bi,Bismuth,208.98040,[Xe] 4f14 5d10 6s2 6p3,solid,post-transition metal,6,VA,209,False,5 100 | 84,Po,Polonium,,[Xe] 4f14 5d10 6s2 6p4,solid,metalloid,6,VIA,209,True,6 101 | 85,At,Astatine,,[Xe] 4f14 5d10 6s2 6p5,solid,halogen,6,VIIA,210,True,7 102 | 86,Rn,Radon,,[Xe] 4f14 5d10 6s2 6p6,gas,noble gas,6,VIIIA,222,True,0 103 | 87,Fr,Francium,,[Rn] 7s1,solid,alkali metal,7,IA,223,True,1 104 | 88,Ra,Radium,,[Rn] 7s2,solid,alkaline earth metal,7,IIA,226,True,2 105 | 89,Ac,Actinium,,[Rn] 6d1 7s2,solid,actinide,7,,227,True,2 106 | 90,Th,Thorium,232.03806,[Rn] 6d2 7s2,solid,actinide,7,,232,True,2 107 | 91,Pa,Protact-inium,231.03588,[Rn] 5f2 6d1 7s2,solid,actinide,7,,231,True,2 108 | 92,U,Uranium,238.02891,[Rn] 5f3 6d1 7s2,solid,actinide,7,,238,True,2 109 | 93,Np,Neptunium,,[Rn] 5f4 6d1 7s2,solid,actinide,7,,237,True,2 110 | 94,Pu,Plutonium,,[Rn] 5f6 7s2,solid,actinide,7,,244,True,2 111 | 95,Am,Americium,,[Rn] 5f7 7s2,solid,actinide,7,,243,True,2 112 | 96,Cm,Curium,,[Rn] 5f7 6d1 7s2,solid,actinide,7,,247,True,2 113 | 97,Bk,Berkelium,,[Rn] 5f9 7s2,solid,actinide,7,,247,True,2 114 | 98,Cf,Californ-ium,,[Rn] 5f10 7s2,solid,actinide,7,,251,True,2 115 | 99,Es,Einstein-ium,,[Rn] 5f11 7s2,solid,actinide,7,,252,True,2 116 | 100,Fm,Fermium,,[Rn] 5f12 7s2,,actinide,7,,257,True,2 117 | 101,Md,Mendelev-ium,,[Rn] 5f13 7s2,,actinide,7,,258,True,2 118 | 102,No,Nobelium,,[Rn] 5f14 7s2,,actinide,7,,259,True,2 119 | 103,Lr,Lawrenc-ium,,[Rn] 5f14 7s2 7p1,,transition metal,7,IIIB,262,True,3 120 | 104,Rf,Ruther-fordium,,[Rn] 5f14 6d2 7s2,,transition metal,7,IVB,261,True,4 121 | 105,Db,Dubnium,,[Rn] 5f14 6d3 7s2,,transition metal,7,VB,262,True,5 122 | 106,Sg,Seaborg-ium,,[Rn] 5f14 6d4 7s2,,transition metal,7,VIB,266,True,6 123 | 107,Bh,Bohrium,,[Rn] 5f14 6d5 7s2,,transition metal,7,VIIB,264,True,7 124 | 108,Hs,Hassium,,[Rn] 5f14 6d6 7s2,,transition metal,7,VIIIB,269,True,8 125 | 109,Mt,Meitnerium,,[Rn] 5f14 6d7 7s2,,transition metal,7,VIIIB,268,True,9 126 | 110,Ds,Darmstadt-ium,,[Rn] 5f14 6d9 7s1,,transition metal,7,VIIIB,,True,10 127 | 111,Rg,Roentgen-ium,,[Rn] 5f14 6d10 7s1,,transition metal,7,IB,,True,11 128 | 112,Cn,Copernic-ium,,[Rn] 5f14 6d10 7s2,,transition metal,7,IIB,,True,12 129 | 113,Nh,Nihonium,,[Rn] 5f14 6d10 7s2 7p1,,unknown,7,IIIA,,True,3 130 | 114,Fl,Flerovium,,[Rn] 5f14 6d10 7s2 7p2,,unknown,7,IVA,,True,4 131 | 115,Mc,Moscov-ium,,[Rn] 5f14 6d10 7s2 7p3,,unknown,7,VA,,True,5 132 | 116,Lv,Livermor-ium,,[Rn] 5f14 6d10 7s2 7p4,,unknown,7,VIA,,True,6 133 | 117,Ts,Tennessine,,[Rn] 5f14 6d10 7s2 7p5,,unknown,7,VIIA,,True,7 134 | 118,Og,Oganesson,,[Rn] 5f14 6d10 7s2 7p6,,unknown,7,VIIIA,,True,0 135 | ''' 136 | ), 137 | index_col=0, 138 | dtype=str, 139 | ) 140 | 141 | SPIN_DATA = pd.read_csv( 142 | StringIO( 143 | r''' 144 | %============================================================== 145 | % EasySpin nuclear isotope database 146 | % http://easyspin.org/documentation/isotopetable.html 147 | %============================================================== 148 | % Contains all naturally occurring nuclei plus selected 149 | % radioactive ones, which are marked by * in column 3. 150 | % Line syntax: 151 | % Column 1: #protons 152 | % Column 2: #nucleons 153 | % Column 3: radioactive *, stable - 154 | % Column 4: symbol 155 | % Column 5: name 156 | % Column 6: spin quantum number 157 | % Column 7: nuclear g factor gn 158 | % Column 8: natural abundance, in percent 159 | % Column 9: electric quadrupole moment, in barn (10^-28 m^2) 160 | % NaN indicates 'not measured' 161 | % 162 | % Nuclear magnetic moments are taken from 163 | % N.Stone 164 | % Table of Nuclear Magnetic Dipole and Electric Quadrupole Moments 165 | % International Atomic Energy Agency, INDC(NDS)-0658, February 2014 166 | % (https://www-nds.iaea.org/publications/indc/indc-nds-0658.pdf) 167 | % (Typo for Rh-103: Moment is factor of 10 too large) 168 | % 237Np, 239Pu, 243Am data from 169 | % N.E.Holden 170 | % Table of the Isotopes 171 | % CRC Handbook of Physics and Chemistry, section 11-2 172 | % (http://www.hbcponline.com//articles/11_02_92.pdf) 173 | % 174 | % Nuclear quadrupole moments are taken from 175 | % N.Stone 176 | % Table of Nuclear Quadrupole Moments 177 | % International Atomic Energy Agency, INDC(NDS)-650, December 2013 178 | % (https://www-nds.iaea.org/publications/indc/indc-nds-0650.pdf) 179 | % (Typo for Ac-227: Sign should be +) 180 | % See also 181 | % P.Pyykk� 182 | % Year-2008 Nuclear Quadrupole Moments 183 | % Mol.Phys. 106(16-18), 1965-1974 (2008) 184 | % (http://dx.doi.org/10.1080/00268970802018367) 185 | % N.E.Holden 186 | % Table of the Isotopes 187 | % CRC Handbook of Physics and Chemistry, section 11-2 188 | % (http://www.hbcponline.com//articles/11_02_92.pdf) 189 | %-------------------------------------------------------------- 190 | % first period 191 | %-------------------------------------------------------------- 192 | 1 1 - H hydrogen 0.5 +5.58569468 99.9885 0 193 | 1 2 - H hydrogen 1.0 +0.8574382 0.0115 +0.00286 194 | 1 3 * H hydrogen 0.5 +5.95799369 0.0 0 195 | 2 3 - He helium 0.5 -4.25499544 0.000137 0 196 | 2 4 - He helium 0.0 0.0 99.999863 0 197 | %-------------------------------------------------------------- 198 | % second period 199 | %-------------------------------------------------------------- 200 | 3 6 - Li lithium 1.0 +0.8220473 7.59 -0.000806 201 | 3 7 - Li lithium 1.5 +2.170951 92.41 -0.0400 202 | 4 9 - Be beryllium 1.5 -0.78495 100.0 +0.0529 203 | 5 10 - B boron 3.0 +0.600215 19.9 +0.0845 204 | 5 11 - B boron 1.5 +1.7924326 80.1 +0.04059 205 | 6 12 - C carbon 0.0 0.0 98.93 0 206 | 6 13 - C carbon 0.5 +1.4048236 1.07 0 207 | 6 14 * C carbon 0.0 0.0 0.0 0 208 | 7 14 - N nitrogen 1.0 +0.40376100 99.632 +0.02044 209 | 7 15 - N nitrogen 0.5 -0.56637768 0.368 0 210 | 8 16 - O oxygen 0.0 0.0 99.757 0 211 | 8 17 - O oxygen 2.5 -0.757516 0.038 -0.0256 212 | 8 18 * O oxygen 0.0 0.0 0.205 0 213 | 9 19 - F fluorine 0.5 +5.257736 100.0 0 214 | 10 20 - Ne neon 0.0 0.0 90.48 0 215 | 10 21 - Ne neon 1.5 -0.441198 0.27 +0.102 216 | 10 22 - Ne neon 0.0 0.0 9.25 0 217 | %-------------------------------------------------------------- 218 | % third period 219 | %-------------------------------------------------------------- 220 | 11 22 * Na sodium 3.0 +0.582 0.0 +0.180 221 | 11 23 - Na sodium 1.5 +1.478348 100.0 +0.104 222 | 12 24 - Mg magnesium 0.0 0.0 78.99 0 223 | 12 25 - Mg magnesium 2.5 -0.34218 10.00 +0.199 224 | 12 26 - Mg magnesium 0.0 0.0 11.01 0 225 | 13 27 - Al aluminium 2.5 +1.4566028 100.0 +0.1466 226 | 14 28 - Si silicon 0.0 0.0 92.2297 0 227 | 14 29 - Si silicon 0.5 -1.11058 4.6832 0 228 | 14 30 - Si silicon 0.0 0.0 3.0872 0 229 | 15 31 - P phosphorus 0.5 +2.26320 100.0 0 230 | 16 32 - S sulfur 0.0 0.0 94.93 0 231 | 16 33 - S sulfur 1.5 +0.429214 0.76 -0.0678 232 | 16 34 - S sulfur 0.0 0.0 4.29 0 233 | 16 36 - S sulfur 0.0 0.0 0.02 0 234 | 17 35 - Cl chlorine 1.5 +0.5479162 75.78 -0.0817 235 | 17 36 * Cl chlorine 2.0 +0.642735 0.0 -0.0178 236 | 17 37 - Cl chlorine 1.5 +0.4560824 24.22 -0.0644 237 | 18 36 - Ar argon 0.0 0.0 0.3365 0 238 | 18 38 - Ar argon 0.0 0.0 0.0632 0 239 | 18 39 * Ar argon 3.5 -0.4537 0.0 -0.12 240 | 18 40 - Ar argon 0.0 0.0 99.6003 0 241 | %-------------------------------------------------------------- 242 | % fourth period, first row transition metals 243 | %-------------------------------------------------------------- 244 | 19 39 - K potassium 1.5 +0.26098 93.2581 +0.0585 245 | 19 40 - K potassium 4.0 -0.324525 0.0117 -0.073 246 | 19 41 - K potassium 1.5 +0.1432467 6.7302 +0.0711 247 | 20 40 - Ca calcium 0.0 0.0 96.941 0 248 | 20 41 * Ca calcium 3.5 -0.4556517 0.0 -0.0665 249 | 20 42 - Ca calcium 0.0 0.0 0.647 0 250 | 20 43 - Ca calcium 3.5 -0.37637 0.135 -0.0408 251 | 20 44 - Ca calcium 0.0 0.0 2.086 0 252 | 20 46 - Ca calcium 0.0 0.0 0.004 0 253 | 20 48 - Ca calcium 0.0 0.0 0.187 0 254 | 21 45 - Sc scandium 3.5 +1.35899 100.0 -0.220 255 | 22 46 - Ti titanium 0.0 0.0 8.25 0 256 | 22 47 - Ti titanium 2.5 -0.31539 7.44 +0.302 257 | 22 48 - Ti titanium 0.0 0.0 73.72 0 258 | 22 49 - Ti titanium 3.5 -0.315477 5.41 +0.247 259 | 22 50 - Ti titanium 0.0 0.0 5.18 0 260 | 23 50 - V vanadium 6.0 +0.5576148 0.25 +0.21 261 | 23 51 - V vanadium 3.5 +1.47106 99.75 -0.043 262 | 24 50 - Cr chromium 0.0 0.0 4.345 0 263 | 24 52 - Cr chromium 0.0 0.0 83.789 0 264 | 24 53 - Cr chromium 1.5 -0.31636 9.501 -0.15 265 | 24 54 - Cr chromium 0.0 0.0 2.365 0 266 | 25 53 * Mn manganese 3.5 +1.439 0.0 +0.17 267 | 25 55 - Mn manganese 2.5 +1.3813 100.0 +0.330 268 | 26 54 - Fe iron 0.0 0.0 5.845 0 269 | 26 56 - Fe iron 0.0 0.0 91.754 0 270 | 26 57 - Fe iron 0.5 +0.1809 2.119 0 271 | 26 58 - Fe iron 0.0 0.0 0.282 0 272 | 27 59 - Co cobalt 3.5 +1.322 100.0 +0.42 273 | 27 60 * Co cobalt 5.0 +0.7598 0.0 +0.46 274 | 28 58 - Ni nickel 0.0 0.0 68.0769 0 275 | 28 60 - Ni nickel 0.0 0.0 26.2231 0 276 | 28 61 - Ni nickel 1.5 -0.50001 1.1399 +0.162 277 | 28 62 - Ni nickel 0.0 0.0 3.6345 0 278 | 28 64 - Ni nickel 0.0 0.0 0.9256 0 279 | 29 63 - Cu copper 1.5 +1.4824 69.17 -0.220 280 | 29 65 - Cu copper 1.5 +1.5878 30.83 -0.204 281 | 30 64 - Zn zinc 0.0 0.0 48.63 0 282 | 30 66 - Zn zinc 0.0 0.0 27.90 0 283 | 30 67 - Zn zinc 2.5 +0.350192 4.10 +0.150 284 | 30 68 - Zn zinc 0.0 0.0 18.75 0 285 | 30 70 - Zn zinc 0.0 0.0 0.62 0 286 | 31 69 - Ga gallium 1.5 +1.34439 60.108 +0.171 287 | 31 71 - Ga gallium 1.5 +1.70818 39.892 +0.107 288 | 32 70 - Ge germanium 0.0 0.0 20.84 0 289 | 32 72 - Ge germanium 0.0 0.0 27.54 0 290 | 32 73 - Ge germanium 4.5 -0.1954373 7.73 -0.19 291 | 32 74 - Ge germanium 0.0 0.0 36.28 0 292 | 32 76 - Ge germanium 0.0 0.0 7.61 0 293 | 33 75 - As arsenic 1.5 +0.95965 100.0 +0.314 294 | 34 74 - Se selenium 0.0 0.0 0.89 0 295 | 34 76 - Se selenium 0.0 0.0 9.37 0 296 | 34 77 - Se selenium 0.5 +1.07008 7.63 0 297 | 34 78 - Se selenium 0.0 0.0 23.77 0 298 | 34 79 * Se selenium 3.5 -0.29 0.0 +0.8 299 | 34 80 - Se selenium 0.0 0.0 49.61 0 300 | 34 82 - Se selenium 0.0 0.0 8.73 0 301 | 35 79 - Br bromine 1.5 +1.404267 50.69 +0.313 302 | 35 81 - Br bromine 1.5 +1.513708 49.31 +0.262 303 | 36 78 - Kr krypton 0.0 0.0 0.35 0 304 | 36 80 - Kr krypton 0.0 0.0 2.28 0 305 | 36 82 - Kr krypton 0.0 0.0 11.58 0 306 | 36 83 - Kr krypton 4.5 -0.215704 11.49 +0.259 307 | 36 84 - Kr krypton 0.0 0.0 57.00 0 308 | 36 85 * Kr krypton 4.5 -0.2233 0.0 +0.443 309 | 36 86 - Kr krypton 0.0 0.0 17.30 0 310 | %-------------------------------------------------------------- 311 | % fifth period, second row transition metals 312 | %-------------------------------------------------------------- 313 | 37 85 - Rb rubidium 2.5 +0.541192 72.17 +0.276 314 | 37 87 - Rb rubidium 1.5 +1.83421 27.83 +0.1335 315 | 38 84 - Sr strontium 0.0 0.0 0.56 0 316 | 38 86 - Sr strontium 0.0 0.0 9.86 0 317 | 38 87 - Sr strontium 4.5 -0.24284 7.00 +0.305 318 | 38 88 - Sr strontium 0.0 0.0 82.58 0 319 | 39 89 - Y yttrium 0.5 -0.2748308 100.0 0 320 | 40 90 - Zr zirconium 0.0 0.0 51.45 0 321 | 40 91 - Zr zirconium 2.5 -0.521448 11.22 -0.176 322 | 40 92 - Zr zirconium 0.0 0.0 17.15 0 323 | 40 94 - Zr zirconium 0.0 0.0 17.38 0 324 | 40 96 - Zr zirconium 0.0 0.0 2.80 0 325 | 41 93 - Nb niobium 4.5 +1.3712 100.0 -0.32 326 | 42 92 - Mo molybdenum 0.0 0.0 14.84 0 327 | 42 94 - Mo molybdenum 0.0 0.0 9.25 0 328 | 42 95 - Mo molybdenum 2.5 -0.3657 15.92 -0.022 329 | 42 96 - Mo molybdenum 0.0 0.0 16.68 0 330 | 42 97 - Mo molybdenum 2.5 -0.3734 9.55 +0.255 331 | 42 98 - Mo molybdenum 0.0 0.0 24.13 0 332 | 42 100 - Mo molybdenum 0.0 0.0 9.63 0 333 | 43 99 * Tc technetium 4.5 +1.2632 0.0 -0.129 334 | 44 96 - Ru ruthenium 0.0 0.0 5.54 0 335 | 44 98 - Ru ruthenium 0.0 0.0 1.87 0 336 | 44 99 - Ru ruthenium 2.5 -0.256 12.76 +0.079 337 | 44 100 - Ru ruthenium 0.0 0.0 12.60 0 338 | 44 101 - Ru ruthenium 2.5 -0.288 17.06 +0.46 339 | 44 102 - Ru ruthenium 0.0 0.0 31.55 0 340 | 44 104 - Ru ruthenium 0.0 0.0 18.62 0 341 | 45 103 - Rh rhodium 0.5 -0.1768 100.0 0 342 | 46 102 - Pd palladium 0.0 0.0 1.02 0 343 | 46 104 - Pd palladium 0.0 0.0 11.14 0 344 | 46 105 - Pd palladium 2.5 -0.257 22.33 +0.660 345 | 46 106 - Pd palladium 0.0 0.0 27.33 0 346 | 46 108 - Pd palladium 0.0 0.0 26.46 0 347 | 46 110 - Pd palladium 0.0 0.0 11.72 0 348 | 47 107 - Ag silver 0.5 -0.22714 51.839 0 349 | 47 109 - Ag silver 0.5 -0.26112 48.161 0 350 | 48 106 - Cd cadmium 0.0 0.0 1.25 0 351 | 48 108 - Cd cadmium 0.0 0.0 0.89 0 352 | 48 110 - Cd cadmium 0.0 0.0 12.49 0 353 | 48 111 - Cd cadmium 0.5 -1.18977 12.80 0 354 | 48 112 - Cd cadmium 0.0 0.0 24.13 0 355 | 48 113 - Cd cadmium 0.5 -1.244602 12.22 0 356 | 48 114 - Cd cadmium 0.0 0.0 28.73 0 357 | 48 116 - Cd cadmium 0.0 0.0 7.49 0 358 | 49 113 - In indium 4.5 +1.2286 4.29 +0.759 359 | 49 115 - In indium 4.5 +1.2313 95.71 +0.770 360 | 50 112 - Sn tin 0.0 0.0 0.97 0 361 | 50 114 - Sn tin 0.0 0.0 0.66 0 362 | 50 115 - Sn tin 0.5 -1.8377 0.34 0 363 | 50 116 - Sn tin 0.0 0.0 14.54 0 364 | 50 117 - Sn tin 0.5 -2.00208 7.68 0 365 | 50 118 - Sn tin 0.0 0.0 24.22 0 366 | 50 119 - Sn tin 0.5 -2.09456 8.59 0 367 | 50 120 - Sn tin 0.0 0.0 32.58 0 368 | 50 122 - Sn tin 0.0 0.0 4.63 0 369 | 50 124 - Sn tin 0.0 0.0 5.79 0 370 | 51 121 - Sb antimony 2.5 +1.3454 57.21 -0.543 371 | 51 123 - Sb antimony 3.5 +0.72851 42.79 -0.692 372 | 51 125 * Sb antimony 3.5 +0.751 0.0 NaN 373 | 52 120 - Te tellurium 0.0 0.0 0.09 0 374 | 52 122 - Te tellurium 0.0 0.0 2.55 0 375 | 52 123 - Te tellurium 0.5 -1.473896 0.89 0 376 | 52 124 - Te tellurium 0.0 0.0 4.74 0 377 | 52 125 - Te tellurium 0.5 -1.7770102 7.07 0 378 | 52 126 - Te tellurium 0.0 0.0 18.84 0 379 | 52 128 - Te tellurium 0.0 0.0 31.74 0 380 | 52 130 - Te tellurium 0.0 0.0 34.08 0 381 | 53 127 - I iodine 2.5 +1.12531 100.0 -0.696 382 | 53 129 * I iodine 3.5 +0.74886 0.0 -0.488 383 | 54 124 - Xe xenon 0.0 0.0 0.09 0 384 | 54 126 - Xe xenon 0.0 0.0 0.09 0 385 | 54 128 - Xe xenon 0.0 0.0 1.92 0 386 | 54 129 - Xe xenon 0.5 -1.55595 26.44 0 387 | 54 130 - Xe xenon 0.0 0.0 4.08 0 388 | 54 131 - Xe xenon 1.5 +0.461 21.18 -0.114 389 | 54 132 - Xe xenon 0.0 0.0 26.89 0 390 | 54 134 - Xe xenon 0.0 0.0 10.44 0 391 | 54 136 - Xe xenon 0.0 0.0 8.87 0 392 | %-------------------------------------------------------------- 393 | % sixth period, third row transition metals, rare earths 394 | %-------------------------------------------------------------- 395 | 55 133 - Cs caesium 3.5 +0.7377214 100.0 -0.00343 396 | 55 134 * Cs caesium 4.0 +0.74843 0.0 +0.37 397 | 55 135 * Cs caesium 3.5 +0.78069 0.0 +0.048 398 | 55 137 * Cs caesium 3.5 +0.81466 0.0 +0.048 399 | 56 130 - Ba barium 0.0 0.0 0.106 0 400 | 56 132 - Ba barium 0.0 0.0 0.101 0 401 | 56 133 * Ba barium 0.5 -1.5433 0.0 0 402 | 56 134 - Ba barium 0.0 0.0 2.417 0 403 | 56 135 - Ba barium 1.5 +0.55863 6.592 +0.160 404 | 56 136 - Ba barium 0.0 0.0 7.854 0 405 | 56 137 - Ba barium 1.5 +0.62491 11.232 +0.245 406 | 56 138 - Ba barium 0.0 0.0 71.698 0 407 | 57 137 * La lanthanum 3.5 +0.7714 0.0 +0.21 408 | 57 138 - La lanthanum 5.0 +0.742729 0.090 +0.39 409 | 57 139 - La lanthanum 3.5 +0.795156 99.910 +0.200 410 | 58 136 - Ce cerium 0.0 0.0 0.185 0 411 | 58 138 - Ce cerium 0.0 0.0 0.251 0 412 | 58 140 - Ce cerium 0.0 0.0 88.450 0 413 | 58 142 - Ce cerium 0.0 0.0 11.114 0 414 | 59 141 - Pr praesodymium 2.5 +1.7102 100.0 -0.077 415 | 60 142 - Nd neodymium 0.0 0.0 27.2 0 416 | 60 143 - Nd neodymium 3.5 -0.3043 12.2 -0.61 417 | 60 144 - Nd neodymium 0.0 0.0 23.8 0 418 | 60 145 - Nd neodymium 3.5 -0.187 8.3 -0.314 419 | 60 146 - Nd neodymium 0.0 0.0 17.2 0 420 | 60 148 - Nd neodymium 0.0 0.0 5.7 0 421 | 60 150 - Nd neodymium 0.0 0.0 5.6 0 422 | 61 147 * Pm promethium 3.5 +0.737 0.0 +0.74 423 | 62 144 - Sm samarium 0.0 0.0 3.07 0 424 | 62 147 - Sm samarium 3.5 -0.232 14.99 -0.26 425 | 62 148 - Sm samarium 0.0 0.0 11.24 0 426 | 62 149 - Sm samarium 3.5 -0.1908 13.82 +0.078 427 | 62 150 - Sm samarium 0.0 0.0 7.38 0 428 | 62 151 * Sm samarium 2.5 +0.1444 0.0 +0.71 429 | 62 152 - Sm samarium 0.0 0.0 26.75 0 430 | 62 154 - Sm samarium 0.0 0.0 22.75 0 431 | 63 151 - Eu europium 2.5 +1.3887 47.81 +0.903 432 | 63 152 * Eu europium 3.0 -0.6467 0.0 +2.72 433 | 63 153 - Eu europium 2.5 +0.6134 52.19 +2.41 434 | 63 154 * Eu europium 3.0 -0.6683 0.0 +2.85 435 | 63 155 * Eu europium 2.5 +0.608 0.0 +2.5 436 | 64 152 - Gd gadolinium 0.0 0.0 0.20 0 437 | 64 154 - Gd gadolinium 0.0 0.0 2.18 0 438 | 64 155 - Gd gadolinium 1.5 -0.1715 14.80 +1.27 439 | 64 156 - Gd gadolinium 0.0 0.0 20.47 0 440 | 64 157 - Gd gadolinium 1.5 -0.2265 15.65 +1.35 441 | 64 158 - Gd gadolinium 0.0 0.0 24.84 0 442 | 64 160 - Gd gadolinium 0.0 0.0 21.86 0 443 | 65 157 * Tb terbium 1.5 +1.34 0.0 +1.40 444 | 65 159 - Tb terbium 1.5 +1.343 100.0 +1.432 445 | 65 160 * Tb terbium 3.0 +0.5967 0.0 +3.85 446 | 66 156 - Dy dysprosium 0.0 0.0 0.06 0 447 | 66 158 - Dy dysprosium 0.0 0.0 0.10 0 448 | 66 160 - Dy dysprosium 0.0 0.0 2.34 0 449 | 66 161 - Dy dysprosium 2.5 -0.192 18.91 +2.51 450 | 66 162 - Dy dysprosium 0.0 0.0 25.51 0 451 | 66 163 - Dy dysprosium 2.5 +0.269 24.90 +2.65 452 | 66 164 - Dy dysprosium 0.0 0.0 28.18 0 453 | 67 165 - Ho holmium 3.5 +1.668 100.0 +3.58 454 | 68 162 - Er erbium 0.0 0.0 0.14 0 455 | 68 164 - Er erbium 0.0 0.0 1.61 0 456 | 68 166 - Er erbium 0.0 0.0 33.61 0 457 | 68 167 - Er erbium 3.5 -0.1611 22.93 +3.57 458 | 68 168 - Er erbium 0.0 0.0 26.78 0 459 | 68 170 - Er erbium 0.0 0.0 14.93 0 460 | 69 169 - Tm thulium 0.5 -0.462 100.0 0 461 | 69 171 * Tm thulium 0.5 -0.456 0.0 0 462 | 70 168 - Yb ytterbium 0.0 0.0 0.13 0 463 | 70 170 - Yb ytterbium 0.0 0.0 3.04 0 464 | 70 171 - Yb ytterbium 0.5 +0.98734 14.28 0 465 | 70 172 - Yb ytterbium 0.0 0.0 21.83 0 466 | 70 173 - Yb ytterbium 2.5 -0.2592 16.13 +2.80 467 | 70 174 - Yb ytterbium 0.0 0.0 31.83 0 468 | 70 176 - Yb ytterbium 0.0 0.0 12.76 0 469 | 71 173 * Lu lutetium 3.5 +0.6517 0.0 +3.53 470 | 71 174 * Lu lutetium 1.0 +1.988 0.0 +0.773 471 | 71 175 - Lu lutetium 3.5 +0.6378 97.41 +3.49 472 | 71 176 - Lu lutetium 7.0 +0.4517 2.59 +4.92 473 | 72 174 - Hf hafnium 0.0 0.0 0.16 0 474 | 72 176 - Hf hafnium 0.0 0.0 5.26 0 475 | 72 177 - Hf hafnium 3.5 +0.2267 18.60 +3.37 476 | 72 178 - Hf hafnium 0.0 0.0 27.28 0 477 | 72 179 - Hf hafnium 4.5 -0.1424 13.62 +3.79 478 | 72 180 - Hf hafnium 0.0 0.0 35.08 0 479 | 73 180 - Ta tantalum 9.0 0.5361 0.012 +4.80 480 | 73 181 - Ta tantalum 3.5 +0.67729 99.988 +3.17 481 | 74 180 - W tungsten 0.0 0.0 0.12 0 482 | 74 182 - W tungsten 0.0 0.0 26.50 0 483 | 74 183 - W tungsten 0.5 +0.2355695 14.31 0 484 | 74 184 - W tungsten 0.0 0.0 30.64 0 485 | 74 186 - W tungsten 0.0 0.0 28.43 0 486 | 75 185 - Re rhenium 2.5 +1.2748 37.40 +2.18 487 | 75 187 - Re rhenium 2.5 +1.2879 62.60 +2.07 488 | 76 184 - Os osmium 0.0 0.0 0.02 0 489 | 76 186 - Os osmium 0.0 0.0 1.59 0 490 | 76 187 - Os osmium 0.5 +0.1293038 1.96 0 491 | 76 188 - Os osmium 0.0 0.0 13.24 0 492 | 76 189 - Os osmium 1.5 +0.439956 16.15 +0.86 493 | 76 190 - Os osmium 0.0 0.0 26.26 0 494 | 76 192 - Os osmium 0.0 0.0 40.78 0 495 | 77 191 - Ir iridium 1.5 +0.1005 37.3 +0.816 496 | 77 193 - Ir iridium 1.5 +0.1091 62.7 +0.751 497 | 78 190 - Pt platinum 0.0 0.0 0.014 0 498 | 78 192 - Pt platinum 0.0 0.0 0.784 0 499 | 78 194 - Pt platinum 0.0 0.0 32.967 0 500 | 78 195 - Pt platinum 0.5 +1.2190 33.832 0 501 | 78 196 - Pt platinum 0.0 0.0 25.242 0 502 | 78 198 - Pt platinum 0.0 0.0 7.163 0 503 | 79 197 - Au gold 1.5 +0.097164 100.0 +0.547 504 | 80 196 - Hg mercury 0.0 0.0 0.15 0 505 | 80 198 - Hg mercury 0.0 0.0 9.97 0 506 | 80 199 - Hg mercury 0.5 +1.011771 16.87 0 507 | 80 200 - Hg mercury 0.0 0.0 23.10 0 508 | 80 201 - Hg mercury 1.5 -0.373484 13.18 +0.387 509 | 80 202 - Hg mercury 0.0 0.0 29.86 0 510 | 80 204 - Hg mercury 0.0 0.0 6.87 0 511 | 81 203 - Tl thallium 0.5 +3.24451574 29.524 0 512 | 81 204 * Tl thallium 2.0 +0.045 0.0 NaN 513 | 81 205 - Tl thallium 0.5 +3.2764292 70.476 0 514 | 82 204 - Pb lead 0.0 0.0 1.4 0 515 | 82 206 - Pb lead 0.0 0.0 24.1 0 516 | 82 207 - Pb lead 0.5 +1.18512 22.1 0 517 | 82 208 - Pb lead 0.0 0.0 52.4 0 518 | 83 207 * Bi bismuth 4.5 +0.9092 0.0 -0.76 519 | 83 209 - Bi bismuth 4.5 +0.9134 100.0 -0.516 520 | 84 209 * Po polonium 0.5 +1.5 0.0 0 521 | 85 0 * At astatine -1.0 0.0 0.0 0 522 | 86 0 * Rn radon -1.0 0.0 0.0 0 523 | %-------------------------------------------------------------- 524 | % seventh period, rare earths 525 | %-------------------------------------------------------------- 526 | 87 0 * Fr francium -1.0 0.0 0.0 0 527 | 88 0 * Ra radium -1.0 0.0 0.0 0 528 | 89 227 * Ac actinium 1.5 +0.73 0.0 +1.7 529 | 90 229 * Th thorium 2.5 +0.18 0.0 +4.3 530 | 90 232 - Th thorium 0.0 0.0 100.0 0 531 | 91 0 - Pa protactinium -1.0 0.0 100.0 0 532 | 92 234 * U uranium 0.0 0.0 0.0055 0 533 | 92 235 * U uranium 3.5 -0.109 0.7200 +4.936 534 | 92 238 * U uranium 0.0 0.0 99.2745 0 535 | 93 237 * Np neptunium 2.5 +1.256 0.0 +3.87 536 | 94 239 * Pu plutonium 0.5 +0.406 0.0 0 537 | 95 243 * Am americium 2.5 +0.6 0.0 +2.86 538 | 96 0 * Cm curium -1.0 0.0 0.0 0 539 | 97 0 * Bk berkelium -1.0 0.0 0.0 0 540 | 98 0 * Cf californium -1.0 0.0 0.0 0 541 | 99 0 * Es einsteinium -1.0 0.0 0.0 0 542 | 100 0 * Fm fermium -1.0 0.0 0.0 0 543 | 101 0 * Md mendelevium -1.0 0.0 0.0 0 544 | 102 0 * No nobelium -1.0 0.0 0.0 0 545 | 103 0 * Lr lawrencium -1.0 0.0 0.0 0 546 | 104 0 * Rf rutherfordium -1.0 0.0 0.0 0 547 | 105 0 * Db dubnium -1.0 0.0 0.0 0 548 | 106 0 * Sg seaborgium -1.0 0.0 0.0 0 549 | 107 0 * Bh bohrium -1.0 0.0 0.0 0 550 | 108 0 * Hs hassium -1.0 0.0 0.0 0 551 | 109 0 * Mt meitnerium -1.0 0.0 0.0 0 552 | 110 0 * Ds darmstadtium -1.0 0.0 0.0 0 553 | 111 0 * Rg roentgenium -1.0 0.0 0.0 0 554 | 112 0 * Cn copernicium -1.0 0.0 0.0 0 555 | 113 0 * Nh nihonium -1.0 0.0 0.0 0 556 | 114 0 * Fl flerovium -1.0 0.0 0.0 0 557 | 115 0 * Mc moscovium -1.0 0.0 0.0 0 558 | 116 0 * Lv livermorium -1.0 0.0 0.0 0 559 | 117 0 * Ts tennessine -1.0 0.0 0.0 0 560 | 118 0 * Og oganesson -1.0 0.0 0.0 0 561 | ''' 562 | ), 563 | delim_whitespace=True, 564 | comment='%', 565 | names=[ 566 | 'protons', 567 | 'nucleons', 568 | 'radioactive', 569 | 'symbol', 570 | 'name', 571 | 'spin', 572 | 'g', 573 | 'abundance', 574 | 'quadrupole moment', 575 | ], 576 | ).set_index(['protons', 'nucleons']) 577 | 578 | 579 | def get_nuclear_spin(atomic_number, data, spin_data): 580 | atomic_number = int(atomic_number) 581 | try: 582 | mass_number = int(data.loc[atomic_number]['mass number']) 583 | except ValueError: 584 | return '' 585 | isotope_data = spin_data.loc[atomic_number] 586 | 587 | spin = None 588 | found_mass_number = None 589 | 590 | if mass_number in isotope_data.index: 591 | found_mass_number = mass_number 592 | spin = isotope_data.loc[mass_number]['spin'] 593 | if spin == 0: 594 | spin = None 595 | found_mass_number = None 596 | prefix = '' 597 | 598 | if found_mass_number is None: 599 | isotope_data = isotope_data.sort_values('abundance', ascending=False) 600 | for A in isotope_data.index: 601 | if isotope_data.loc[A]['spin'] != 0: 602 | found_mass_number = A 603 | spin = isotope_data.loc[found_mass_number]['spin'] 604 | break 605 | if spin is None: 606 | found_mass_number = isotope_data.index[0] 607 | spin = isotope_data.loc[found_mass_number]['spin'] 608 | 609 | prefix = '~~I=' 610 | if found_mass_number != mass_number: 611 | prefix = r'%d:\,I=' % found_mass_number 612 | if int(spin) < 0: 613 | return '' 614 | if int(spin * 2) % 2 == 1: 615 | return "%s%d/2" % (prefix, int(spin * 2)) 616 | else: 617 | return "%s%d" % (prefix, spin) 618 | 619 | 620 | DATA['nuclear spin'] = pd.Series( 621 | [get_nuclear_spin(Z, DATA, SPIN_DATA) for Z in DATA.index], 622 | index=DATA.index, 623 | ) 624 | 625 | 626 | GROUPS = [ 627 | ('IA', 'Alkali metals'), 628 | ('IIA', 'Alkaline earths'), 629 | ('IB', 'Coinage metals'), 630 | ('IIIA', 'Boron group'), 631 | ('IVA', 'Carbon group'), 632 | ('VA', 'Pnictogens'), 633 | ('VIA', 'Chalcogens'), 634 | ('VIIA', 'Halogens'), 635 | ('VIIIA', 'Noble gases'), 636 | ] 637 | 638 | 639 | CATEGORIES = [ 640 | 'nonmetal', 641 | 'alkali metal', 642 | 'alkaline earth metal', 643 | 'lanthanide', 644 | 'actinide', 645 | 'transition metal', 646 | 'post-transition metal', 647 | 'metalloid', 648 | 'halogen', 649 | 'noble gas', 650 | ] 651 | 652 | 653 | HEADER = r''' 654 | \usepackage[T1]{fontenc} 655 | \usepackage[scaled=0.8]{helvet} 656 | \usepackage[misc]{ifsym} 657 | \usepackage{amsmath} 658 | \usepackage{braket} 659 | \usepackage{ccicons} 660 | \renewcommand*\familydefault{\sfdefault} 661 | \usepackage{multicol} 662 | \usepackage{pdfpages} 663 | \usepackage{tikz} 664 | \usepackage{ifthen} 665 | \usepackage[ 666 | hidelinks, 667 | pdftitle={Periodic Table}, 668 | pdfauthor={Michael Goerz}, 669 | ]{hyperref} 670 | 671 | \newcommand\colorsquare[1]{\textcolor{#1}{\rule{3mm}{3mm}}} 672 | 673 | \newcommand{\smallPeriodBox}[3][large]{% large/small, anchor, period 674 | \draw ($(#2) + (0.8,0)$) rectangle ++($(0.6cm, -1.2) - #3*(0,0.2)$); 675 | \ifthenelse{#3<2}{\node at ($(#2) + (1.1,-0.1)$) {\tiny Period};}{} 676 | \node at ($(#2) + (1.1,-0.6)$) {\Large #3}; 677 | \draw ($(#2) + (0.8,-1.2)$) -- ++(0.6cm,0); 678 | \node at ($(#2) + (1.1,-1.3)$) {\tiny K: 1}; 679 | \ifthenelse{#3>1}{% 680 | \draw[very thin] ($(#2) + (0.8,-1.4)$) -- ++(0.6cm,0); 681 | \node at ($(#2) + (1.1,-1.5)$) {\tiny L: 2}; 682 | }{}% 683 | \ifthenelse{#3>2}{% 684 | \draw[very thin] ($(#2) + (0.8,-1.6)$) -- ++(0.6cm,0); 685 | \node at ($(#2) + (1.1,-1.7)$) {\tiny M: 3}; 686 | }{}% 687 | \ifthenelse{#3>3}{% 688 | \draw[very thin] ($(#2) + (0.8,-1.8)$) -- ++(0.6cm,0); 689 | \node at ($(#2) + (1.1,-1.9)$) {\tiny N: 4}; 690 | }{}% 691 | \ifthenelse{#3>4}{% 692 | \draw[very thin] ($(#2) + (0.8,-2.0)$) -- ++(0.6cm,0); 693 | \node at ($(#2) + (1.1,-2.1)$) {\tiny O: 5}; 694 | }{}% 695 | \ifthenelse{#3>5}{% 696 | \draw[very thin] ($(#2) + (0.8,-2.2)$) -- ++(0.6cm,0); 697 | \node at ($(#2) + (1.1,-2.3)$) {\tiny P: 6}; 698 | }{}% 699 | \ifthenelse{#3>6}{% 700 | \draw[very thin] ($(#2) + (0.8,-2.4)$) -- ++(0.6cm,0); 701 | \node at ($(#2) + (1.1,-2.5)$) {\tiny Q: 7}; 702 | }{}% 703 | } 704 | \newcommand{\periodBox}[3][large]{% large/small, anchor, period 705 | \draw ($(#2) + (0.8,0)$) rectangle ++($(0.8cm, -1.2) - #3*(0,0.2)$); 706 | \node at ($(#2) + (1.2,-0.6)$) {\Large #3}; 707 | \draw ($(#2) + (0.8,-1.2)$) -- ++(0.8cm,0); 708 | \node at ($(#2) + (1.0,-1.3)$) {\tiny K}; 709 | \node at ($(#2) + (1.28,-1.3)$) {\tiny n=}; 710 | \node at ($(#2) + (1.4,-1.3)$) {\tiny 1}; 711 | \ifthenelse{#3>1}{% 712 | \draw[very thin] ($(#2) + (0.8,-1.4)$) -- ++(0.8cm,0); 713 | \node at ($(#2) + (1.0,-1.5)$) {\tiny L}; 714 | \node at ($(#2) + (1.4,-1.5)$) {\tiny 2}; 715 | }{}% 716 | \ifthenelse{#3>2}{% 717 | \draw[very thin] ($(#2) + (0.8,-1.6)$) -- ++(0.8cm,0); 718 | \node at ($(#2) + (1.0,-1.7)$) {\tiny M}; 719 | \node at ($(#2) + (1.4,-1.7)$) {\tiny 3}; 720 | }{}% 721 | \ifthenelse{#3>3}{% 722 | \draw[very thin] ($(#2) + (0.8,-1.8)$) -- ++(0.8cm,0); 723 | \node at ($(#2) + (1.0,-1.9)$) {\tiny N}; 724 | \node at ($(#2) + (1.4,-1.9)$) {\tiny 4}; 725 | }{}% 726 | \ifthenelse{#3>4}{% 727 | \draw[very thin] ($(#2) + (0.8,-2.0)$) -- ++(0.8cm,0); 728 | \node at ($(#2) + (1.0,-2.1)$) {\tiny O}; 729 | \node at ($(#2) + (1.4,-2.1)$) {\tiny 5}; 730 | }{}% 731 | \ifthenelse{#3>5}{% 732 | \draw[very thin] ($(#2) + (0.8,-2.2)$) -- ++(0.8cm,0); 733 | \node at ($(#2) + (1.0,-2.3)$) {\tiny P}; 734 | \node at ($(#2) + (1.4,-2.3)$) {\tiny 6}; 735 | }{}% 736 | \ifthenelse{#3>6}{% 737 | \draw[very thin] ($(#2) + (0.8,-2.4)$) -- ++(0.8cm,0); 738 | \node at ($(#2) + (1.0,-2.5)$) {\tiny Q}; 739 | \node at ($(#2) + (1.4,-2.5)$) {\tiny 7}; 740 | }{}% 741 | } 742 | \newcommand{\Gaseous}{\tikz{\draw (0,0) circle (2pt);}} 743 | \newcommand{\Liquid}{\tikz{\draw[very thin] (0,0) circle (2pt);% 744 | \draw[fill=black] (1.9pt,0pt) arc (0:-180:1.9pt);}} 745 | \newcommand{\valenceCell}[3]{% anchor, x, y 746 | \draw[fill=blue!20, line width=0.2pt]% 747 | ($(#1) - (0.2cm,1.2cm) + #2*(0.2cm,0) - #3*(0,0.2cm) +(0.1pt,0.2pt)$)% 748 | rectangle ++($(2mm,2mm) - (0.3pt, 0.3pt)$);% 749 | } 750 | 751 | \begin{document} 752 | \usetikzlibrary{calc} 753 | 754 | \linespread{0.35} 755 | \setlength{\parindent}{0pt} 756 | 757 | \topskip0pt 758 | \vspace*{\fill} 759 | 760 | \begin{tikzpicture}[ 761 | electron grid/.style={step=0.2cm, very thin}, 762 | electron matrix/.style={below right,inner sep=0pt,column sep={2mm,between origins}, row sep={2mm,between origins}}, 763 | el/.style={font=\tiny}, 764 | valence el/.style={fill=blue!40, inner sep=0, font=\tiny}, 765 | alkali metal/.style={fill=orange!40}, 766 | alkaline earth metal/.style={fill=orange!20}, 767 | lanthanide/.style={fill=green!10}, 768 | actinide/.style={fill=green!30}, 769 | transition metal/.style={fill=red!10}, 770 | post-transition metal/.style={fill=red!40}, 771 | metalloid/.style={fill=red!20}, 772 | nonmetal/.style={fill=yellow!50}, 773 | halogen/.style={fill=yellow!20}, 774 | noble gas/.style={fill=blue!10}, 775 | unknown/.style={fill=white}, 776 | ] 777 | 778 | %\draw[step=10mm, color=black, very thin] (0,0) grid (27,18.5); 779 | %\draw[step=5mm, color=gray, very thin] (0,0) grid (27,18.5); 780 | 781 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 782 | ''' 783 | 784 | FOOTER = r''' 785 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 786 | \smallPeriodBox{He}{1} 787 | \smallPeriodBox{Ne}{2} 788 | \smallPeriodBox{Ar}{3} 789 | \smallPeriodBox{Kr}{4} 790 | \smallPeriodBox{Xe}{5} 791 | \smallPeriodBox{Rn}{6} 792 | \smallPeriodBox{Og}{7} 793 | 794 | \end{tikzpicture} 795 | 796 | %%\begin{multicols}{3} 797 | %%\scriptsize 798 | %%electronic quantum numbers: $\ket{n,l,m_l,m_s}$ or $\ket{n,l,j,m_j}$ ($j=l\pm 1/2$) 799 | %% 800 | %%parity $\sum_i l_i$ 801 | %% 802 | %%LS Coupling: $\vec{L} = \sum_i \vec{l}_i$, $\vec{S} = \sum_i \vec{s}_i$, $\vec{J} = \vec{L} + \vec{S}$. 803 | %% 804 | %%atomic quantum numbers: $\ket{S, m_s, L, m_L}$ (uncoupled), $\ket{J,M_J,S,L}$ 805 | %%(spin-orbit-coupled) 806 | %%% https://www.nist.gov/pml/atomic-spectroscopy-compendium-basic-ideas-notation-data-and-formulas 807 | %% 808 | %%configuration \\ 809 | %%$\rightarrow$ terms (L, S, orbit-orbit interaction) \\\\ 810 | %%$\rightarrow$ fine structure levels (J, spin-orbit interaction)\\\\ 811 | %%$\rightarrow$ states ($m_J$, Zeeman effect in magnetic field) 812 | %%% http://mackenzie.chem.ox.ac.uk/teaching/Atomic%20Spectroscopy.pdf 813 | %% 814 | %%LS-couping/Russel-Saunders/Spin-Orbit coupling term symbol:\\\\ 815 | %%$^{2S+1}L_J$, e.g. $^2\text{P}_{3/2}$. 816 | %% 817 | %%selection rules 818 | %% 819 | %%hyperfine states: F = I + S, Zeeman splitting $m_F$ 820 | %% 821 | %%\end{multicols} 822 | 823 | \vspace*{\fill} 824 | 825 | \end{document} 826 | ''' 827 | 828 | 829 | def pictogram(atomic_number): 830 | """return a pictogram for the given element""" 831 | if DATA['radioactive'][atomic_number] == 'True': 832 | return r'\Radiation' 833 | if DATA['phase'][atomic_number] == 'gas': 834 | return r'\Gaseous' 835 | if DATA['phase'][atomic_number] == 'liquid': 836 | return r'\Liquid' 837 | return '' 838 | 839 | 840 | def electron_configuration(atomic_number): 841 | """Return list of tuples (n, l, electrons)""" 842 | ec_strings = DATA['electron configuration'][atomic_number].split() 843 | nobels = { 844 | '[He]': 2, 845 | '[Ne]': 10, 846 | '[Ar]': 18, 847 | '[Kr]': 36, 848 | '[Xe]': 54, 849 | '[Rn]': 86, 850 | } 851 | l_mapping = {'s': 1, 'p': 2, 'd': 3, 'f': 4} 852 | result = [] 853 | for s in ec_strings: 854 | if s in nobels: 855 | result = electron_configuration(nobels[s]) 856 | else: 857 | n = int(s[0:1]) 858 | l = l_mapping[s[1:2]] 859 | electrons = int(s[2:]) 860 | result.append((n, l, electrons)) 861 | return result 862 | 863 | 864 | def electron_matrix(atomic_number): 865 | """Return a list of lines renedering the electron configuration matrix for 866 | the given element""" 867 | result = [] 868 | configuration = electron_configuration(atomic_number) 869 | symbol = DATA['symbol'][atomic_number] 870 | n_valence = int(DATA['valence electrons'][atomic_number]) 871 | reverse_configuration = reversed(configuration) 872 | while n_valence > 0: 873 | n, l, electrons = next(reverse_configuration) 874 | n_valence -= electrons 875 | result.append( 876 | r'\valenceCell{{{symbol}}}{{{l}}}{{{n}}}'.format( 877 | symbol=symbol, l=l, n=n 878 | ) 879 | ) 880 | result.append( 881 | r'\matrix[electron matrix] at ($(%s) + (0.01,-1.225cm)$){' % symbol 882 | ) 883 | shells = defaultdict(list) 884 | for (n, l, electrons) in configuration: 885 | shells[n].append((l, electrons)) 886 | for n in sorted(shells): 887 | shell_electrons = ['', '', '', ''] 888 | for l, electrons in shells[n]: 889 | shell_electrons[l - 1] = (r'\node[el]{%2d};' % electrons).replace( 890 | " ", '~' 891 | ) 892 | result.append(r' %s & %s & %s & %s \\' % tuple(shell_electrons)) 893 | result.append(r'};') 894 | return result 895 | 896 | 897 | def x_y_position(atomic_number, lanthanide=False, actinide=False): 898 | """Return the x and y coordinate of the top left corner of the box 899 | indicating the element specified by `atomic_number`""" 900 | group_col = { 901 | 'IA': 1, 902 | 'IIA': 2, 903 | 'IIIB': 3, 904 | 'IVB': 4, 905 | 'VB': 5, 906 | 'VIB': 6, 907 | 'VIIB': 7, 908 | 'VIIIB': 8, # 9, 10 909 | 'IB': 11, 910 | 'IIB': 12, 911 | 'IIIA': 13, 912 | 'IVA': 14, 913 | 'VA': 15, 914 | 'VIA': 16, 915 | 'VIIA': 17, 916 | 'VIIIA': 18, 917 | } 918 | y_period = {1: 16.0, 2: 14.6, 3: 13.0, 4: 11.2, 5: 9.2, 6: 7.0, 7: 4.6} 919 | period = int(DATA['period'][atomic_number]) 920 | y = y_period[period] 921 | x_offset = 0.0 922 | if lanthanide: 923 | col = 3 + atomic_number - 57 924 | # y -= 5.6 925 | elif actinide: 926 | col = 3 + atomic_number - 89 927 | # y -= 5.6 928 | else: 929 | if atomic_number in [57, 89]: 930 | group = 'IIIB' 931 | else: 932 | group = DATA['group'][atomic_number] 933 | col = group_col[group] 934 | if col > 3: # make space of lanthanides/actanides 935 | col += 14 936 | x_offset = 0.2 937 | if atomic_number in [27, 45, 77, 109]: # VIIIB 2nd col 938 | col += 1 939 | elif atomic_number in [28, 46, 78, 110]: # VIIIB 3rd col 940 | col += 2 941 | x = 0.8 * (col - 1) + x_offset 942 | return "%.2f" % x, "%.2f" % y 943 | 944 | 945 | def mass_number(atomic_number): 946 | """Return a string with the mass number of the most common isotope for the 947 | given atomic_number)""" 948 | if DATA['mass number'].isnull()[atomic_number]: 949 | return '' 950 | else: 951 | val = int(DATA['mass number'][atomic_number]) 952 | return ("%3d" % val).replace(' ', '~') 953 | 954 | 955 | def atomic_mass(atomic_number): 956 | """Return a string the the relative atomic mass (averaged over all 957 | isotopes) for the given atomic_number""" 958 | if DATA['atomic mass'].isnull()[atomic_number]: 959 | return '' 960 | else: 961 | val = float(DATA['atomic mass'][atomic_number]) 962 | if val < 10: 963 | return "%.4f" % val 964 | elif val < 100: 965 | return "%.3f" % val 966 | else: 967 | return "%.2f" % val 968 | 969 | 970 | def render_element(atomic_number, lanthanide=False, actinide=False): 971 | """Render the given element""" 972 | lines = [] 973 | x, y = x_y_position( 974 | atomic_number, lanthanide=lanthanide, actinide=actinide 975 | ) 976 | fmt_data = dict( 977 | pictogram=pictogram(atomic_number), 978 | coord="(%s,%s)" % (x, y), 979 | symbol=DATA['symbol'][atomic_number], 980 | name=DATA['name'][atomic_number], 981 | nuclear_spin=DATA['nuclear spin'].replace(np.nan, '')[atomic_number], 982 | category=DATA['category'][atomic_number], 983 | mass=atomic_mass(atomic_number), 984 | atomic_number=("%3d" % atomic_number).replace(' ', '~'), 985 | mass_number=mass_number(atomic_number), 986 | period=int(DATA['period'][atomic_number]), 987 | ) 988 | 989 | element_lines = [ 990 | r'%%%% {name}', 991 | r'\node ({symbol}) at {coord} {{}};%', 992 | r'\draw[{category}] ({symbol}) rectangle ($({symbol}) + (0.8,-1.2cm)$);%', 993 | r'\node at ($({symbol}) + (0.40cm,-0.47cm)$)%', 994 | r'{{{{\tiny$_{{\text{{{atomic_number}}}}}^{{^{{\text{{{mass_number}}}}}}}$}}\text{{{symbol}}}}};', 995 | r'\node[text width=0.7 cm, text centered] at ($({symbol}) + (0.40cm,-0.78cm)$) {{\tiny {nuclear_spin}}};', 996 | r'\node at ($({symbol}) + (0.65cm,-0.22cm)$) {{\tiny {pictogram}}};', 997 | r'\node[text width=0.7 cm, text centered] at ($({symbol}) + (0.40cm,-1.00cm)$)%', 998 | r'{{\tiny {name}}};', 999 | r'\node at ($({symbol}) + (0.30cm,-0.15cm)$) {{\tiny {mass}}};', 1000 | r'\draw[electron grid] ($({symbol}) - (0,1.2) - {period}*(0,0.2) $)%', 1001 | r' grid ++($(0.8,0.0) + {period}*(0,0.2)$);%', 1002 | r'\draw ($({symbol}) - (0,1.2) - {period}*(0,0.2) $) % box around grid', 1003 | r' rectangle ++($(0.8,0.0) + {period}*(0,0.2)$);%', 1004 | r'% make non-existing electron boxes black', 1005 | r'\draw[fill=black, line width=0pt]% non-existing electron box', 1006 | r' ($({symbol}) + (0.2cm,-1.4cm)$) rectangle ++ (0.6cm,0.2cm);%', 1007 | r'\ifthenelse{{{period}>1}}{{%', 1008 | r' \draw[fill=black, line width=0pt]% non-existing electron box', 1009 | r' ($({symbol}) + (0.4cm,-1.6cm)$) rectangle ++ (0.4cm,0.2cm);%', 1010 | r'}}{{}}%', 1011 | r'\ifthenelse{{{period}>2}}{{%', 1012 | r' \draw[fill=black, line width=0pt]% non-existing electron box', 1013 | r' ($({symbol}) + (0.6cm,-1.8cm)$) rectangle ++ (0.2cm,0.2cm);%', 1014 | r'}}{{}}%', 1015 | ] 1016 | 1017 | for line in element_lines: 1018 | lines.append(line.format(**fmt_data)) 1019 | 1020 | lines.extend(electron_matrix(atomic_number)) 1021 | 1022 | lines.append("%%%%%\n") 1023 | 1024 | return "\n".join(lines) + "\n" 1025 | 1026 | 1027 | def box_legend(): 1028 | """Return array of lines that render a legend for the element boxes""" 1029 | result = [r'\begin{scope}[shift={(-17.5, 0)}]'] 1030 | result.append(render_element(35)) 1031 | x0, y0 = x_y_position(35) 1032 | result.append( 1033 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[right, align=left, font=\scriptsize]{{{text}}};'.format( 1034 | x1=(float(x0) + 4 * 0.2), 1035 | y1=float(y0), 1036 | dx=0.2, 1037 | dy=-0.4, 1038 | text=dedent( 1039 | r''' 1040 | state of matter:\\ 1041 | \begin{tabular}{rl} 1042 | {\rule{0pt}{6pt}{\Huge\Gaseous}} & gaseous \\ 1043 | {\rule{0pt}{6pt}{\Huge\Liquid}} & liquid \\ 1044 | {\rule{0pt}{6pt}{\tiny\Radiation}} & radioactive 1045 | \end{tabular} 1046 | ''' 1047 | ), 1048 | ) 1049 | ) 1050 | result.append( 1051 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[right, align=left, font=\scriptsize]{{{text}}};'.format( 1052 | x1=(float(x0) + 4 * 0.2), 1053 | y1=float(y0), 1054 | dx=-3.3, 1055 | dy=-1.7, 1056 | text=dedent( 1057 | r''' 1058 | electron configuration:\\ 1059 | $[$Ar$]$ 3d\textsuperscript{10} 4s\textsuperscript{2} 4p\textsuperscript{5}\\ 1060 | valence electrons in blue 1061 | ''' 1062 | ), 1063 | ) 1064 | ) 1065 | result.append( 1066 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[right, align=left, font=\scriptsize]{{{text}}};'.format( 1067 | x1=(float(x0) + 4 * 0.2), 1068 | y1=float(y0), 1069 | dx=0.2, 1070 | dy=-1.5, 1071 | text=dedent( 1072 | r''' 1073 | I=3/2: nuclear spin of most common isotope.\\ 1074 | When $\text{I}\!=\!\text{0}$ for most common isotope , shows \\ 1075 | "\textit{Z}:\,I=\textit{I}" for most common isotope with $\text{I}\!\neq\!\text{0}$.\\ 1076 | E.g. for $^{\text{24}}_{\text{12}}$Mg: I=0, but for $^{\text{25}}_{\text{12}}$Mg: I=5/2. 1077 | ''' 1078 | ), 1079 | ) 1080 | ) 1081 | result.append( 1082 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[align=left, font=\scriptsize]{{{text}}};'.format( 1083 | x1=(float(x0)), 1084 | y1=float(y0), 1085 | dx=0.8, 1086 | dy=0.5, 1087 | text=dedent( 1088 | r''' 1089 | 79.904: atomic weight\\ 1090 | aka. ``relative atomic mass''\\ 1091 | (average over isotopes) 1092 | ''' 1093 | ), 1094 | ) 1095 | ) 1096 | result.append( 1097 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[right, align=left, font=\scriptsize]{{{text}}};'.format( 1098 | x1=(float(x0)), 1099 | y1=float(y0), 1100 | dx=-2.5, 1101 | dy=-0.2, 1102 | text=dedent( 1103 | r''' 1104 | 79: mass number (A):\\ 1105 | number of nucleons\\ 1106 | (most common isotope) 1107 | ''' 1108 | ), 1109 | ) 1110 | ) 1111 | result.append( 1112 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[right, align=left, font=\scriptsize]{{{text}}};'.format( 1113 | x1=(float(x0)), 1114 | y1=float(y0), 1115 | dx=-2.5, 1116 | dy=-0.9, 1117 | text=dedent( 1118 | r''' 1119 | 35: atomic number (Z):\\ 1120 | number of protons\\ 1121 | ($=$ number of electrons) 1122 | ''' 1123 | ), 1124 | ) 1125 | ) 1126 | result.append( 1127 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[align=left, font=\scriptsize]{{{text}}};'.format( 1128 | x1=(float(x0) + 2.8 * 0.2), 1129 | y1=float(y0) - 1.2 - 4 * 0.2, 1130 | dx=-1.75, 1131 | dy=-0.5, 1132 | text=dedent( 1133 | r''' 1134 | Madelung ordering rule: (n+l, n)\\ 1135 | $\Rightarrow$ 1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p, 5s, 4d, \\ \hspace{3mm} 5p, 6s, 4f, 5d, 6p, 7s, 5f, 6d, 7p, \dots 1136 | ''' 1137 | ), 1138 | ) 1139 | ) 1140 | result.append( 1141 | r'\path({x1}, {y1}) -- +({dx}, {dy}) node[align=left, font=\scriptsize]{{{text}}};'.format( 1142 | x1=(float(x0) + 2.8 * 0.2), 1143 | y1=float(y0) - 1.2 - 4 * 0.2, 1144 | dx=2.2, 1145 | dy=-0.5, 1146 | text=dedent( 1147 | r''' 1148 | Nuclear spin rules: based on Z, N=A-Z\\ 1149 | even/even: I=0; odd/odd: integer I; \\ 1150 | even/odd or odd/even: half-integer I 1151 | ''' 1152 | ), 1153 | ) 1154 | ) 1155 | result.append(r'\end{scope}') 1156 | return "\n".join(result) + "\n" 1157 | 1158 | 1159 | def tex_group_label(label): 1160 | """Format group label for tex""" 1161 | if label.endswith('A') or label.endswith('B'): 1162 | return label[:-1] + r'\,' + label[-1] 1163 | else: 1164 | return label 1165 | 1166 | 1167 | def render_group_label(x_anchor, y_anchor, name): 1168 | x = float(x_anchor) + 0.4 1169 | y = float(y_anchor) + 0.15 1170 | name = tex_group_label(name) 1171 | return r'\node[above, align=center] at (%s, %s) {\large %s};' % ( 1172 | x, 1173 | y, 1174 | name, 1175 | ) 1176 | 1177 | 1178 | def render_group_labels(): 1179 | """Return array of lines the render the names of the groups""" 1180 | result = [] 1181 | anchors = [ # group name to atomic number of lightest element in group 1182 | ('IA', 1), 1183 | ('IIA', 4), 1184 | ('IIIB', 21), 1185 | ('IVB', 22), 1186 | ('VB', 23), 1187 | ('VIB', 24), 1188 | ('VIIB', 25), 1189 | ('---', 26), 1190 | ('VIIIB', 27), 1191 | ('---', 28), 1192 | ('IB', 29), 1193 | ('IIB', 30), 1194 | ('IIIA', 5), 1195 | ('IVA', 6), 1196 | ('VA', 7), 1197 | ('VIA', 8), 1198 | ('VIIA', 9), 1199 | ('VIIIA', 2), 1200 | ] 1201 | for groupname, anchor_atomic_number in anchors: 1202 | x_anchor, y_anchor = x_y_position(anchor_atomic_number) 1203 | result.append(render_group_label(x_anchor, y_anchor, groupname)) 1204 | return "\n".join(result) + "\n" 1205 | 1206 | 1207 | def render_title_box(): 1208 | """Return code to render title box""" 1209 | COMPACT = False 1210 | # If we add more information ad the bottom of the page, we'll want to 1211 | # switch to the "copact" title 1212 | if COMPACT: 1213 | result = [r'\node[align=left, anchor=north] at (6.75, 16.6) {', ] 1214 | result.append(r"{\Large \bf Periodic Table of Elements}\\~\vspace{3pt}\\" + "\n") 1215 | result.append(r"{\footnotesize\ccLogo~2018 by Michael Goerz (\url{https://michaelgoerz.net})}\\" + "\n") 1216 | result.append(r'{\footnotesize\ccAttribution~This work is licensed under a Creative Commons}\\' + "\n") 1217 | result.append(r'{\footnotesize\ccNonCommercial~\href{https://creativecommons.org/licenses/by-nc/4.0/}{"Attribution-NonCommercial 4.0 International"} license.}' + "\n") 1218 | result.append('};') 1219 | else: 1220 | result = [r'\node[align=left, anchor=west] at (0.0, 17.6) {', ] 1221 | result.append(r"{\Large \bf Periodic Table of Elements}" + "\n") 1222 | result.append('};') 1223 | result.append(r'\node[align=left, anchor=west] at (0.0, 0.75) {') 1224 | result.append(r"{\footnotesize\ccLogo\ccAttribution\ccNonCommercial~2018 by Michael Goerz (\url{https://michaelgoerz.net})}." + "\n") 1225 | result.append(r'{\footnotesize~This work is licensed under a Creative Commons}' + "\n") 1226 | result.append(r'{\footnotesize \href{https://creativecommons.org/licenses/by-nc/4.0/}{"Attribution-NonCommercial 4.0 International"} license.}' + "\n") 1227 | result.append('};') 1228 | return "\n".join(result) + "\n" 1229 | 1230 | 1231 | def render_group_table(): 1232 | """Return code to render table of groups""" 1233 | result = [r'\node[align=left, anchor=north] at (14, 16.5) {'] 1234 | result.append("{\\bf groups (CAS):}\\\\~\\\\\n") 1235 | result.append(r'\begin{tabular}{ll}') 1236 | for group, label in GROUPS: 1237 | result.append("%s & %s\\\\" % (tex_group_label(group), label)) 1238 | result.append(r'\end{tabular}\\') 1239 | result.append(r'A: main groups\\') 1240 | result.append(r'B: transition elements\vspace*{5pt}\\') 1241 | result.append(r'UIPAC: number groups 1--18') 1242 | result.append('};') 1243 | return "\n".join(result) + "\n" 1244 | 1245 | 1246 | def get_category_color(category_name): 1247 | """Return the latex color for the given category name (e.g. 'alkali 1248 | metal')""" 1249 | color_rx = re.compile(r'fill=([\w\d!]+)') 1250 | for line in HEADER.split("\n"): 1251 | if line.startswith(category_name): 1252 | return color_rx.search(line).group(1) 1253 | raise ValueError("Cannot determine color for %s" % category_name) 1254 | 1255 | 1256 | def render_category_table(): 1257 | """Return code to render table of categoriess""" 1258 | result = [r'\node[align=left, anchor=north] at (18, 16.5) {'] 1259 | result.append("{\\bf categories:}\\\\~\\\\\n") 1260 | result.append(r'\begin{tabular}{ll}') 1261 | for category_name in CATEGORIES: 1262 | color = get_category_color(category_name) 1263 | result.append("\\colorsquare{%s} & %s\\\\" % (color, category_name)) 1264 | result.append(r'\end{tabular}') 1265 | result.append('};') 1266 | return "\n".join(result) + "\n" 1267 | 1268 | 1269 | def render_quantum_numbers_grid(): 1270 | """Return to to render the grid of quantum numbers""" 1271 | result = [] 1272 | 1273 | ## spdf 1274 | x1, y1 = x_y_position(87) 1275 | x1 = float(x1) 1276 | y1 = float(y1) - 1.2 - 8 * 0.2 1277 | x2, y2 = x_y_position(103, actinide=True) 1278 | x2 = float(x2) + 0.8 1279 | y2 = float(y2) - 1.2 - 7 * 0.2 1280 | result.append( 1281 | r'\draw[electron grid] (%s, %s) grid (%s, %s);' % (x1, y1, x2, y2) 1282 | ) 1283 | result.append( 1284 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1285 | ) 1286 | for col in range(17): 1287 | result.append( 1288 | r'\node[el] at (%s, %s){s};' % (x1 + col * 0.8 + 0.1, y1 + 0.1) 1289 | ) 1290 | result.append( 1291 | r'\node[el] at (%s, %s){p};' % (x1 + col * 0.8 + 0.3, y1 + 0.075) 1292 | ) 1293 | result.append( 1294 | r'\node[el] at (%s, %s){d};' % (x1 + col * 0.8 + 0.5, y1 + 0.1) 1295 | ) 1296 | result.append( 1297 | r'\node[el] at (%s, %s){f};' % (x1 + col * 0.8 + 0.7, y1 + 0.1) 1298 | ) 1299 | # spdf 1300 | x1, y1 = x_y_position(104) 1301 | x1 = float(x1) 1302 | y1 = float(y1) - 1.2 - 8 * 0.2 1303 | x2, y2 = x_y_position(118) 1304 | x2 = float(x2) + 0.8 1305 | y2 = float(y2) - 1.2 - 7 * 0.2 1306 | result.append( 1307 | r'\draw[electron grid] (%s, %s) grid (%s, %s);' % (x1, y1, x2, y2) 1308 | ) 1309 | result.append( 1310 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1311 | ) 1312 | for col in range(15): 1313 | result.append( 1314 | r'\node[el] at (%s, %s){s};' % (x1 + col * 0.8 + 0.1, y1 + 0.1) 1315 | ) 1316 | result.append( 1317 | r'\node[el] at (%s, %s){p};' % (x1 + col * 0.8 + 0.3, y1 + 0.075) 1318 | ) 1319 | result.append( 1320 | r'\node[el] at (%s, %s){d};' % (x1 + col * 0.8 + 0.5, y1 + 0.1) 1321 | ) 1322 | result.append( 1323 | r'\node[el] at (%s, %s){f};' % (x1 + col * 0.8 + 0.7, y1 + 0.1) 1324 | ) 1325 | 1326 | ## s-block 1327 | x1, y1 = x_y_position(87) 1328 | x1 = float(x1) 1329 | y1 = float(y1) - 1.2 - 9 * 0.2 1330 | x2, y2 = x_y_position(88) 1331 | x2 = float(x2) + 0.8 1332 | y2 = float(y2) - 1.2 - 8 * 0.2 1333 | result.append( 1334 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1335 | ) 1336 | result.append( 1337 | r'\node[el] at (%s, %s){0 (s-block)};' % (0.5 * (x2 + x1), y1 + 0.1) 1338 | ) 1339 | # s 1340 | x1, y1 = x_y_position(87) 1341 | x1 = float(x1) 1342 | y1 = float(y1) - 1.2 - 11 * 0.2 1343 | x2, y2 = x_y_position(87) 1344 | x2 = float(x2) + 0.8 1345 | y2 = float(y2) - 1.2 - 10 * 0.2 1346 | result.append( 1347 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1348 | ) 1349 | result.append( 1350 | r'\node[el] at (%s, %s){+1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1351 | ) 1352 | x1, y1 = x_y_position(88) 1353 | x1 = float(x1) 1354 | y1 = float(y1) - 1.2 - 11 * 0.2 1355 | x2, y2 = x_y_position(88) 1356 | x2 = float(x2) + 0.8 1357 | y2 = float(y2) - 1.2 - 10 * 0.2 1358 | result.append( 1359 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1360 | ) 1361 | result.append( 1362 | r'\node[el] at (%s, %s){-1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1363 | ) 1364 | 1365 | ## d-block 1366 | x1, y1 = x_y_position(89, actinide=True) 1367 | x2, y2 = x1, y1 1368 | x1 = float(x1) 1369 | y1 = float(y1) - 1.2 - 9 * 0.2 1370 | x2 = float(x2) + 0.8 1371 | y2 = float(y2) - 1.2 - 8 * 0.2 1372 | result.append( 1373 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1374 | ) 1375 | result.append( 1376 | r'\node[el] at (%s, %s){2};' % (x1 + 0.5 * (x2 - x1), y1 + 0.1) 1377 | ) 1378 | # s 1379 | y1 += -0.4 1380 | y2 += -0.4 1381 | result.append( 1382 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1383 | ) 1384 | result.append( 1385 | r'\node[el] at (%s, %s){+1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1386 | ) 1387 | 1388 | ## f-block 1389 | x1, y1 = x_y_position(90, actinide=True) 1390 | x1 = float(x1) 1391 | y1 = float(y1) - 1.2 - 9 * 0.2 1392 | x2, y2 = x_y_position(103, actinide=True) 1393 | x2 = float(x2) + 0.8 1394 | y2 = float(y2) - 1.2 - 8 * 0.2 1395 | result.append( 1396 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1397 | ) 1398 | result.append( 1399 | r'\node[el] at (%s, %s){3 (f-block)};' 1400 | % (x1 + 0.5 * (x2 - x1), y1 + 0.1) 1401 | ) 1402 | # s 1403 | x1, y1 = x_y_position(90, actinide=True) 1404 | x1 = float(x1) 1405 | y1 = float(y1) - 1.2 - 11 * 0.2 1406 | x2, y2 = x_y_position(96, actinide=True) 1407 | x2 = float(x2) + 0.8 1408 | y2 = float(y2) - 1.2 - 10 * 0.2 1409 | result.append( 1410 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1411 | ) 1412 | result.append( 1413 | r'\node[el] at (%s, %s){+1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1414 | ) 1415 | x1, y1 = x_y_position(97, actinide=True) 1416 | x1 = float(x1) 1417 | y1 = float(y1) - 1.2 - 11 * 0.2 1418 | x2, y2 = x_y_position(103, actinide=True) 1419 | x2 = float(x2) + 0.8 1420 | y2 = float(y2) - 1.2 - 10 * 0.2 1421 | result.append( 1422 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1423 | ) 1424 | result.append( 1425 | r'\node[el] at (%s, %s){-1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1426 | ) 1427 | 1428 | ## d-block 1429 | x1, y1 = x_y_position(104) 1430 | x1 = float(x1) 1431 | y1 = float(y1) - 1.2 - 9 * 0.2 1432 | x2, y2 = x_y_position(112) 1433 | x2 = float(x2) + 0.8 1434 | y2 = float(y2) - 1.2 - 8 * 0.2 1435 | result.append( 1436 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1437 | ) 1438 | result.append( 1439 | r'\node[el] at (%s, %s){2 (d-block)};' 1440 | % (x1 + 0.5 * (x2 - x1), y1 + 0.1) 1441 | ) 1442 | # s 1443 | x1, y1 = x_y_position(104) 1444 | x1 = float(x1) 1445 | y1 = float(y1) - 1.2 - 11 * 0.2 1446 | x2, y2 = x_y_position(107) 1447 | x2 = float(x2) + 0.8 1448 | y2 = float(y2) - 1.2 - 10 * 0.2 1449 | result.append( 1450 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1451 | ) 1452 | result.append( 1453 | r'\node[el] at (%s, %s){+1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1454 | ) 1455 | x1, y1 = x_y_position(108) 1456 | x1 = float(x1) 1457 | y1 = float(y1) - 1.2 - 11 * 0.2 1458 | x2, y2 = x_y_position(112) 1459 | x2 = float(x2) + 0.8 1460 | y2 = float(y2) - 1.2 - 10 * 0.2 1461 | result.append( 1462 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1463 | ) 1464 | result.append( 1465 | r'\node[el] at (%s, %s){-1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1466 | ) 1467 | 1468 | ## p-block 1469 | x1, y1 = x_y_position(113) 1470 | x1 = float(x1) 1471 | y1 = float(y1) - 1.2 - 9 * 0.2 1472 | x2, y2 = x_y_position(118) 1473 | x2 = float(x2) + 0.8 1474 | y2 = float(y2) - 1.2 - 8 * 0.2 1475 | result.append( 1476 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1477 | ) 1478 | result.append( 1479 | r'\node[el] at (%s, %s){1 (p-block)};' 1480 | % (x1 + 0.5 * (x2 - x1), y1 + 0.1) 1481 | ) 1482 | # s 1483 | x1, y1 = x_y_position(113) 1484 | x1 = float(x1) 1485 | y1 = float(y1) - 1.2 - 11 * 0.2 1486 | x2, y2 = x_y_position(115) 1487 | x2 = float(x2) + 0.8 1488 | y2 = float(y2) - 1.2 - 10 * 0.2 1489 | result.append( 1490 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1491 | ) 1492 | result.append( 1493 | r'\node[el] at (%s, %s){+1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1494 | ) 1495 | x1, y1 = x_y_position(116) 1496 | x1 = float(x1) 1497 | y1 = float(y1) - 1.2 - 11 * 0.2 1498 | x2, y2 = x_y_position(118) 1499 | x2 = float(x2) + 0.8 1500 | y2 = float(y2) - 1.2 - 10 * 0.2 1501 | result.append( 1502 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' % (x1, y1, x2, y2) 1503 | ) 1504 | result.append( 1505 | r'\node[el] at (%s, %s){-1/2};' % (0.5 * (x2 + x1), y1 + 0.1) 1506 | ) 1507 | 1508 | ## m 1509 | m_labels = [ 1510 | '0', '0', '+2', '+3', '+2', '+1', '0', '-1', '-2', '-3', '+3', '+2', 1511 | '+1', '0', '-1', '-2', '-3', '+1', '0', '-1', '-2', '+2', '+1', '0', 1512 | '-1', '-2', '+1', '0', '-1', '+1', '0', '-1' 1513 | ] 1514 | for i, m_label in enumerate(m_labels): 1515 | x1, y1 = x_y_position(87 + i, actinide=(3 <= i <= 16)) 1516 | x1 = float(x1) 1517 | y1 = float(y1) - 1.2 - 10 * 0.2 1518 | x2 = x1 + 0.8 1519 | y2 = y1 + 0.2 1520 | result.append( 1521 | r'\draw[electron grid] (%s, %s) rectangle (%s, %s);' 1522 | % (x1, y1, x2, y2) 1523 | ) 1524 | result.append( 1525 | r'\node[el] at (%s, %s){%s};' 1526 | % (0.5 * (x2 + x1), y1 + 0.1, m_label) 1527 | ) 1528 | 1529 | ## labels 1530 | x0, y0 = x_y_position(118) 1531 | x0 = float(x0) + 4 * 0.2 1532 | y0 = float(y0) - 1.2 - 8 * 0.2 - 0.1 1533 | result.append( 1534 | r'\node[right, el] at (%s, %s){%s};' % (x0, y0 + 0.2, '$l$ / $n$') 1535 | ) 1536 | # result.append(r'\node[right, el] at (%s, %s){%s};' % (x0, y0-0.0, '')) 1537 | result.append( 1538 | r'\node[right, el] at (%s, %s){%s};' % (x0, y0 - 0.2, '$m_l$') 1539 | ) 1540 | result.append( 1541 | r'\node[right, el] at (%s, %s){%s};' % (x0, y0 - 0.4, '$m_s$') 1542 | ) 1543 | 1544 | return "\n".join(result) + "\n" 1545 | 1546 | 1547 | @click.command() 1548 | @click.help_option('--help', '-h') 1549 | @click.option( 1550 | '--paperwidth', 1551 | type=float, 1552 | help="The width of the page in mm. " 1553 | "Defaults to 297 for --a4 and to 279 for --letter.", 1554 | ) 1555 | @click.option( 1556 | '--paperheight', 1557 | type=float, 1558 | help="The height of the page in mm. " 1559 | "Defaults to 210 for --a4 to 215 for --letter.", 1560 | ) 1561 | @click.option( 1562 | '--left', 1563 | type=float, 1564 | help="The left page margin in mm. " 1565 | "Defaults to 15 for --a4 and to 6 for --letter.", 1566 | ) 1567 | @click.option( 1568 | '--right', 1569 | type=float, 1570 | help="The right page margin in mm. " "Defaults to the value of --left", 1571 | ) 1572 | @click.option( 1573 | '--top', 1574 | type=float, 1575 | help="The top page margin in mm. " 1576 | "Defaults to 6 for --a4 and to 8 for --letter.", 1577 | ) 1578 | @click.option( 1579 | '--bottom', 1580 | type=float, 1581 | help="The width of the page" "Defaults to the value of --top", 1582 | ) 1583 | @click.option( 1584 | '--a4', 1585 | 'paperformat', 1586 | flag_value='a4', 1587 | default=True, 1588 | help="Use layout options for A4 paper (default)", 1589 | ) 1590 | @click.option( 1591 | '--letter', 1592 | 'paperformat', 1593 | flag_value='letter', 1594 | help="User layout options for letter-sized paper", 1595 | ) 1596 | @click.argument('outfile') 1597 | def render_periodic_table( 1598 | paperwidth, paperheight, left, right, top, bottom, paperformat, outfile 1599 | ): 1600 | """Write LaTeX for a periodic table to the given OUTFILE""" 1601 | if paperformat == 'a4': 1602 | paperwidth = 297.0 if paperwidth is None else paperwidth 1603 | paperheight = 210.0 if paperheight is None else paperheight 1604 | left = 15.0 if left is None else left 1605 | right = left if right is None else right 1606 | top = 6.0 if top is None else top 1607 | bottom = top if bottom is None else bottom 1608 | elif paperformat == 'letter': 1609 | paperwidth = 279.0 if paperwidth is None else paperwidth 1610 | paperheight = 215.0 if paperheight is None else paperheight 1611 | left = 6.0 if left is None else left 1612 | right = left if right is None else right 1613 | top = 8.0 if top is None else top 1614 | bottom = top if bottom is None else bottom 1615 | else: 1616 | raise ValueError("Invalid paperformat: %s" % paperformat) 1617 | with open(outfile, 'w') as out_fh: 1618 | out_fh.write(r'\documentclass{article}' + "\n") 1619 | out_fh.write( 1620 | r'\usepackage[paperwidth=%.1fmm,paperheight=%.1fmm,left=%.1fmm,' 1621 | r'right=%.1fmm,top=%.1fmm,bottom=%.1fmm]{geometry}' 1622 | % (paperwidth, paperheight, left, right, top, bottom) 1623 | ) 1624 | out_fh.write("\n") 1625 | out_fh.write(HEADER) 1626 | for atomic_number in range(1, 119): 1627 | if atomic_number in range(57, 72): 1628 | out_fh.write(render_element(atomic_number, lanthanide=True)) 1629 | elif atomic_number in range(89, 104): 1630 | out_fh.write(render_element(atomic_number, actinide=True)) 1631 | else: 1632 | out_fh.write(render_element(atomic_number)) 1633 | out_fh.write("\n") 1634 | out_fh.write(render_title_box()) 1635 | out_fh.write(render_group_table()) 1636 | out_fh.write(render_quantum_numbers_grid()) 1637 | out_fh.write(render_category_table()) 1638 | out_fh.write(render_group_labels()) 1639 | out_fh.write(box_legend()) 1640 | out_fh.write(FOOTER) 1641 | 1642 | 1643 | if __name__ == "__main__": 1644 | render_periodic_table() 1645 | -------------------------------------------------------------------------------- /perl/perl_refcard.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goerz/Refcards/369ff0811ed18b18e5f0556d9b0383bcf0d1b5a4/perl/perl_refcard.odt -------------------------------------------------------------------------------- /perl/perl_refcard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goerz/Refcards/369ff0811ed18b18e5f0556d9b0383bcf0d1b5a4/perl/perl_refcard.pdf -------------------------------------------------------------------------------- /powers_of_ten/.gitignore: -------------------------------------------------------------------------------- 1 | /powers_of_ten.aux 2 | /powers_of_ten.log 3 | /powers_of_ten.pdf 4 | -------------------------------------------------------------------------------- /powers_of_ten/Makefile: -------------------------------------------------------------------------------- 1 | powers_of_ten.pdf: powers_of_ten.tex 2 | pdflatex powers_of_ten.tex 3 | 4 | clean: 5 | rm -f powers_of_ten.out 6 | rm -f powers_of_ten.log 7 | rm -f powers_of_ten.aux 8 | 9 | distclean: clean 10 | rm -f powers_of_ten.pdf 11 | 12 | .PHONY: all clean distclean 13 | -------------------------------------------------------------------------------- /powers_of_ten/powers_of_ten.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,10pt]{article} 2 | \usepackage{upgreek} 3 | \usepackage[cm]{fullpage} 4 | 5 | \begin{document} 6 | 7 | \begin{center} 8 | \large {\bf Powers of Ten} 9 | \vskip2ex 10 | \renewcommand{\arraystretch}{1.5} 11 | \begin{tabular}{|l|l|l|l|l|l|l|l|} 12 | \hline 13 | Exa (E) & Peta (P) & Tera (T) & Giga (G) & Mega (M) & Kilo (k) & Hekto (h) & Deka (da) \\ 14 | $10^{18}$ & $10^{15}$ & $10^{12}$ & $10^{9}$ & $10^{6}$ & $10^{3}$ & $10^{2}$ & $10^{1}$ \rule[-3ex]{0cm}{1ex} \\ 15 | \hline 16 | Deci (d) & Centi (c) & Milli (m) & Micro ($\upmu$) & Nano (n) & Pico (p) & Femto (f) & Atto (a) \\ 17 | $10^{-1}$ & $10^{-2}$ & $10^{-3}$ & $10^{-6}$ & $10^{-9}$ & $10^{-12}$ & $10^{-15}$ & $10^{-18}$ \rule[-3ex]{0cm}{1ex} \\ 18 | \hline 19 | \end{tabular} 20 | \end{center} 21 | 22 | \vskip1.5cm 23 | 24 | \begin{center} 25 | \large {\bf Powers of Ten} 26 | \vskip2ex 27 | \renewcommand{\arraystretch}{1.5} 28 | \begin{tabular}{|l|l|l|l|l|l|l|l|} 29 | \hline 30 | Exa (E) & Peta (P) & Tera (T) & Giga (G) & Mega (M) & Kilo (k) & Hekto (h) & Deka (da) \\ 31 | $10^{18}$ & $10^{15}$ & $10^{12}$ & $10^{9}$ & $10^{6}$ & $10^{3}$ & $10^{2}$ & $10^{1}$ \rule[-3ex]{0cm}{1ex} \\ 32 | \hline 33 | Deci (d) & Centi (c) & Milli (m) & Micro ($\upmu$) & Nano (n) & Pico (p) & Femto (f) & Atto (a) \\ 34 | $10^{-1}$ & $10^{-2}$ & $10^{-3}$ & $10^{-6}$ & $10^{-9}$ & $10^{-12}$ & $10^{-15}$ & $10^{-18}$ \rule[-3ex]{0cm}{1ex} \\ 35 | \hline 36 | \end{tabular} 37 | \end{center} 38 | 39 | 40 | \vskip1.5cm 41 | 42 | \begin{center} 43 | \large {\bf Powers of Ten} 44 | \vskip2ex 45 | \renewcommand{\arraystretch}{1.5} 46 | \begin{tabular}{|l|l|l|l|l|l|l|l|} 47 | \hline 48 | Exa (E) & Peta (P) & Tera (T) & Giga (G) & Mega (M) & Kilo (k) & Hekto (h) & Deka (da) \\ 49 | $10^{18}$ & $10^{15}$ & $10^{12}$ & $10^{9}$ & $10^{6}$ & $10^{3}$ & $10^{2}$ & $10^{1}$ \rule[-3ex]{0cm}{1ex} \\ 50 | \hline 51 | Deci (d) & Centi (c) & Milli (m) & Micro ($\upmu$) & Nano (n) & Pico (p) & Femto (f) & Atto (a) \\ 52 | $10^{-1}$ & $10^{-2}$ & $10^{-3}$ & $10^{-6}$ & $10^{-9}$ & $10^{-12}$ & $10^{-15}$ & $10^{-18}$ \rule[-3ex]{0cm}{1ex} \\ 53 | \hline 54 | \end{tabular} 55 | \end{center} 56 | 57 | \vskip1.5cm 58 | 59 | \begin{center} 60 | \large {\bf Powers of Ten} 61 | \vskip2ex 62 | \renewcommand{\arraystretch}{1.5} 63 | \begin{tabular}{|l|l|l|l|l|l|l|l|} 64 | \hline 65 | Exa (E) & Peta (P) & Tera (T) & Giga (G) & Mega (M) & Kilo (k) & Hekto (h) & Deka (da) \\ 66 | $10^{18}$ & $10^{15}$ & $10^{12}$ & $10^{9}$ & $10^{6}$ & $10^{3}$ & $10^{2}$ & $10^{1}$ \rule[-3ex]{0cm}{1ex} \\ 67 | \hline 68 | Deci (d) & Centi (c) & Milli (m) & Micro ($\upmu$) & Nano (n) & Pico (p) & Femto (f) & Atto (a) \\ 69 | $10^{-1}$ & $10^{-2}$ & $10^{-3}$ & $10^{-6}$ & $10^{-9}$ & $10^{-12}$ & $10^{-15}$ & $10^{-18}$ \rule[-3ex]{0cm}{1ex} \\ 70 | \hline 71 | \end{tabular} 72 | \end{center} 73 | 74 | 75 | \end{document} 76 | -------------------------------------------------------------------------------- /python24/python_refcard.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goerz/Refcards/369ff0811ed18b18e5f0556d9b0383bcf0d1b5a4/python24/python_refcard.odt -------------------------------------------------------------------------------- /python24/python_refcard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goerz/Refcards/369ff0811ed18b18e5f0556d9b0383bcf0d1b5a4/python24/python_refcard.pdf -------------------------------------------------------------------------------- /vim/.gitignore: -------------------------------------------------------------------------------- 1 | /vimqrc.log 2 | /vimqrc.pdf 3 | -------------------------------------------------------------------------------- /vim/Makefile: -------------------------------------------------------------------------------- 1 | vimqrc.pdf: vimqrc.tex 2 | pdftex vimqrc.tex 3 | 4 | clean: 5 | rm -f vimqrc.log 6 | 7 | distclean: clean 8 | rm -f vimqrc.pdf 9 | 10 | .PHONY: all clean distclean 11 | -------------------------------------------------------------------------------- /vim/vimqrc.tex: -------------------------------------------------------------------------------- 1 | 2 | % VIM Quick Reference Card 3 | % Copyright (c) 2009 Michael Goerz. 4 | % TeX Format 5 | 6 | % compile as 'pdftex vimqrc.tex' 7 | 8 | \pdfoutput=1 9 | \pdfpageheight=21cm 10 | \pdfpagewidth=29.7cm 11 | 12 | % suppress all hyphenation 13 | \tolerance=1 14 | \emergencystretch=\maxdimen 15 | \hyphenpenalty=10000 16 | \hbadness=10000 17 | 18 | \pdfinfo { 19 | /Title (Vim Quick Reference Card) 20 | /Author (Michael Goerz) 21 | /Subject (Vim Text Editor) 22 | /Keywords (Movements, Insertion, Replace and Deletion, Insert Mode, Search and 23 | Substitution, Formatting, Filtering, Visual Mode, Undoing and Repeating, 24 | Registers, Copying, Patterns, Spell Checking, Marks, Motions and Tags, Multiple 25 | Files and Buffers, Scrolling, Multi-Windowing, Ex Commands and Ranges, 26 | Completion, Folding, Compiling) 27 | } 28 | 29 | % Font definitions 30 | \font\bigbf=cmbx12 31 | \font\smallrm=cmr8 32 | \font\smalltt=cmtt8 33 | \font\tinyit=cmmi5 34 | 35 | \def\title#1{\hfil{\bf #1}\hfil\par\vskip 2pt\hrule} 36 | \def\cm#1#2{{\tt#1}\dotfill#2\par} 37 | \def\cn#1{\hfill$\lfloor$ #1\par} 38 | \def\section#1{\vskip 0.7cm {\it#1\/}\par} 39 | 40 | % Characters definitions 41 | \def\\{\hfil\break} 42 | \def\bs{$\backslash$} 43 | \def\backspace{$\leftarrow$} 44 | \def\ctrl{{\rm\char94}\kern-1pt} 45 | \def\enter{$\hookleftarrow$} 46 | \def\or{\thinspace{\tinyit{or}}\thinspace} 47 | \def\key#1{$\langle${\rm{\it#1\/}}$\rangle$} 48 | \def\rapos{\char125} 49 | \def\lapos{\char123} 50 | \def\bs{\char92} 51 | \def\tild{\char126} 52 | \def\lbracket{[} 53 | \def\rbracket{]} 54 | 55 | % Three columns definitions 56 | \parindent 0pt 57 | \nopagenumbers 58 | \hoffset=-1.56cm 59 | \voffset=-1.54cm 60 | \newdimen\fullhsize 61 | \fullhsize=27.9cm 62 | \hsize=8.5cm 63 | \vsize=19cm 64 | \def\fullline{\hbox to\fullhsize} 65 | \let\lr=L 66 | \newbox\leftcolumn 67 | \newbox\midcolumn 68 | \output={ 69 | \if L\lr 70 | \global\setbox\leftcolumn=\columnbox 71 | \global\let\lr=M 72 | \else\if M\lr 73 | \global\setbox\midcolumn=\columnbox 74 | \global\let\lr=R 75 | \else 76 | \tripleformat 77 | \global\let\lr=L 78 | \fi\fi 79 | \ifnum\outputpenalty>-20000 80 | \else 81 | \dosupereject 82 | \fi} 83 | \def\tripleformat{ 84 | \shipout\vbox{\fullline{\box\leftcolumn\hfil\box\midcolumn\hfil\columnbox}} 85 | \advancepageno} 86 | \def\columnbox{\leftline{\pagebody}} 87 | 88 | % Card content 89 | % Header 90 | %\hrule\vskip 3pt 91 | \title{VIM QUICK REFERENCE CARD} 92 | 93 | \vskip 0.5cm 94 | \cm{:viusage }{Show a summary of all commands } 95 | 96 | \section{Movements} 97 | \cm{h l k j }{character left, right; line up, down } 98 | \cm{b w }{word/token left, right } 99 | \cm{ge e }{end of word/token left, right} 100 | \cm{\lapos\ \rapos }{beginning of previous, next paragraph} 101 | \cm{( ) }{beginning of previous, next sentence} 102 | \cm{0 \^\ \$ }{beginning, first, last character of line} 103 | \cm{$n$G $n$gg }{line $n$, default the last, first} 104 | \cm{$n|$ }{column $n$ of current line} 105 | \cm{\% }{match of next brace, bracket, comment, {\tt\#define}} 106 | \cm{- + }{line up, down on first non-blank character} 107 | \cm{B W }{space-separated word left, right} 108 | \cm{gE E }{end of space-separated word left, right} 109 | \cm{g0 gm }{beginning, middle of {\it screen\/} line} 110 | \cm{g\^\ g\$ }{first, last character of {\it screen\/} line} 111 | \cm{f$c$ F$c$ }{next, previous occurence of character $c$} 112 | \cm{t$c$ T$c$ }{before next, previous occurence of $c$} 113 | 114 | 115 | \section{Insertion \& Replace $\to$ insert mode} 116 | \cm{i a }{insert before, after cursor} 117 | \cm{I A }{insert at beginning, end of line} 118 | \cm{gI }{insert text in first column} 119 | \cm{o O }{open a new line below, above the current line} 120 | \cm{r$c$ }{replace character under cursor with $c$} 121 | \cm{gr$c$ }{like {\tt r}, but without affecting layout} 122 | \cm{R }{replace characters starting at the cursor} 123 | \cm{gR }{like {\tt R}, but without affecting layout} 124 | \cm{c$m$ }{change text of movement command $m$} 125 | \cm{cc\or S }{change current line} 126 | \cm{C }{change to the end of line} 127 | 128 | \section{Deletion} 129 | \cm{x X }{delete character under, before cursor} 130 | \cm{d$m$ }{delete text of movement command $m$} 131 | \cm{dd D }{delete current line, to the end of line} 132 | \cm{J gJ }{join current line with next, without space} 133 | \cm{:$r$d } {delete range $r$ lines} 134 | \cm{:$r$d$x$ } {delete range $r$ lines into register $x$} 135 | 136 | \section{Insert Mode} 137 | \cm{\ctrl V$c$ \ctrl V$n$ }{insert char $c$ literally, decimal value $n$} 138 | \cm{\ctrl V$n$ }{insert decimal value of character} 139 | \cm{\ctrl A }{insert previously inserted text} 140 | \cm{\ctrl @ }{same as {\tt\ctrl A} and stop insert $\to$ command mode} 141 | \cm{\ctrl R$x$ \ctrl R\ctrl R$x$ }{insert content of register $x$, literally} 142 | \cm{\ctrl N \ctrl P }{text completion before, after cursor} 143 | \cm{\ctrl W }{delete word before cursor} 144 | \cm{\ctrl U }{delete all inserted character in current line} 145 | \cm{\ctrl D \ctrl T }{shift left, right one shift width} 146 | \cm{\ctrl K$c_1$$c_2$\or $c_1$\kern-1pt\backspace$c_2$ }{enter digraph $\{c_1,c_2\}$} 147 | \cm{\ctrl O$c$ }{execute $c$ in temporary command mode} 148 | \cm{\ctrl X\ctrl E \ctrl X\ctrl Y }{scroll up, down} 149 | \cm{\key{esc}\or \ctrl\lbracket}{abandon edition $\to$ command mode} 150 | 151 | %\vskip 0.4cm 152 | \section{Search \& Substitution} 153 | \cm{/$s$\enter\ ?$s$\enter }{search forward, backward for $s$} 154 | \cm{/$s$/$o$\enter\ ?$s$?$o$\enter }{search fwd, bwd for $s$ with offset $o$} 155 | \cm{n\or /\enter }{repeat forward last search} 156 | \cm{N\or ?\enter }{repeat backward last search} 157 | \cm{\# * }{search backward, forward for word under cursor} 158 | \cm{g\# g* }{same, but also find partial matches} 159 | \cm{gd gD }{local, global definition of symbol under cursor} 160 | \cm{:$r$s/$f$/$t$/$x$ } {substitute $f$ by $t$ in range $r$} 161 | \cn{$x:$ {\tt g}---all occurrences, {\tt c}---confirm changes} 162 | \cm{:$r$s $x$ } {repeat substitution with new $r$ \& $x$} 163 | 164 | %\vskip 0.4cm 165 | \section{Formatting/Filtering} 166 | $m$ is movement; leave out for visual mode commands \\ 167 | \cm{gq$m$}{format $m$ ({\it formatprg})} 168 | \cm{gqgq \or gqip}{format current paragraph} 169 | \cm{$=m$}{reindent movement $m$ ({\it equalprg})} 170 | \cm{:$r$ce $w$ } {center lines in range $r$ to width $w$} 171 | \cm{:$r$le $i$ } {left align lines in range $r$ with indent $i$} 172 | \cm{:$r$ri $w$ } {right align lines in range $r$ to width $w$} 173 | \cm{!$m$$c$\enter }{filter lines of movement $m$ through command $c$} 174 | \cm{$n$!!$c$\enter }{filter $n$ lines through command $c$} 175 | \cm{:$r$!$c$ } {filter range $r$ lines through command $c$} 176 | \cm{\tild }{switch case and advance cursor} 177 | \cm{g\tild{$m$} gu$m$ gU$m$ }{switch case, lc, uc on movement $m$} 178 | \cm{$<$$m$ $>$$m$ }{shift left, right text of movement $m$} 179 | \cm{$n$$<$\kern-3pt$<$ $n$$>$\kern-3pt$>$ }{shift $n$ lines left, right} 180 | \cm{\ctrl A \ctrl X}{increment/decrement number under cursor} 181 | 182 | %\vskip 0.8cm 183 | \section{Visual Mode \& Text Objects} 184 | \cm{v V \ctrl V }{highlight characters, lines, block} 185 | \cm{o }{exchange cursor pos with start of highlighting} 186 | \cm{gv }{start highlighting on previous visual area} 187 | \cm{aw as ap }{select a word, a sentence, a paragraph} 188 | \cm{ab aB a] a$>$}{select a block ( ), {\tt\lapos} {\tt\rapos}, [~] $<$~$>$} 189 | \cm{at}{select an html tag} 190 | \cm{a" a' a`}{select a quotet string} 191 | \cm{iw is ip ib iB i] i$>$ it i" i' i`}{select ``inner''} 192 | \cm{$n\hskip -0.3em>$ $n\hskip -0.3em<$ $=$ }{indent/unindent $n$ levels, reindent} 193 | 194 | \vskip -0.2cm 195 | \section{Undoing, Repeating \& Registers} 196 | \cm{u U }{undo last command, restore last changed line} 197 | \cm{.\thinspace\thinspace\ctrl R }{repeat last changes, redo last undo} 198 | \cm{$n$.\ }{repeat last changes with count replaced by $n$ } 199 | \cm{q$c$ q$C$ }{record, append typed characters in register $c$} 200 | \cm{q }{stop recording} 201 | \cm{@$c$ }{execute the content of register $c$} 202 | \cm{@@ }{repeat previous {\tt @} command} 203 | \cm{:@$c$ } {execute register $c$ as an {\it Ex\/} command} 204 | 205 | 206 | \vskip -0.2cm 207 | \section{Copying (Yanking)} 208 | \cm{"$x$ }{use register $x$ for next delete, yank, put} 209 | \cm{:reg [$x$] } {show content registers/$x$ reg} 210 | \cm{y$m$ }{yank the text of movement command $m$} 211 | \cm{yy\or Y }{yank current line into register} 212 | \cm{p P }{put register after, before cursor position} 213 | \cm{\rbracket p \lbracket p }{like {\tt p}, {\tt P} with indent adjusted} 214 | \cm{gp gP }{like {\tt p}, {\tt P} leaving cursor after new text} 215 | 216 | 217 | 218 | \section{Patterns (differences to Perl) ~~ {\tt :help pattern}} 219 | \cm{\bs$<$ \bs$>$ }{start, end of word} 220 | \cm{\bs i \bs k \bs I \bs K }{an identifier, keyword; excl. digits} 221 | \cm{\bs f \bs p \bs F \bs P }{a file name, printable char.; excl. digits} 222 | \cm{\bs e \bs t \bs r \bs b }{\key{esc}, \key{tab}, \key{\enter}, \key{$\gets$}} 223 | \cm{\bs = * \bs + }{match $0..1$, $0..\infty$, $1..\infty$ of preceding atoms} 224 | \cm{\bs$\{n,m\}$ }{match $n$ to $m$ occurrences} 225 | \cm{\bs$\{-\}$ }{non-greedy match} 226 | \cm{\bs$|$ }{separate two branches ($\equiv$ {\it or\/})} 227 | \cm{\bs( \bs) }{group patterns into an atom} 228 | \cm{\bs \& \bs{}1 }{the whole matched pattern, $1^{st}$ {\tt()} group} 229 | \cm{\bs u \bs l }{upper, lowercase character} 230 | \cm{\bs c \bs C }{ignore, match case on next pattern} 231 | \cm{\bs \%x }{match hex character} 232 | \cm{\bs @= \bs @! }{\tt (?=pattern) (?!pattern)\rm} 233 | \cm{\bs @$<$= \bs @$<$! }{\tt (?$<$=pattern) (?$<$!pattern)\rm} 234 | \cm{\bs @$>$ }{\tt (?$>$pattern)\rm } 235 | \cm{\bs\_\^{} \bs\_\$ }{start-of-line/end-of-line, anywhere in pattern} 236 | \cm{\bs\_. }{any single char, including end-of-line} 237 | \cm{\bs zs \bs ze }{set start/end of pattern} 238 | \cm{\bs \%\^{} \bs\%\$ }{match start/end of file} 239 | \cm{\bs\%{}V }{match inside visual area} 240 | \cm{\bs\tt'\rm m }{match with position of mark m} 241 | \cm{\bs\%(\bs) }{unnamed grouping} 242 | \cm{\bs\_$[$ $]$ }{collection with end-of-line included} 243 | \cm{\bs\%$[$ $]$ }{sequence of optionally matched atoms} 244 | \cm{\bs{}v }{very magic: patterns almost like perl} 245 | 246 | 247 | \vskip -0.2cm 248 | \section{Spell Checking} 249 | \cm{:set spell spelllang=de\_20 } {activate spellcheck} 250 | \cm{$]$s }{next misspelled word} 251 | \cm{zg zG }{add good word (to internal word list)} 252 | \cm{zw zW }{mark bad word (to internal word list)} 253 | \cm{z= }{suggest corrections} 254 | 255 | \section{Marks, Motions, and Tags} 256 | \cm{m$c$ }{mark current position with mark $c\in[a..Z]$} 257 | \cm{`$c$ `$C$ }{go to mark $c$ in current, $C$ in any file} 258 | \cm{`\/` `\/" }{go to position before jump, at last edit} 259 | \cm{`[ `] }{go to start, end of previously operated text} 260 | \cm{:marks } {print the active marks list} 261 | \cm{:jumps } {print the jump list} 262 | \cm{$n$\ctrl O }{go to $n^{th}$ older position in jump list} 263 | \cm{$n$\ctrl I }{go to $n^{th}$ newer position in jump list} 264 | \cm{\ctrl ] \ctrl T }{jump to the tag under cursor, return from tag} 265 | \cm{:ts $t$ } {list matching tags and select one for jump} 266 | \cm{:tj $t$ } {jump to tag or select one if multiple matches} 267 | \cm{gf }{open file which filename is under cursor} 268 | \cm{:tags } {print tag list} 269 | 270 | \section{Multiple Files / Buffers (\enter)} 271 | \cm{:tab ball }{show buffer tablist} 272 | \cm{:buffers }{show list of buffers} 273 | \cm{:buffer n }{switch to buffer n} 274 | \cm{:badd f.txt }{load file into new buffer} 275 | \cm{:bdelete n }{delete buffer n (also with filename)} 276 | \cm{:bnext :bprev :bfirst :blast }{buffer movement} 277 | 278 | 279 | 280 | \section{Scrolling \& Multi-Windowing} 281 | \cm{\ctrl D \ctrl U \ctrl F \ctrl B}{scroll half / full page page down, up} 282 | \cm{zt zz zb }{current line to top, center, bottom of win} 283 | \cm{:[v]split \ctrl Ws \ctrl Wv} {split window (horiz., vert.)} 284 | \cm{:vert help}{open help vertically} 285 | \cm{\ctrl Wf \ctrl W]}{open file, tag in split} 286 | \cm{:[v]new \ctrl W\ctrl n } {new empty window (horiz., vert.)} 287 | \cm{:on \ctrl Wo} {make current win the only one} 288 | \cm{\ctrl Wj \ctrl Wk \ctrl Wh \ctrl Wl }{move down, up, left, right to win} 289 | \cm{\ctrl WJ \ctrl WK \ctrl WH \ctrl WL }{move win down, up, left, right} 290 | \cm{\ctrl W$n$+ \ctrl W$n$- }{increase/decrease win size by $n$ lines} 291 | \cm{\ctrl W$n>$ \ctrl W$n<$ }{increase/decrease window width} 292 | \cm{\ctrl W$n$\_ \ctrl W$n$|}{set height/width (max if no $n$)} 293 | \cm{\ctrl W=}{Make win size equal} 294 | \cm{\ctrl Wr \ctrl Wx}{Rotate, exchange windows} 295 | \cm{\ctrl Wc}{close window} 296 | 297 | \vskip -0.2cm 298 | \section{Misc Ex Commands (\enter) ~~ \tt{:help holy-grail}} 299 | \cm{:e $f$ }{edit file $f$, reload current file if no $f$} 300 | \cm{:$r$~w $f$ }{write range $r$ to file $f$ (current file if no $f$)} 301 | \cm{:$r$~w$>$\kern-3pt$>$$f$ }{append range $r$ to file $f$} 302 | \cm{:$r$~g[!]/$p$/$cmd$ }{ex $cmd$ on range $r$ [not] matching $p$} 303 | \cm{:q :q! }{quit and confirm, quit and discard changes} 304 | \cm{:wq\or :x\or ZZ }{write to current file and exit} 305 | \cm{:r $f$ }{insert content of file $f$ below cursor} 306 | \cm{:r!\ $c$ }{insert output of command $c$ below cursor} 307 | \cm{:$r$c\ $a$ :$r$m\ $a$ }{copy, move range $r$ below line $a$} 308 | 309 | 310 | 311 | \vskip -0.2cm 312 | \section{Ex Ranges} 313 | \cm{, ;\ }{separates two lines numbers, set to first line } 314 | \cm{$n$ }{an absolute line number $n$} 315 | \cm{.\thinspace\thinspace\thinspace\$ }{the current line, the last line in file} 316 | \cm{\% * }{entire file, visual area} 317 | \cm{'$t$ }{position of mark $t$} 318 | \cm{/$p$/ ?$p$? }{the next, previous line where $p$ matches} 319 | \cm{+$n$ -$n$ }{$+n$, $-n$ to the preceding line number} 320 | 321 | 322 | \vskip -0.2cm 323 | \section{Completion} 324 | \cm{\ctrl{}X\ctrl{}L}{whole lines} 325 | \cm{\ctrl{}X\ctrl{}N \ctrl{}X\ctrl{}I}{keywords in current file, plus included files} 326 | \cm{\ctrl{}X\ctrl{}K \ctrl{}X\ctrl{}N}{keywords in dictionary, thesaurus} 327 | \cm{\ctrl{}X\ctrl{}] \ctrl{}X\ctrl{}F \ctrl{}X\ctrl{}D}{tags, filenames, defs/macros} 328 | \cm{\ctrl{}X\ctrl{}V}{vim command line} 329 | \cm{\ctrl{}X\ctrl{}U \ctrl{}X\ctrl{}O}{user defined, omni- completion} 330 | 331 | 332 | 333 | \section{Folding} 334 | \cm{:set fdm=indent } {indent-foldmethod} 335 | \cm{zf$m$ }{create fold of movement $m$} 336 | \cm{:$r$fo }{create fold for range $r$} 337 | \cm{zd zE }{delete fold at cursor, all in window} 338 | \cm{zo zc zO zC }{open, close one fold; recursively} 339 | \cm{[z ]z }{move to start, end of current open fold} 340 | \cm{zj zk }{move down, up to start, end of next fold} 341 | \cm{zm zM }{fold more, close all folds} 342 | \cm{zr zR }{fold less, open all folds} 343 | \cm{zn zN zi }{fold non, fold normal, invert folding} 344 | \cm{:set foldcolumn=4 } {show foldcolumn} 345 | 346 | \section{Compiling} 347 | \cm{:compiler $c$ }{set/show compiler plugins} 348 | \cm{:make } {run {\tt makeprg}, jump to first error} 349 | \cm{:cope } {navigate errors from make} 350 | \cm{:cn :cp } {display the next, previous error} 351 | \cm{:cl :cf } {list all errors, read errors from file} 352 | 353 | 354 | 355 | \section{Miscellaneous} 356 | \cm{:sh :!$c$ } {start shell, execute command $c$ in shell} 357 | \cm{K }{run {\tt keywordprg} (man) on word under cursor} 358 | \cm{\ctrl L }{redraw screen} 359 | \cm{\ctrl G }{show cursor column, line, and character position} 360 | \cm{:set cuc } {show cursor column visually} 361 | \cm{ga }{show A{\smallrm SCII} value of character under cursor} 362 | \cm{:mkview $[f]$ :loadview $[f]$ }{save/load configuration} 363 | \cm{:set ff=dos } {convert file to dos eol format} 364 | \cm{:e ++ff=unix } {reopen file in unix eol format} 365 | \cm{:write ++enc=utf-8}{Write file in utf-8} 366 | \cm{:set hlsearch } {highlight searches} 367 | \cm{:$r$hardcopy > file.ps }{print range to ps file} 368 | \cm{:set list }{show listchar characters (tabs etc.)} 369 | 370 | % Footer 371 | \vfill \hrule\smallskip 372 | {\smallrm This card may be freely distributed under 373 | the terms of the GNU general public licence --- 374 | Copyright \copyright\ {\oldstyle 2010} by Michael Goerz. 375 | {\smalltt https://michaelgoerz.net}. Based on original by 376 | Laurent Gr\'egoire ({\smalltt http://tnerual.eriogerg.free.fr/})} 377 | % Ending 378 | \supereject 379 | \if L\lr \else\null\vfill\eject\fi 380 | \if L\lr \else\null\vfill\eject\fi 381 | \bye 382 | 383 | % EOF 384 | -------------------------------------------------------------------------------- /vimlatex/.gitignore: -------------------------------------------------------------------------------- 1 | /vimlatexqrc.log 2 | /vimlatexqrc.pdf 3 | -------------------------------------------------------------------------------- /vimlatex/Makefile: -------------------------------------------------------------------------------- 1 | vimlatexqrc.pdf: vimlatexqrc.tex 2 | pdftex vimlatexqrc.tex 3 | 4 | clean: 5 | rm -f vimlatexqrc.log 6 | 7 | distclean: clean 8 | rm -f vimlatexqrc.pdf 9 | 10 | .PHONY: all clean distclean 11 | -------------------------------------------------------------------------------- /vimlatex/vimlatexqrc.tex: -------------------------------------------------------------------------------- 1 | 2 | % VIM Quick Reference Card 3 | % Copyright (c) 2002 Laurent Gregoire. 4 | % TeX Format 5 | 6 | 7 | % Note: Comment the following line (\input outopt.tex) if you want 8 | % to generate yourself the card, either in DVI or PDF format. 9 | % Uncomment the three next lines for PDF generation. 10 | % Command for DVI : tex vimqrc.tex 11 | % Command for PDF : pdftex vimqrc.tex 12 | 13 | % \input outopt.tex 14 | 15 | % \pdfoutput=1 16 | \pdfpageheight=21cm 17 | \pdfpagewidth=29.7cm 18 | 19 | % Font definitions 20 | \font\bigbf=cmbx12 21 | \font\smallrm=cmr8 22 | \font\smalltt=cmtt8 23 | \font\tinyit=cmmi5 24 | 25 | \def\\{\hfil\break} 26 | 27 | \def\title#1{\hfil{\bf #1}\hfil\par\vskip 2pt\hrule} 28 | \def\cm#1#2{{\tt#1} \dotfill {#2}\par} 29 | \def\cmlong#1#2{{\tt#1}\\{}\indent{~~~}#2\par} 30 | \def\cn#1{\hfill$\lfloor$ #1\par} 31 | \def\sect#1{\vskip 0.7cm {\it#1\/}\par} 32 | 33 | % Characters definitions 34 | \def\bs{$\backslash$} 35 | \def\backspace{$\leftarrow$} 36 | \def\ctrl{{\rm\char94}\kern-1pt} 37 | \def\enter{$\hookleftarrow$} 38 | \def\or{\thinspace{\tinyit{or}}\thinspace} 39 | \def\key#1{$\langle${\rm{\it#1\/}}$\rangle$} 40 | \def\rapos{\char125} 41 | \def\lapos{\char123} 42 | \def\bs{\char92} 43 | \def\bt{\`{}} 44 | \def\lt{\char60} 45 | \def\gt{\char62} 46 | \def\plus{$+$} 47 | \def\lbracket{\char123} 48 | \def\rbracket{\char125} 49 | \def\tild{\char126} 50 | \def\hat{\char94} 51 | \def\percent{\char37} 52 | \def\dollar{\char36} 53 | \def\atsign{\char64} 54 | \def\andsign{\char38} 55 | \def\vertbar{\char124} 56 | \def\placeholder{\lt{}\char43\char43\gt{}} 57 | \def\brplaceholder{\lbracket{}\placeholder\rbracket{}} 58 | 59 | % Three columns definitions 60 | \parindent 0pt 61 | \nopagenumbers 62 | \hoffset=-1.56cm 63 | \voffset=-1.54cm 64 | \newdimen\fullhsize 65 | \fullhsize=27.9cm 66 | \hsize=8.5cm 67 | \vsize=19cm 68 | \def\fullline{\hbox to\fullhsize} 69 | \let\lr=L 70 | \newbox\leftcolumn 71 | \newbox\midcolumn 72 | \output={ 73 | \if L\lr 74 | \global\setbox\leftcolumn=\columnbox 75 | \global\let\lr=M 76 | \else\if M\lr 77 | \global\setbox\midcolumn=\columnbox 78 | \global\let\lr=R 79 | \else 80 | \tripleformat 81 | \global\let\lr=L 82 | \fi\fi 83 | \ifnum\outputpenalty>-20000 84 | \else 85 | \dosupereject 86 | \fi} 87 | \def\tripleformat{ 88 | \shipout\vbox{\fullline{\box\leftcolumn\hfil\box\midcolumn\hfil\columnbox}} 89 | \advancepageno} 90 | \def\columnbox{\leftline{\pagebody}} 91 | 92 | % Card content 93 | % Header 94 | %\hrule\vskip 3pt 95 | \title{VIM LATEX-SUITE REFERENCE CARD} 96 | 97 | 98 | \vskip 0.3cm 99 | \sect{Latex-Suite Macros} 100 | \cm{\key{Ctrl-J}}{jump to next place holder} 101 | \cmlong{:call IMAP('\bt{}w', '\bs{}omega', 'tex')\enter}{override macro} 102 | \cm{\dots\bs\lt{}CR\gt{}\dots}{newline in macro} 103 | \cm{:set g:Imap\_FreezeImap=1\enter}{pause macro extension} 104 | \cm{\key{F5}}{insert/wrap in environment} 105 | \cm{\key{Shift-F5}}{change environment} 106 | \cm{\key{F7}}{insert/enclose in/make word into command} 107 | 108 | \vskip 0.2cm 109 | \sect{Environment Macros} 110 | \cm{ELI (,li)}{list} 111 | \cm{EDE (,de)}{description} 112 | \cm{EEN (,en)}{enumerate} 113 | \cm{EIT (,it)}{itemize} 114 | \cm{ETE (,te)}{table} 115 | \cm{ETG (,tg)}{tabbing} 116 | \cm{ETR (,tr)}{tabular} 117 | \cm{EAR (,ar)}{array} 118 | \cm{EEQ (,eq)}{equation} 119 | \cm{ECE (,ce)}{center} 120 | \cm{EFL (,fl)}{flushleft} 121 | \cm{EFR (,fr)}{flushright} 122 | \cm{EQN (,qn)}{quotation} 123 | \cm{EQE (,qe)}{quote} 124 | \cm{EVM (,vm)}{verbatim} 125 | \cm{EVE (,ve)}{verse} 126 | \cm{EOV (,ov)}{overlay} 127 | \cm{ESL (,sl)}{slide} 128 | \cm{SPA (,pa)}{part} 129 | \cm{SCH (,ch)}{chapter} 130 | \cm{SSE (,se)}{section} 131 | \cm{SSS (,ss)}{subsection} 132 | \cm{SS2 (,s2)}{subsubsection} 133 | \cm{SPG (,pg)}{paragraph} 134 | \cm{SSP (,sp)}{subparagraph} 135 | \cm{EFI (,fi)}{figure} 136 | \cm{EMP (,mp)}{minipage} 137 | 138 | \vskip 0.3cm 139 | \sect{Font Macros} 140 | \cm{FBF (\bt{}bf)}{bfseries} 141 | \cm{FMD (\bt{}md)}{mdseries} 142 | \cm{FTT (\bt{}tt)}{ttfamily} 143 | \cm{FSF (\bt{}sf)}{sffamily} 144 | \cm{FRM (\bt{}rm)}{rmfamily} 145 | \cm{FUP (\bt{}up)}{upshape} 146 | \cm{FSL (\bt{}sl)}{slshape} 147 | \cm{FSC (\bt{}sc)}{scshape} 148 | \cm{FIT (\bt{}it)}{itshape} 149 | \cm{FEM (\bt{}em)}{emph} 150 | 151 | \sect{Greek and Auc-Tex Bindings} 152 | \cm{\bt{}a \dots \bt{}z } 153 | {lowercase greek letters $\alpha$ \dots $\zeta$} 154 | \cm{\bt{}D\bt{}F\bt{}G\bt{}Q\bt{}L\bt{}X\bt{}Y\bt{}S\bt{}U\bt{}W } 155 | {$\Delta$$\Phi$$\Gamma$$\Theta$$\Lambda$$\Xi$$\Psi$$\Sigma$$\Upsilon$$\Omega$} 156 | \cm{\bt{}\hat{} } 157 | {\tt\bs{}Hat\brplaceholder{}\placeholder{}} 158 | \cm{\bt{}\_ } 159 | {\tt\bs{}bar\brplaceholder{}\placeholder{}} 160 | \cm{\bt{}6 } 161 | {\tt\bs{}partial} 162 | \cm{\bt{}8 } 163 | {\tt\bs{}infty} 164 | \cm{\bt{}/{} } 165 | {\tt\bs{}frac\brplaceholder{}\brplaceholder{}\placeholder{}} 166 | \cm{\bt{}\percent{} } 167 | {\tt\bs{}frac\brplaceholder{}\brplaceholder{}\placeholder{}} 168 | \cm{\bt{}\atsign{} } 169 | {\tt\bs{}circ} 170 | \cm{\bt{}0 } 171 | {\tt\hat{}\bs{}circ} 172 | \cm{\bt{}$=$ } 173 | {\tt\bs{}equiv} 174 | \cm{\bt{}\bs{} } 175 | {\tt\bs{}setminus} 176 | \cm{\bt{}.} 177 | {\tt\bs{}cdot} 178 | \cm{\bt{}*{} } 179 | {\tt\bs{}times} 180 | \cm{\bt{}\andsign{} } 181 | {\tt\bs{}wedge} 182 | \cm{\bt{}$-$ } 183 | {\tt\bs{}bigcap} 184 | \cm{\bt{}$+$ } 185 | {\tt\bs{}bigcup} 186 | \cm{\bt{}$($ } 187 | {\tt\bs{}subset} 188 | \cm{\bt{}$)$ } 189 | {\tt\bs{}supset} 190 | \cm{\bt{}$<$ } 191 | {\tt\bs{}le} 192 | \cm{\bt{}$>$ } 193 | {\tt\bs{}ge} 194 | \cm{\bt{}$,$ } 195 | {\tt\bs{}nonumber} 196 | \cm{\bt{}\tild{} } 197 | {\tt\bs{}\tild{}\brplaceholder{}\placeholder{}} 198 | \cm{\bt{};{} } 199 | {\tt\bs{}dot\brplaceholder{}\placeholder{}} 200 | \cm{\bt{}:{} } 201 | {\tt\bs{}ddot\brplaceholder{}\placeholder{}} 202 | \cm{\bt{}2 } 203 | {\tt\bs{}sqrt\brplaceholder{}\placeholder{}} 204 | \cm{\bt{}\vertbar } 205 | {\tt\bs{}Big\vertbar} 206 | \cm{\bt{}I } 207 | {\tt\bs{}int\_\brplaceholder{}\hat{}\brplaceholder{}\placeholder{}} 208 | \cm{\bt{}( } 209 | {\rm{}enclose selection in \tt{}()} 210 | \cm{\bt{}[ } 211 | {\rm{}enclose selection in \tt{}[]} 212 | \cm{\bt{}\lbracket{} } 213 | {\rm{}enclose selection in \tt{}\lbracket\rbracket} 214 | 215 | \sect{Alt Key Macros} 216 | \cm{\key{Alt-L}}{\rm{}extend bracket constructs or insert label} 217 | \cm{\key{Alt-B}}{\rm{}enclose previous character in \tt{}\bs{}mathbf\lbracket\rbracket} 218 | \cm{\key{Alt-C}}{\rm{}enclose in \tt{}\bs{}mathcal\lbracket\rbracket \rm{} or insert citation} 219 | \cm{\key{Alt-I}}{\rm{}insert list item intelligently} 220 | 221 | \sect{Latex Completion} 222 | \cm{\key{F9}}{\rm{}do a completion (ref, cite, filename)} 223 | \cm{\bs{}ref\lbracket{}pre\key{F9}}{complete ref, label starting with 'pre'} 224 | \cm{\bs{}cite\lbracket{}pre\key{F9}}{complete cite} 225 | 226 | \sect{Compiling, Viewing, Searching} 227 | \cm{\bs{}ll}{compile} 228 | \cm{\bs{}lv}{compile selected text} 229 | \cm{\bs{}ls}{forward searching in dvi} 230 | \cmlong{:set g:Tex\_CompileRule\_\lt{}fmt\gt{} = '\dots'\enter} 231 | {set compilation rule (\tt{}fmt\rm{} is \tt{}dvi\rm{}, \tt{}pdf\rm{}, etc.)} 232 | \cmlong{:let g:Tex\_FormatDependency\_pdf = 'dvi,pdf'\enter} 233 | {define dependency} 234 | \cmlong{:let g:Tex\_MultipleCompileFormats = 'dvi'\enter} 235 | {generate dvi target in multiple passes (intelligently)} 236 | \cmlong{:TCLevel 3\enter} 237 | {ignore warnings matching first 3 patterns in \\ \tt{}g:Tex\_IgnoredWarnings\rm{}} 238 | \cmlong{:TCLevel strict\enter} 239 | {display all errors and warnings} 240 | \cmlong{:let g:Tex\_DefaultTargetFormat = 'pdf'\enter} 241 | {set default target to pdf} 242 | \cmlong{:let g:Tex\_ViewRule\_dvi = 'yap -1'\enter} 243 | {set dvi viewer} 244 | 245 | 246 | 247 | \sect{Folding} 248 | \cm{\bs{}rf }{refresh folding} 249 | \cm{za }{fold/unfold} 250 | \cmlong{Tex\_FoldedSections Tex\_FoldedEnvironments \\ 251 | Tex\_FoldedCommands Tex\_FoldedMisc} 252 | {variables containing info on what to fold} 253 | 254 | \sect{Multiple File Projects} 255 | \cm{main.tex.latexmain}{master file} 256 | 257 | \vfil \break 258 | \sect{Latex-Suite Commands} 259 | \cm{:TTemplate [{template}]\enter}{choose template from list} 260 | \cm{:TMacro [{macro}]\enter}{insert macro template} 261 | \cm{:TMacroEdit [{macro}]\enter}{open macro for editing} 262 | \cm{:TMacroNew\enter}{create new macro template} 263 | \cm{:TMacroDelete [{macro}]\enter}{delete macro template} 264 | \cm{:TPackage\enter}{insert a \tt{}\bs{}usepackage\rm{}} 265 | \cm{:TPackageUpdate\enter}{support for package under cursor} 266 | \cm{:TPackageUpdateAll\enter}{scan file, update packages} 267 | \cm{:TSection [{arg}]}{insert section of specified level} 268 | \cm{:TSectionAdvanced}{advanced section interactively} 269 | \cm{:TLook {arg}\enter}{search for arg in tex files} 270 | \cm{:TLookBib {arg}\enter}{search for arg in bib files} 271 | \cm{:TLookAll {arg}\enter}{search for arg in all files} 272 | \cm{:TPartComp\enter}{compile part of the file} 273 | \cm{:TPartView\enter}{show last compiled fragment} 274 | \cm{:Tshortcuts [gefsma]\enter}{show shortcuts in terminal} 275 | 276 | 277 | \sect{Misc Settings and Tricks} 278 | \cm{\key{Ctrl-v}" }{Insert real quotation mark} 279 | \cmlong{:let g:Tex\_SmartQuoteOpen = "\bt{}\bt{}"\enter}{define opening quotation mark} 280 | \cmlong{:let g:Tex\_SmartQuoteClose = "'{}'{}"\enter}{define closing quotation mark} 281 | \cmlong{call IMAP('SSS', 'SSS', 'tex')}{disable mapping} 282 | \cmlong{:let g:Imap\_UsePlaceHolders = 0\enter}{disable placeholders} 283 | 284 | \sect{Personal Additions} 285 | \cm{EEQ *EEQ}{equation} 286 | \cm{ESPL}{split} 287 | \cm{EMU *EMU}{multiline} 288 | \cm{EGA *EGA}{gather} 289 | \cm{EAL *EAL}{align} 290 | 291 | \sect{Movement} 292 | \cm{[[, ]]}{previous/next section} 293 | \cm{[], ][}{line after previous/before next section} 294 | 295 | \vfil \break 296 | \sect{Objects} 297 | \cm{ic, ac}{commands} 298 | \cm{id, ad}{delimiters} 299 | \cm{ie, ae}{LaTeX environments} 300 | \cm{i\$, a\$}{inline math structures} 301 | 302 | \sect{Other} 303 | \cm{dsc, dse, ds\$}{delete surroundings command/env.} 304 | \cm{csc, cse, cs\$}{change surroundings command/env.} 305 | \cm{tse}{toggle starred environment} 306 | \cm{tsd}{toggle between e.g. {() \tt} and \tt{}\bs{}left(\bs{}right)} 307 | 308 | % Footer 309 | \vfill \hrule\smallskip 310 | {\smallrm This card may be freely distributed under 311 | the terms of the GNU general public licence --- 312 | Copyright \copyright\ {\oldstyle 2018} by Michael Goerz --- v0.92 --- 313 | {\smalltt https://michaelgoerz.net/}. With additions from Alex Goldhoorn 314 | ({\smalltt http://alex.goldhoorn.net/}). 315 | } 316 | 317 | 318 | 319 | % Ending 320 | \supereject 321 | \if L\lr \else\null\vfill\eject\fi 322 | \if L\lr \else\null\vfill\eject\fi 323 | \bye 324 | 325 | % EOF 326 | --------------------------------------------------------------------------------