Fix LaTeX ColorV2 Extension - Greg Bernhardt

  • Context: LaTeX 
  • Thread starter Thread starter pbuk
  • Start date Start date
Click For Summary
SUMMARY

The discussion addresses an issue with the LaTeX colorV2 extension in MathJax, specifically regarding the autoload configuration in the check-for-tex.js file. The correct configuration should use a lowercase "v" in "colorv2" to ensure proper functionality. Additionally, users can opt to remove both the color and colorv2 keys to utilize the MathJax V3 color module, which aligns with the behavior of the TeX system but may disrupt color rendering in older posts. The problem was resolved after purging the cache from Cloudflare.

PREREQUISITES
  • Familiarity with MathJax version 3 configuration
  • Understanding of LaTeX syntax for color commands
  • Basic knowledge of JavaScript for modifying configuration files
  • Experience with web caching mechanisms, specifically Cloudflare
NEXT STEPS
  • Review the MathJax documentation for the colorV2 extension at this link
  • Learn about the differences between MathJax V2 and V3 color modules
  • Explore cache invalidation techniques for Cloudflare
  • Investigate best practices for configuring autoload settings in MathJax
USEFUL FOR

This discussion is beneficial for web developers, educators using LaTeX for mathematical content, and anyone troubleshooting MathJax configurations for enhanced rendering of mathematical expressions.

pbuk
Science Advisor
Homework Helper
Gold Member
Messages
4,971
Reaction score
3,223
@Greg Bernhardt: the ## \LaTeX ## color extension doesn't seem to be working. MathJax is downloading the colorv2 extension but in check-for-tex.js you have
JavaScript:
autoload: {
  color: [],
  colorV2: ['color'],
}
I'm not sure if this will fix it* but I think it shoud be
JavaScript:
autoload: {
  color: [],
  colorv2: ['color'],
}
(note the lower case "v" in line 3).

* Edit: experiments elsewhere indicate that this will fix it.

* Edit2: you could of course delete both the color and colorv2 keys to use the 'proper' MathJax V3 color module which works the same way ## \TeX ## does, but this would break colors in old posts under MathJax V2 (if there are any).
 
Last edited:
  • Like
Likes   Reactions: Greg Bernhardt and robphy
Physics news on Phys.org
Greg Bernhardt said:
ok fixed, try now

## \color{red}{x} + \color{blue}{y} ##
 
pbuk said:
## \color{red}{x} + \color{blue}{y} ##
I'm still getting the old https://www.physicsforums.com/check-for-tex.js file with colorV2:

JavaScript:
(function(){var body=document.body.textContent;if(body.match(/(\$\$|##|\[tex\]|\[itex\])/)){if(!window.MathJax){window.MathJax={loader:{load:["ui/lazy"],source:{"ui/lazy":"https://www.physicsforums.com/insights/lazy.js"}},tex:{inlineMath:[["[itex]","[/itex]"],["##","##"]],displayMath:[["[tex]","[/tex]"],["$$","$$"]],processEscapes:true,macros:{href:"{}"},tags:"ams",autoload:{color:[],colorV2:["color"]}},options:{skipHtmlTags:["script","noscript","style","textarea","pre","code"],ignoreHtmlClass:"tex2jax_ignore|dno",processHtmlClass:"tex2jax_process"}};}
var script=document.createElement("script");script.src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js";script.async=true;document.head.appendChild(script);}})();
even after a force refresh - may need a cache invalidation?
 
I purged from Cloudflare, try in 30 seconds.
 
  • Love
Likes   Reactions: pbuk
All good now :biggrin:
 
  • Love
Likes   Reactions: Greg Bernhardt

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • Sticky
  • · Replies 2 ·
Replies
2
Views
503K