-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
326 lines (242 loc) · 11 KB
/
index.html
File metadata and controls
326 lines (242 loc) · 11 KB
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
<!DOCTYPE html>
<!-- built by Dan Lynch in Berkeley and San Francisco -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>LaTeX2JS | Interactive Math Equations and Diagrams</title>
<meta property="og:title" content="LaTeX2JS | Interactive Math Equations and Diagrams">
<meta name="title" content="LaTeX2JS | Interactive Math Equations and Diagrams">
<meta name="keywords"
content="Interactive Mathematics Diagrams and Equations, Dan Lynch, UC Berkeley, LaTeX, PSTricks, JavaScript">
<meta name="description" http-equiv="description"
content="Build interactive math equations and diagrams online using LaTeX and PSTricks">
<meta property="og:description"
content="Build interactive math equations and diagrams online using LaTeX and PSTricks">
<meta property="og:type" content="article">
<meta property="og:image" content="https://latex2js.com/assets/images/share.jpg" />
<meta property="og:image:secure_url" content="https://latex2js.com/assets/images/share.jpg" />
<meta property="og:image:type" content="image/jpeg" />
<meta property="og:image:width" content="1024" />
<meta property="og:image:height" content="768" />
<meta property="og:site_name" content="LaTeX2JS">
<link href="https://fonts.googleapis.com/css?family=Arbutus+Slab" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/assets/css/latex2js.css">
<link rel="stylesheet" href="/assets/css/website.css">
<script src="/assets/js/latex2html5.bundle.js"></script>
</head>
<body>
<div class="latex-container">
<h1>LaTeX2JS</h1>
<h2>Author interactive math equations and diagrams online using $\LaTeX$ and PSTricks</h2>
<hr>
<div class="centered">
<img src="/assets/images/photo.png">
</div>
<hr>
<p>This project is the frontend only version of the code that originated from <a href="http://www.mathapedia.com/"
target="youlovemathdontyou">Mathapedia</a> to enable real-time, dynamic authorship of mathematical ebooks</p>
$$\frac{\delta}{\delta u} \int_{birth}^{death} f(life) du = \mbox{your life}$$
<hr>
<div class="centered">
<p> Proud to support the best </p>
<a href="/installation/vue.html">
<img src="/assets/images/vue.png" width="50px">
</a>
<a href="/installation/react.html">
<img src="/assets/images/react.png" width="50px">
</a>
<a href="/installation/html5.html">
<img src="/assets/images/html5.png" width="50px">
</a>
</div>
<hr>
<div class="centered">
<h3> Installation </h3>
<p>You will also find installation instructions <a href="/installation/index.html" target="install">here</a>.</p>
<h3> Examples </h3>
<p>
Get inspired, and make sure you see <a href="/examples/index.html">the PSTricks examples here</a>!
</p>
<h3> Get Started </h3>
<p>
To get started, check out the <a href="https://github.com/Mathapedia/LaTeX2JS/tree/main/examples">example apps
on Github</a>, or view source. Play in the sandbox <a href="http://mathapedia.com/latex"
target="mathsand">here</a>.
</p>
<h3> Documentation </h3>
<p>There's also quite a bit of documentation <a href="http://mathapedia.com/books/31/sections/176"
target="mathapedia">here</a></p>
<h4> Help spread the word! </h4>
<p>
If you've built anything cool with LaTeX2JS, please <a href="https://twitter.com/mathapedia"
target="share">share!</a>
</p>
</div>
</div>
<hr>
<script type="text/latex">
\begin{pspicture}(0,-3)(8,3)
\rput(0,0){$x(t)$}
\rput(4,1.5){$f(t)$}
\rput(4,-1.5){$g(t)$}
\rput(8.2,0){$y(t)$}
\rput(1.5,-2){$h(t)$}
\psframe(1,-2.5)(7,2.5)
\psframe(3,1)(5,2)
\psframe(3,-1)(5,-2)
\rput(4,0){$X_k = \frac{1}{p} \sum \limits_{n=\langle p\rangle}x(n)e^{-ik\omega_0n}$}
\psline{->}(0.5,0)(1.5,0)
\psline{->}(1.5,1.5)(3,1.5)
\psline{->}(1.5,-1.5)(3,-1.5)
\psline{->}(6.5,1.5)(6.5,0.25)
\psline{->}(6.5,-1.5)(6.5,-0.25)
\psline{->}(6.75,0)(7.75,0)
\psline(1.5,-1.5)(1.5,1.5)
\psline(5,1.5)(6.5,1.5)
\psline(5,-1.5)(6.5,-1.5)
\psline(6,-1.5)(6.5,-1.5)
\pscircle(6.5,0){0.25}
\psline(6.25,0)(6.75,0)
\psline(6.5,0.5)(6.5,-0.5)
\end{pspicture}
Many of us think our thoughts using a language of some sort---there is usually some voice in our minds. Language in some ways, makes us who we are. Some even argue in the world of cognitive science that language is the foundation of our consciousness.
An author who has in their minds representations of intelligent concepts should be able to freely express herself through language with free association---digital expressions of these ideas in some cases requires total control of the computer and all of its processes.
The vision behind the personal computer was that any person could have full command of the functions of their device. I think this vision has come true to some degree, but not fully when it comes to creating graphics, especially mathematical diagrams online.
Does the common mathematician or professor have the ability to express concepts through web technology? The Web has its own language, and the goal of this project is to help blur the lines between what authoring the mathematical Web should be like and typesetting beautiful Math.
If you know \LaTeX, then get ready to author interactive diagrams in real-time (try using mouse or touch to interact with diagrams).
What matters most is minimizing the distance between our expression of an idea and the execution of that idea. For example, I can describe a vector at $(0,0)$ and initial value of the head at $(2,2)$ that will follow a user touch or mouse event. This will produce the following interaction:
\begin{center}
\begin{pspicture}(-2,-2)(2,2)
\psframe(-2,-2)(2,2)
\userline[linewidth=1.5 pt]{->}(0,0)(2,2)
\end{pspicture}
\end{center}
This was as easy as using this \TeX, which many math professors could understand.
\begin{verbatim}
\begin{pspicture}(-2,-2)(2,2)
\psframe(-2,-2)(2,2)
\userline[linewidth=1.5 pt]{->}(0,0)(2,2)
\end{pspicture}
\end{verbatim}
If you specify more arguments, you can create functions for the head and and tail of the vector, which each takes the current $x$ and $y$ position of the users finger or cursor as they move and produces the following interaction:
\begin{center}
\begin{pspicture}(-2,-2)(2,2)
\psframe(-2,-2)(2,2)
\userline[linewidth=2pt,linecolor=green]{->}(0,0)(2,2){-x}{-y}
\userline[linewidth=2pt,linecolor=red]{->}(0,0)(2,2){0}{y}
\userline[linewidth=2pt,linecolor=purple]{->}(0,0)(2,2){-x}{cos(y)}
\userline[linewidth=2pt,linecolor=lightblue]{->}(0,0)(2,2)(sin(x)}{-y}
\end{pspicture}
\end{center}
2 extra arguments provide functions for the head, 4 extra arguments allows you to control both and tail
\begin{verbatim}
\userline[linewidth=2pt,linecolor=green]{->}(0,0)(2,2){-x}{-y}
\userline[linewidth=2pt,linecolor=red]{->}(0,0)(2,2){0}{y}
\userline[linewidth=2pt,linecolor=purple]{->}(0,0)(2,2){-x}{cos(y)}
\userline[linewidth=2pt,linecolor=lightblue]{->}(0,0)(2,2)(sin(x)}{-y}
\end{verbatim}
I can also draw a more complex version, and start to make more useful diagrams to describe vectors:
\begin{center}
\begin{pspicture}(-5,-5)(5,5)
% y-axis
\rput(0.3,3.75){ $Im$ }
\psline{->}(0,-3.75)(0,3.75)
% x-axis
\rput(3.75,0.3){ $Re$ }
\psline{->}(-3.75,0)(3.75,0)
% the circle
\pscircle(0,0){ 3 }
% new vector
\rput(2.3,1){$e^{i\omega}-\alpha$}
\userline[linewidth=1.5 pt]{->}(1.500,0.000)(2.121,2.121)
\userline[linewidth=1.5 pt,linecolor=blue]{->}(0,0.000)(2.121,2.121){(x>0) ? 3 * cos( atan(-y/x) ) : -3 * cos( atan(-y/x) ) }{ (x>0) ? -3 * sin( atan(-y/x) ) : 3 * sin( atan(-y/x) )}
\userline[linewidth=1.5 pt,linestyle=dashed](-1.500,0.000)(2.121,2.121){x}{0}{x}{y}
\userline[linewidth=1.5 pt,linestyle=dashed](-1.500,0.000)(2.121,2.121){0}{y}{x}{y}
\rput(-0.75,-4.25){$1+\alpha$}
\rput(2.25,-4.25){$1-\alpha$}
\psline{<->}(-3,-4)(1.5,-4)
\psline{<->}(1.5,-4)(3,-4)
\psline[linestyle=dashed](3,-4.5)(3,0)
\psline[linestyle=dashed](-3,-4.5)(-3,0)
\psline[linestyle=dashed](1.5,-4.5)(1.5,0)
\end{pspicture}
\end{center}
</script>
<div class="centered">
<h3> Installation </h3>
<p>You will also find installation instructions <a href="/installation/index.html" target="install">here</a>.</p>
<h3> Examples </h3>
<p>
Get inspired, and make sure you see <a href="/examples/index.html">the PSTricks examples here</a>!
</p>
<h3> Get Started </h3>
<p>
To get started, check out the <a href="https://github.com/Mathapedia/LaTeX2JS/tree/main/examples">example apps
on Github</a>, or view source. Play in the sandbox <a href="http://mathapedia.com/latex"
target="mathsand">here</a>.
</p>
<h3> Documentation </h3>
<p>There's also quite a bit of documentation <a href="http://mathapedia.com/books/31/sections/176"
target="mathapedia">here</a></p>
<h4> Help spread the word! </h4>
<p>
If you've built anything cool with LaTeX2JS, please <a href="https://twitter.com/mathapedia"
target="share">share!</a>
</p>
</div>
<script type="text/latex">
\begin{pspicture}(-3,-5)(8,3)
\rput(-3.2,0){$x(t)$}
\psline[linewidth=1.25 pt, arrowscale=1.1]{->}(-2.7,0)(-0.25,0)
\rput(2,0.3){$x_g(t)$}
\rput(8.6,0){$y_g(t)$}
\psline[linewidth=1.25 pt, arrowscale=1.1]{->}(0.25,0)(2.7,0)
\psline[linewidth=1.25 pt, arrowscale=1.1]{->}(6,0)(8,0)
\psline[linewidth=1.25 pt, arrowscale=1.1]{->}(0,-1.65)(0,-0.25)
\pscircle(0,0){0.25}
\psline(-0.175,0.175)(0.175,-0.175)
\psline(0.175,0.175)(-0.175,-0.175)
\rput(3.2, 0.5){$H(\omega)$}
\rput(5.3, 0.6){$(T_s)$}
\psline{->}(3.25, 0)(5.5,0)
\psline(3.75, 0.0)(3.75, 0.5)
\psline(4.75, 0.0)(4.75, 0.5)
\psline(3.75, 0.5)(4.75, 0.5)
\psline(3.75, 0.1)(3.75, -0.1)
\rput(3.7, -0.45){$-\frac{\omega_s}{2}$}
\psline(4.75, 0.1)(4.75, -0.1)
\rput(4.7, -0.45){$\frac{\omega_s}{2}$}
\psframe(2.65, -0.75)(6, 1)
\rput(2.3,-1.7){$g(t) = \sum \limits_{k = -\infty}^{\infty}\delta(t-kT_S)$}
\rput(-1.1,-2.1){$(1)$}
\rput(-1.3,-2.5){$\cdots$}
\rput(1.3,-2.5){$\cdots$}
\psline{->}(-1.5,-3)(1.5,-3)
\psline[linewidth=1.25pt]{->}(-0.75,-3)(-0.75,-2)
\rput(-0.75,-3.3){$-T_s$}
\psline[linewidth=1.25pt]{->}(0,-3)(0,-2)
\rput(0,-3.3){$0$}
\psline[linewidth=1.25pt]{->}(0.75,-3)(0.75,-2)
\rput(0.75,-3.3){$T_s$}
\psframe(-1.75,-3.65)(7, 1.2)
\end{pspicture}
</script>
<div class="latex-container">
<a href="http://www.mathjax.org" target="mathjax">
<img title="Powered by MathJax" src="https://cdn.mathjax.org/mathjax/badge/badge.gif" border="0"
alt="Powered by MathJax" />
</a>
</div>
<div class="latex-container">
<p><a href="https://www.linkedin.com/in/dan-p-lynch/" target="danlynch">Dan Lynch</a> © <a
href="https://latex2js.com" target="latex2js">LaTeX2JS</a> 2020 </p>
</div>
<script>
LaTeX2HTML5.init();
</script>
</body>
</html>