-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjh.sty
144 lines (129 loc) · 6.15 KB
/
jh.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
\usepackage[usenames,dvipsnames]{color}
\definecolor{listingsbackground}{RGB}{244,245,213}
\usepackage{listings}
% from: http://en.wikibooks.org/wiki/LaTeX/Packages/Listings
\lstset{ %
% language=Octave, % the language of the code
basicstyle=\scriptsize\ttfamily, % the size of the fonts that are used for the code
% \stringstyle=\ttfamily, % use typewriter type
% numbers=left, % where to put the line-numbers
% numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
% stepnumber=2, % the step between two line-numbers. If it's 1, each line
% will be numbered
% numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{listingsbackground}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
% frame=single, % adds a frame around the code
tabsize=4, % sets default tabsize to 4 spaces
captionpos=b, % sets the caption-position to bottom
% breaklines=true, % sets automatic line breaking
% breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
% title=\lstname, % show the filename of files included with \lstinputlisting;
% also try caption instead of title
% escapeinside={\%*}{*)}, % if you want to add a comment within your code
% morekeywords={*,...} % if you want to add more keywords to the set
}
% Note: you can refine the choices with something like:
% \lstset{language=C,caption={Descriptive Caption Text},label=DescriptiveLabel}
\usepackage{amsmath,amssymb}
% Dash code stolen from tugboat.dtx
\def\thinskip{\hskip 0.16667em\relax}
\def\endash{--}
\def\emdash{\endash-}
\def\d@sh#1#2{\unskip#1\thinskip#2\thinskip\ignorespaces}
\def\dash{\d@sh\nobreak\endash}
\def\Dash{\d@sh\nobreak\emdash}
\def\ldash{\d@sh\empty{\hbox{\endash}\nobreak}}
\def\rdash{\d@sh\nobreak\endash}
\def\Ldash{\d@sh\empty{\hbox{\emdash}\nobreak}}
\def\Rdash{\d@sh\nobreak\emdash}
% Some handy definitions
% functions
\newcommand{\fcn}[3]{\mbox{$#1\colon #2\to #3$}}
\newcommand{\map}[3]{\fcn{#1}{#2}{#3}}
\newcommand{\mapsunder}[1]{\stackrel{#1}{\longmapsto}} % for elets: d |-> c
\newcommand{\mapsvia}[1]{\xrightarrow{#1}} % for fcns: D -> C
% doesn't seem to be in mathtools: \newcommand{\mapsunder}[1]{\xrightmapsto{#1}}
\newcommand{\xmapsunder}[1]{\mapsunder{#1}}
\newcommand{\composed}[2]{#1\mathbin{\circ} #2}
% \newcommand{\identity}{\mbox{id}}
\DeclareMathOperator{\identity}{id}
\newcommand{\restrictionmap}[2]{{#1}\mathord\upharpoonright_{#2}}
% sets
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
% emptyset
\renewcommand{\emptyset}{\varnothing}
% sets
% \newcommand{\set}[1]{\{ #1 \}}
% setbuilder notation see http://tex.stackexchange.com/questions/5502/how-to-get-a-mid-binary-relation-that-grows
\newcommand{\setspacing}{0.1em} % space between opening bbrace and set elet, and closing brace and set elet. Note: \,=\thinspace=0.16667em
\newcommand{\set}[1]{\mbox{$\{\hspace{\setspacing}#1\hspace{\setspacing}\}$}}
% \newcommand{\relmiddle}[1]{\mathrel{}\middle#1\mathrel{}}
% \newcommand{\suchthat}{\relmiddle|}
\newcommand{\suchthat}{\bigm|}
\newcommand{\setbuilder}[2]{\{#1 \suchthat #2\}}
\newcommand{\union}{\cup}
\newcommand{\intersection}{\cap}
% \newcommand{\setcomp}[1]{{#1}^\complement} % http://tex.stackexchange.com/questions/15984/what-symbol-should-one-use-for-a-set-complement
\newcommand{\setcomp}[1]{\overline{#1}}
% for set complement from http://tex.stackexchange.com/questions/22100/the-bar-and-overline-commands
\newsavebox\myboxA
\newsavebox\myboxB
\newlength\mylenA
% Use like: |\xoverline{W}|~~|\xoverline{i}|~~|\xoverline[3.0]{i}|$
% \newcommand*\xoverline[2][0.75]{%
% \sbox{\myboxA}{$\m@th#2$}%
% \setbox\myboxB\null% Phantom box
% \ht\myboxB=\ht\myboxA%
% \dp\myboxB=\dp\myboxA%
% \wd\myboxB=#1\wd\myboxA% Scale phantom
% \sbox\myboxB{$\m@th\overline{\copy\myboxB}$}% Overlined phantom
% \setlength\mylenA{\the\wd\myboxA}% calc width diff
% \addtolength\mylenA{-\the\wd\myboxB}%
% \ifdim\wd\myboxB<\wd\myboxA%
% \rlap{\hskip 0.5\mylenA\usebox\myboxB}{\usebox\myboxA}%
% \else
% \hskip -0.5\mylenA\rlap{\usebox\myboxA}{\hskip 0.5\mylenA\usebox\myboxB}%
% \fi}
% \renewcommand{\setcomp}[1]{\xoverline{#1}} % if you change this back you may want to eliminate some parens, as in \setcomp{(A\union B)}.
\renewcommand{\setcomp}[1]{{#1}^{\mspace{1mu}\mathsf{c}}}
\newcommand{\charfcn}[1]{\raisebox{0.0ex}{$\chi$}_{#1}} % looks too low, to me
% \usepackage{bbm}
% \newcommand{\charfcn}[1]{\mathbbm{1}_{#1}}
\newcommand{\sequence}[1]{ \langle#1\rangle }
\newcommand{\seq}[1]{\sequence{#1}}
% dots used in an interval, perhaps equal to or in place of \ldots
% \newcommand{\idots}{..}
\newcommand{\idots}{\mathinner{\ldotp\ldotp}}
% intervals
\newcommand{\jh@int}[4]{#1#3\:\idots\:#4#2}
\newcommand{\closed}[2]{\jh@int{[}{]}{#1}{#2}}
\newcommand{\leftclosed}[2]{\jh@int{[}{)}{#1}{#2}}
\newcommand{\rightclosed}[2]{\jh@int{(}{]}{#1}{#2}}
\newcommand{\open}[2]{\jh@int{(}{)}{#1}{#2}}
\newcommand{\divides}{\mid}
\newcommand{\ndivides}{\nmid}
% power set
\usepackage{mathrsfs}
\newcommand{\powerset}{\mathscr{P}}
% equivalence class
\usepackage{stmaryrd}
\newcommand{\eqclass}[1]{\llbracket #1 \rrbracket}
% floor, ceiling
\newcommand{\floor}[1]{\lfloor #1 \rfloor}
\newcommand{\ceiling}[1]{\lceil #1 \rceil}
\renewcommand{\div}{\operatorname{div}}
% length of a string
\DeclareMathOperator*{\lh}{lh}
\usepackage{graphicx}
% Vertically center graphics
% ex: \vcenteredhbox{\usegraphics{mygraph.png}}
% From http://tex.stackexchange.com/questions/7219/how-to-vertically-center-two-images
\newcommand*{\vcenteredhbox}[1]{\begingroup
\setbox0=\hbox{#1}\parbox{\wd0}{\box0}\endgroup}