Skip to content

Commit df078ee

Browse files
Enable mathematical typesetting globally.
and rework the learning path `CMSIS-DSP with Python` to use LaTeX for mathematical typesetting. It would be better to be able to enable math mode only for specific learning paths.
1 parent 3522969 commit df078ee

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
lines changed

config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ cloudFrontDistributionID = "E2NEF61QWPFRIH"
2727
[markup.goldmark]
2828
[markup.goldmark.renderer]
2929
unsafe = true
30+
[markup.goldmark.extensions]
31+
[markup.goldmark.extensions.passthrough]
32+
enable = true
33+
[markup.goldmark.extensions.passthrough.delimiters]
34+
block = [['\[', '\]'], ['$$', '$$']]
35+
inline = [['\(', '\)']]
3036

3137
[frontmatter]
3238
lastmod = ["lastmod", ":git", "date", "publishDate"]
@@ -83,3 +89,5 @@ title = 'Arm Learning Paths'
8389
description = 'Tutorials with code examples, created by the Arm ecosystem to develop better code faster across all platforms: Servers, phones, laptops, embedded devices, and microcontrollers.'
8490
social_image = '/img/social-image.png'
8591
twitter_handle = '@ArmSoftwareDev'
92+
93+
math = true

content/learning-paths/embedded-and-microcontrollers/cmsisdsp-dev-with-python/how-to-5.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,45 +61,32 @@ Noise filtering in each band uses a simplified Wiener filter.
6161

6262
A gain is applied to the signal, defined as follow:
6363

64-
```
65-
H(f) = S(f) / (S(f) + N(f))
66-
67-
```
68-
- `S(f)` is the speech spectrum.
69-
- `N(f)` is the noise spectrum.
64+
$$H(f) = \frac{S(f)}{S(f) + N(f)}$$
7065

71-
```
72-
H(f) = 1 / (1 + N(f)/S(f))
66+
- \(S(f)\) is the speech spectrum.
67+
- \(N(f)\) is the noise spectrum.
7368

74-
```
69+
$$H(f) = \frac{1}{1 + \frac{N(f)}{S(f)}}$$
7570

7671
For this tutorial, we assume a high SNR. The VAD relies on this assumption: the signal energy is sufficient to detect speech.
7772
With a high signal-to-noise ratio, the transfer function can be approximated as:
7873

79-
```
80-
H(f) ~ 1 - N(f)/S(f)
74+
$$H(f) \approx 1 - \frac{N(f)}{S(f)}$$
8175

82-
```
76+
You don't have access to \(S(f)\), only to the measured \(S(f) + N(f)\) which will be used under the assumption that the noise is small, making the approximation acceptable:
8377

84-
You don't have access to `S(f)`, only to the measured `S(f) + N(f)` which will be used under the assumption that the noise is small, making the approximation acceptable:
78+
$$H(f) \approx 1 - \frac{N(f)}{S(f) + N(f)}$$
8579

86-
```
87-
H(f) ~ 1 - N(f) / (S(f) + N(f))
8880

89-
```
81+
with \(S(f) + N(f) = E(f)\)
9082

91-
with `S(f) + N(f) = E(f)`
83+
- \(E(f)\) is the observed energy in a frequency band.
9284

9385
It can be rewritten as:
9486

95-
`H(f)` is approximately:
96-
97-
```
98-
H(f) ~ (E(f) - N(f)) / E(f)
99-
```
87+
$$H(f) \approx \frac{E(f) - N(f)}{E(f)}$$
10088

101-
- `N(f)` is estimated when there is no speech.
102-
- `E(f)` is the observed energy in a frequency band.
89+
- \(N(f)\) is estimated when there is no speech.
10390

10491
In the Python code below, you’ll see this formula implemented as:
10592

themes/arm-design-system-hugo-theme/layouts/_default/baseof.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
{{partial "head/analytics.html" .}}
1010
{{partial "head/conditional-redirect.html" .}}
1111
{{partial "head/hotjar-surveys.html" .}}
12+
13+
{{ if .Param "math" }}
14+
{{ partialCached "math.html" . }}
15+
{{ end }}
1216
</head>
1317
<body>
1418
{{partial "header/nav-masthead.html" .}}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
2+
<script>
3+
MathJax = {
4+
tex: {
5+
displayMath: [['\\[', '\\]'], ['$$', '$$']], // block
6+
inlineMath: [['\\(', '\\)']] // inline
7+
},
8+
loader:{
9+
load: ['ui/safe']
10+
},
11+
};
12+
</script>

0 commit comments

Comments
 (0)