\n" . $config . "\n"; } /* * loads mathjax itself */ add_action('wp_enqueue_scripts', 'add_mathjax'); function add_mathjax() { $custom_cdn = esc_url( get_option('custom_mathjax_cdn') ); $cdn = $custom_cdn ? $custom_cdn : "//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML,Safe.js"; wp_enqueue_script('mathjax', $cdn); } /* * inserts the mathjax preamble inside the body and above the content */ add_action('wp_footer', 'add_preamble_adder'); function add_preamble_adder() { $preamble = get_option('latex_preamble'); if ( $preamble ) { $preamble = preg_replace('/\\\\/','\\\\\\\\',$preamble); ?>
(Please note that this still needs to be tested. There may be a problem with string-escaping. For instance, I'm not sure if special characters such as < will be properly processed.)