• Hi Thomas,

    Thank you for the plugin and especially the Gutenberg block, it’s really useful :).

    I’ve ran into an issue rendering the KaTeX on the frontend. Whenever I post the katex (either through the block or shortcode) on a page or post, it works like magic. When I post it into a custom post type (lessons, from Learndash LMS in this case). The rendered forumulas display for about 100ms before they all change into the error “katex is not defined”.

    On this page, I have a missing dependency (wp-content/plugins/katex/assets/katex-0.10.2/katex.min.js and wp-content/plugins/katex/assets/katex-0.10.2/katex.min.css). Even though when I go to that url, the file is working fine.

    What can I do about this to display the katex?

    I also have this PHP error active throughout the whole website.
    Use of undefined constant KATEX__OPTION_DEFAULT_ENBABLE_LATEX_SHORTCODE - assumed 'KATEX__OPTION_DEFAULT_ENBABLE_LATEX_SHORTCODE' (this will throw an Error in a future version of PHP in wp-content/plugins/katex/scripts/shortcode.php:24)

    • This topic was modified 5 years, 4 months ago by Rob Migchels.
    • This topic was modified 5 years, 4 months ago by Rob Migchels.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Thomas Churchman

    (@beskhue)

    Hi Rob, thank you for the bug report.

    The second error you mention will be fixed in the next version. Unfortunately it’s unrelated to the main issue you’re facing.

    Are you able to reproduce this issue with post types other than LearnDash LMS? I don’t have access to that plugin so, sadly, I cannot test it.

    Thread Starter Rob Migchels

    (@dhrrob)

    Hi Thomas,

    Thank you for your reply. I’m glad to hear the second error is being fixed.

    I’ve installed WooCommerce to test, but the KaTeX shortcodes work fine in a WC product. It’s just within Learndash.

    I did some digging in Query Monitor and found out that the action katex_resources_enqueue is loaded through loop_end in both cases. When I modify the plugin to make it load through wp_footer, it does work in Learndash and the rest of the site.

    If you want to take a look yourself, I’d be fine with granting you access. It’s just a development URL with no private data whatsoever.

    Dear Thomas,

    thank you very much for your Katex plugin. As a math teacher this is exactly what I was looking for.

    Plugin works perfectly both in frontend and in backend. Only, as dhrrob mentioned, nginx drops tons of php errors:

    2019/07/30 11:06:53 [error] 30288#30288: *8358 FastCGI sent in stderr: “PHP message: PHP Warning: Use of undefined constant KATEX__OPTION_DEFAULT_ENBABLE_LATEX_SHORTCODE – assumed ‘KATEX__OPTION_DEFAULT_ENBABLE_LATEX_SHORTCODE’ (this will throw an Error in a future version of PHP) in /var/www/blog/wp-content/plugins/katex/scripts/shortcode.php on line 24” while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /blog/fus/wp-admin/edit-comments.php HTTP/1.0”, upstream: “fastcgi://unix:/var/run/php/php7.3-fpm.sock:”, host: “serverfox.mynetgear.com”

    Seems to be a typo in shortcode.php. Replacing

    KATEX__OPTION_DEFAULT_ENBABLE_LATEX_SHORTCODE with
    KATEX__OPTION_DEFAULT_ENABLE_LATEX_SHORTCODE

    will solve the issue.

    The issue isn’t critical, however, would be nice to be fixed any time soon.

    Thanks for your support

    Jürgen

    Plugin Author Thomas Churchman

    (@beskhue)

    Dear Jürgen,

    That’s right! I have the fix ready, but am currently busy with family circumstances.

    I hope to release the fix end of this week.

    Thomas

    Family first! Good luck!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘“katex is not defined” only in custom post type’ is closed to new replies.