Operating system
macOS
Joplin version
2.13.8
Sync target
File system
Editor
Rich Text Editor
What issue do you have?
The maths equations in inline mode don't display properly in either the rich text editor or after exporting the document to pdf format. Instead of the equations, the following text reads: "Cannot read properties of undefined (reading 'map')". As far as I know, inline mode worked in the earlier versions of Joplin.
Does anyone know how to fix this? Thanks
Screenshots
I can reproduce this, but only when using \begin{align}
(and not \begin{align*}
). I suspect it's related to numbering.
Thank you for reporting this!
Please provide the text as text so that we can copy and paste and verify
Sample:
$$
\begin{align}
\texttt{Numbered block math}
\end{align}
$$
$\texttt{Inline math}$
From debugging, it looks like \begin{align} ... \end{align}
is creating a macro in a format not recognized by Joplin's stringifyKatexOptions
:
{
'\@eqnsw': '1',
'\myothermacro': { tokens: Array (7), numArgs: 0, ... }
}
stringifyKatexOptions
expects all macros to have a .tokens
property.
Reported on GitHub:
opened 01:33PM - 06 Dec 23 UTC
closed 04:51PM - 09 Dec 23 UTC
bug
### Operating system
Linux, Android, iOS
### Joplin version
2.13.8
#… ## Desktop version info
Joplin 2.13.8 (prod, linux)
Client ID: 8e9dffaf041d4d34929b525a8c87104a
Sync Version: 3
Profile Version: 44
Keychain Supported: No
Revision: 604dcbc
Freehand Drawing: 2.5.0
### Current behaviour
To reproduce, create a note with the following content:
```md
$$
\begin{align}
\text{Block}
\end{align}
$$
$\text{Inline}$.
```
### Expected behaviour
Joplin should render the inline KaTeX.
### Logs
Exception and stack trace:
```
/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml/rules/katex.js:243 Katex error for: test TypeError: Cannot read properties of undefined (reading 'map')
at stringifyKatexOptions (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml/rules/katex.js:45:56)
at renderToStringWithCache (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml/rules/katex.js:227:49)
at katexInline (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml/rules/katex.js:261:30)
at Object.inlineRenderer [as math_inline] (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml/rules/katex.js:269:20)
at Renderer.renderInline (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/node_modules/markdown-it/lib/renderer.js:275:28)
at Renderer.render (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/node_modules/markdown-it/lib/renderer.js:330:22)
at MarkdownIt.render (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/node_modules/markdown-it/lib/index.js:544:24)
at MdToHtml.<anonymous> (/tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml.js:395:45)
at Generator.next (<anonymous>)
at /tmp/.mount_Joplinm45GpJ/resources/app.asar/node_modules/@joplin/lib/node_modules/@joplin/renderer/MdToHtml.js:8:71
```
This also affects the new versions of the mobile apps.
I've created a pull request that should fix this based on the release-2.13
branch. Hopefully we can do a bug fix release for this!
Edit :
This should be fixed in the latest version:
Thank you again for reporting this!
2 Likes
system
Closed
5 January 2024 13:34
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.