-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaTeX shortcuts.ahk
291 lines (232 loc) · 5.47 KB
/
LaTeX shortcuts.ahk
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#Requires AutoHotkey v1
#Warn
#NoEnv
#SingleInstance, Force
SendMode, Input
SetBatchLines, -1
SetWorkingDir, %A_ScriptDir%
defaultVariable := "x"
#If (WinActive("ahk_exe Obsidian.exe") || WinActive("ahk_exe Code.exe"))
"::$
!"::\
^"::
SendRaw, "
KeyWait, LCtrl
Return
+"::& ; new object
; !^"::Send, \[\]{Left 2}
; !+"::Send, \(\){Left 2}
F1::Send, {{}
F2::Send, {}}
F3::SendRaw, _
F4::
SendRaw, ^^
Send, {Backspace}
Return
!F1::Send, (
!F2::Send, )
!F3::[
!F4::]
!F5::
Send, !{F4}
ExitApp
; -----------------------------------------------------
; send command
sc(cmdName) {
Send, \%cmdName%{{}{}}{Left}
Return
}
; send command with two parameters
sct(cmdName) {
Send, \%cmdName%{{}{}}{{}{}}{Left 3}
Return
}
; send command with a blank modifier
scm(cmdName) {
Send, \%cmdName%[]{{}{}}{Left}
Return
}
; send command without curly brackets
scw(cmdName) {
Send, \%cmdName%
Return
}
; send, command without curly brackets & with space
scws(cmdName) {
Send, {Space}\%cmdName%{Space}
Return
}
; -----------------------------------------------------
; !q::Send, $${Left} ; inline math
!q:: ; align environment (use \\ at the end of expression)
SendRaw, $$
Send, {Enter}
SendRaw \begin{flalign}
Send, {Enter 4}
SendRaw,\end{flalign}
Send, {Enter}
SendRaw,$$
Send, {Up 3}
Return
!w:: ; sans serif text
sc("textsf")
Return
!+w:: ; sans serif math
sc("mathsf")
Return
!^w:: ; roman math
sc("mathrm")
Return
!e:: ; functions
sc("mathrm")
Send, {Right}\left(\right){Left 7}
Return
!+e:: ; chemical expression
sc("ce")
Return
!t:: ; times symbol
scws("times")
Return
; -----------------------------
!a:: ; description for units
sct("underset")
Send, \left(\textsf{{}{}}\right){Left 8}
Return
!s:: ; space
scw(":")
Return
!d:: ; displaystyle derivative with default variable
sct("dfrac")
Send, \mathrm{{}d{}}{Right 2}\mathrm{{}d{}}%defaultVariable%{Left 13}
Return
!^d:: ; displaystyle derivative
sct("dfrac")
Send, \mathrm{{}d{}}{Right 2}\mathrm{{}d{}}
Return
!+d:: ; derivative with default variable
sct("frac")
Send, \mathrm{{}d{}}{Right 2}\mathrm{{}d{}}%defaultVariable%{Left 13}
Return
!+^d:: ; derivative
sct("frac")
Send, \mathrm{{}d{}}{Right 2}\mathrm{{}d{}}
Return
!f:: ; displaystyle fraction
sct("dfrac")
Return
!+f:: ; fraction
sct("frac")
Return
!ı:: ; hatimath
scw("hat\imath")
Return
!j:: ; hatjmath
scw("hat\jmath")
Return
!k::
scw("lim")
Return
!l:: ; limits
scw("limits")
SendRaw, _{}^{}
Send, {Left 4}
Return
!+l:: ; limits
scw("limits")
SendRaw, ^{}
Send, {Left}
Return
!^l:: ; limits
scw("limits")
SendRaw, _{}
Send, {Left}
Return
; -----------------------------
!z::
scw("left")
Return
!+z::
scw("left(")
Return
!^z::
scw("left[")
Return
!^+z::
scw("left|")
Return
!x::
scw("right")
Return
!+x::
scw("right)")
Return
!^x::
scw("right]")
Return
!^+x::
scw("right|")
Return
!c:: ; sqroot
sc("sqrt")
Return
!+c:: ; nthroots
scm("sqrt")
Return
!v:: ; vectors
sc("vec")
Return
; FIX mathrm{d}
!b:: ; displaystyle integral with default variable
scw("displaystyle\int")
Send, {Space 2}\mathrm{{}d{}}%defaultVariable%{Left 12}
Return
!^b:: ; displaystyle integral
scw("displaystyle\int")
Return
!+b:: ; integral with default variable
scw("int")
Send, {Space 2}\mathrm{{}d{}}%defaultVariable%{Left 12}
Return
!+^b:: ; integral
scw("int")
Return
; FIX mathrm{d}
!m:: ; matrix
SendRaw, \begin{bmatrix}
Send, {Space 2}
SendRaw, \end{bmatrix}
Send, {Left 14}
Return
; -----------------------------
; ; for navigating through sct commands
; !Right::Send, {Right 2}
; !Left::Send, {Left 2}
; ; for navigating through /left(/right)
; !+Right::Send, {Right 7}
; !+Left::Send, {Left 7}
; !^Right::Send, {Right 7}
; !^Left::Send, {Left 7}
#If
#IfWinActive, ahk_exe Obsidian.exe
!+q::
a = ````````
Send, %a%{BackSpace}slide-note
Send, {Enter 2}{Down}{End}{Enter}{Up 3}
Send, file:{Space}%Clipboard%.pdf{Down}
Send, page:{Space}{End}
KeyWait, LAlt
KeyWait, LShift
Return
AppsKey::
Send, ^v
Send, {Enter}
KeyWait, LWin
Send, !{Tab}
Return
#IfWinActive
#If, WinActive("ahk_exe mpc-hc64.exe") Or WinActive("ahk_exe okular.exe")
"::#+s
#If
CapsLock::Suspend
!CapsLock::Reload
^!CapsLock::ExitApp