I’m just getting started with XBlock development. I’m trying to render LateX within my XBlock. The following gives a KeyError on the LateX fraction. Any suggestions on what I’m doing wrong?
<head>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
</head>
<div class="test01_block">
<p>Test01XBlock: count is now
<span class='count'>{self.count}</span> (click me to increment).
</p>
<p>A point charge of +1\(\mu\)C is placed at (x, y, z) = (0, 0, 0). Units of the Cartesian coordinate system are in meters.</p>
<p>The electric field that results from a point charge can be calculated with the following equation:</p>
<p>\[\frac{a}{b}\]</p>
</div>
error message in the browser:
KeyError at /scenario/test01.0/
'a'
Request Method: GET
Request URL: http://localhost:8000/scenario/test01.0/
Django Version: 3.2.18
Exception Type: KeyError
Exception Value:
'a'
Exception Location: /Users/d24lau/src/xblock/test01/test01/test01.py, line 35, in student_view
Python Executable: /Users/d24lau/src/xblock/venv/bin/python
Python Version: 3.9.0
Python Path:
['/Users/d24lau/src/xblock/xblock-sdk',
'/Users/d24lau/.pyenv/versions/3.9.0/lib/python39.zip',
'/Users/d24lau/.pyenv/versions/3.9.0/lib/python3.9',
'/Users/d24lau/.pyenv/versions/3.9.0/lib/python3.9/lib-dynload',
'/Users/d24lau/src/xblock/venv/lib/python3.9/site-packages',
'/Users/d24lau/src/xblock/xblock-sdk',
'/Users/d24lau/src/xblock/test01']
Server time: Sat, 20 May 2023 16:45:19 -0400