-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathquill.html
45 lines (43 loc) · 1.54 KB
/
mathquill.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MathQuill in PyQt6</title>
<link rel="stylesheet" href="resources/mathquill.min.css"/>
<style>
#mathquill-input {
width: 600px;
margin: 20px auto;
padding: 10px;
border: 1px solid #ccc;
min-height: 50px; /* Ensure it's clickable */
}
</style>
</head>
<body>
<div id="mathquill-input" class="mathquill-editable"></div>
<div id="latex-output">LaTeX Output: <span id="latex"></span></div>
<script src="resources/jquery-3.6.0.min.js"></script>
<script src="resources/mathquill.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
console.log('DOM fully loaded and parsed');
var MQ = MathQuill.getInterface(2);
var mathField = MQ.MathField(document.getElementById('mathquill-input'), {
spaceBehavesLikeTab: true,
handlers: {
edit: function() {
console.log('Editing math field');
var latex = mathField.latex();
document.getElementById('latex').textContent = latex;
}
}
});
// Set initial content for the MathQuill field
mathField.latex('y = mx + b');
console.log('MathQuill initialized');
});
</script>
</body>
</html>