- Issue created by @kazu furutaka
- πΊπΈUnited States mark_fullmer Tucson
I was unable to reproduce this behavior. Here are the steps I took.
1. Add the CDN script to the HTML head of the site as indicated on https://www.mathjax.org/#gettingstarted
2. Populate a reference title field with MathJax syntax, such as the following:When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
3. View the reference entity. The MathJax logic does convert the shortcode syntax as expected.
(Note that the conversion won't necessarily happen in the *administrative* portion of the site if you are using a different admin theme and the JS script has not been added to that theme. If you want it to work in the admin theme, you would need to do something like a hook_page_attachments implementation (see https://www.drupal.org/docs/develop/creating-modules/adding-assets-css-j... β ):
mymodule.module:
/** * Implements hook_page_attachments(). */ function mymodule_page_attachments(array &$attachments) { $attachments['#attached']['library'][] = 'mymodule/mathjax'; }
mymodule.libraries.yml:
mathjax: js: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js: { type: external, minified: true }
- π―π΅Japan kazu furutaka
Hi, @mark_fullmer...
Thanks for your comment.I was unable to reproduce this behavior. Here are the steps I took.
These are a test entry (conference paper) and its preview I got; again, although the summary sentence is correctly converted, title etc. are not...
- πΊπΈUnited States mark_fullmer Tucson
If you inspect the rendering of the title field, are the characters encoded or escaped? Also, if you can confirm that this is not happening on a basic node, such as "Basic Page," then this would seem to not be relate to Bibcite and you could search Drupal core issues for similar reports.
- π―π΅Japan kazu furutaka
Well, indeed, I found that even the title of a basic page isn't converted.
I also found the following article, but could not get a working configuration... sigh...
https://www.drupal.org/project/mathjax/issues/2308301 π¬ How to use a custom configuration to process math in titles FixedCan anyone help me?
- π―π΅Japan kazu furutaka
Argh...
Strange enough, now it's working...
Procedure:- In Mathjax configuration, choose "Custom" Configuration type,
- put/leave the default "Custom configuration" string stored in /modules/contrib/mathjax/config/install/mathjax.settings.yml as default_config_string:
{"tex2jax":{"inlineMath":[["$","$"],["\\(","\\)"]], "processEscapes":"true"},"showProcessingMessages":"false","messageStyle":"none"}
- "Save configuration"
- go to /admin/config/development/performance and "Clear all caches",
- "Save configuration."
After choosing "Text Format" instead for the Mathjax "Configuration type" and follow the same procedure as above (3., 4. and 5.), I got the same result as before; although summary text is properly converted, title is not...
Can someone reproduce/confirm the above?
Although working now, I'm totally confused. Why are the result of "Custom configuration" using the "default" configuration string and that by choosing "Text Format" differ??? (isn't the latter the default?)
I'm sorry for all the fuss...
Kazuyoshi - πΊπΈUnited States mark_fullmer Tucson
Okay, thanks for the update. I'll go ahead and close this issue.