forked from ma-anwar/mathfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatex_defs.py
223 lines (209 loc) · 5.75 KB
/
latex_defs.py
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
from talon import Context, Module
mod = Module()
ctx = Context()
mod.list("tex_document_classes", desc="TeX document classes")
mod.list("tex_packages", desc="TeX packages")
ctx.lists["user.tex_document_classes"] = {
"article": "article",
"beamer": "beamer",
"book": "book",
"letter": "letter",
"proceedings": "proc",
"report": "report",
}
ctx.lists["user.tex_packages"] = {
"AMS math": "amsmath",
# "bib latex" = ["[style=authoryear]", "biblatex"]
"colour": "color",
"geometry": "geometry",
"hyper ref": "hyperref",
"graphic X": "graphicx",
"math tools": "mathtools",
"multi col": "multicol",
"long table": "longtable",
"tabular X": "tabularx",
"X color": "xcolor",
"wrap figure": "wrapfig",
"ticks": "tikz",
}
mod.list("tex_environments", desc="TeX environments")
ctx.lists["user.tex_environments"] = {
"abstract": "abstract",
"add margin": "addmargin",
"align": "align",
"center": "center",
"columns": "columns",
# "column" = ["column", "{0.5\\textwidth}"]
"column": "column",
"cases": "cases",
"display cases": "dcases",
"definition": "definition",
"description": "description",
"document": "document",
"(enumerate | numbered list)": "enumerate",
"equation": "equation",
# "figure" = ["figure", "[h!]"]
"figure": "figure",
"flush left": "flushleft",
"flush right": "flushright",
"frame": "frame",
"(list | itemise)": "itemize",
"mini page": "minipage",
# "multi (cols | columns)" = ["multicols", "{2}"]
"multi line": "multline",
"proof": "proof",
"quotation": "quotation",
"quote": "quote",
"split": "split",
# "table" = ["table", "[h!]\n\\centering"]
# "long table" = ["longtable", "{lll}"]
# "tabular" = ["tabular", "{llll}"]
# "tabular X" = ["tabular X", "{l X}"]
"tick picture" : "tikzpicture",
"theorem": "theorem",
"title page": "titlepage",
"verbatim": "verbatim",
"verse": "verse",
"wrap figure": "wrapfigure",
}
mod.list("tex_commands", desc="TeX commands")
ctx.lists["user.tex_commands"] = {
"author": "author",
"[add] bib resource": "addbibresource",
"caption": "caption",
"chapter": "chapter",
"simple citation": "cite",
"frame title": "frametitle",
"footnote": "footnote",
"footnote text": "footnotetext[]",
"graphics path": "graphicspath",
"[include] graphics": "includegraphics[width=1\\textwidth]",
"label": "label",
"new command": "newcommand{}[]",
"paragraph": "paragraph",
"paren cite": "parencite",
"part": "part",
"reference": "ref",
"renew command": "renewcommand",
"sub paragraph": "subparagraph",
"(section | heading)": "section",
"sub (section | heading)": "subsection",
"sub sub (section | heading)": "subsubsection",
"text cite": "textcite",
"[text] bold": "textbf",
"[text] italics": "textit",
"[text] slanted": "textsl",
"emphasis": "emph",
"title": "title",
"use theme": "usetheme",
# Accents
"grave [accent]": "`",
"acute [accent]": "'",
"dot [accent]": ".",
"breve [accent]": "u",
"(circumflex | hat)": "^",
"(umlaut | dieresis)": '"',
"(tilde | squiggle)": "~",
"(macron | bar)": "=",
}
mod.list("tex_commands_noarg", desc="TeX commands without arguments")
ctx.lists["user.tex_commands_noarg"] = {
"centering": "centering",
"column": "column{0.5\\textwidth}",
"footnote mark": "footnotemark[]",
"horizontal line": "hline",
"(lah | lay) tech": "LaTeX~ ",
"line break": "linebreak",
"[list] item": "item",
"make title": "maketitle",
"new page": "newpage",
"no indent": "noindent",
"page break": "pagebreak",
"print bibliography": "printbibliography",
"table of contents": "tableofcontents",
"tech": "TeX~ ",
"text backslash": "textbackslash",
"text height": "textheight",
"text width": "textwidth",
"vertical line": "vline",
}
#mod.list("tikz_commands", desc='Tickz commands for drawing')
#ctx.lists['tikz_commands'] = {
# 'draw': 'draw',
# 'fill draw' : 'filldraw',
# "command": "tikz",
# 'clip':'clip',
# 'fill':'fill',
# 'bounding box':'useaboundingbox',
# 'shade':'shade',
# 'shade draw':'shadedraw',
# 'rectangle path':'rectanglepath',
# 'path':'path',
# 'for each':'foreach',
# 'display style':'displaystyle',
# 'color let':'colorlet',
# 'coordinate':'coordinate',
#
#
#
#
#}
mod.list("tex_templates", desc="TeX templates")
ctx.lists["user.tex_templates"] = {
"header": r'''
\documentclass[12pt, a4paper]{article}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.3}
''',
# ------------------------------------
"beamer": r'''
\documentclass{beamer}
\usetheme{metropolis}
\usepackage{graphicx}
\usepackage[style=authoryear]{biblatex}
\addbibresource{}
\begin{document}
\begin{frame}
\frametitle{}
\end{frame}
\end{document}
''',
# ------------------------------------
"(graphic | figure)": r'''
\begin{figure}[h!]
\centering
\label{}
\includegraphics[width=1\textwidth]{}
\caption{}
\end{figure}
''',
# ------------------------------------
"figure": r'''
\begin{wrapfigure}{l}{0.5\textwidth}
\centering
\label{}
\includegraphics[width=0.4\textwidth]{}
\caption{}
\end{wrapfigure}
''',
# ------------------------------------
"table": r'''
\begin{table}[h!]
\centering
\label{}
\begin{tabular}{ccccc}
& & & & \\
\hline
& & & & \\
\end{tabular}
\caption{}
\end{table}
'''
}
# mod.list("tex_packages", desc="TeX packages")
# ctx.lists["tex_packages"] = {}