fix math expression problems
This commit is contained in:
+28
-7
@@ -997,6 +997,21 @@ function latex2html($line, $do_clean_extra_bracket=true) {
|
||||
// added && strpos($line,'{')===false
|
||||
if (strpos($line,'\\')===false && strpos($line,'{')===false) return $line;
|
||||
|
||||
// handling uppercase
|
||||
// echo preg_replace_callback('!\b[a-z]!', 'upper', strtolower($str));
|
||||
if (!function_exists("strtolowercallback")) {
|
||||
function strtolowercallback($array) {
|
||||
return strtolower($array[1]);
|
||||
}
|
||||
}
|
||||
if (!function_exists("strtouppercallback")) {
|
||||
function strtouppercallback($array) {
|
||||
return strtoupper($array[1]);
|
||||
}
|
||||
}
|
||||
$line = preg_replace_callback('/\\\\uppercase\{(.*)\}/U',"strtouppercallback", $line);
|
||||
$line = preg_replace_callback('/\\\\lowercase\{(.*)\}/U',"strtolowercallback", $line);
|
||||
|
||||
$maths = array();
|
||||
$index = 0;
|
||||
// first we escape the math env
|
||||
@@ -1087,6 +1102,8 @@ function latex2html($line, $do_clean_extra_bracket=true) {
|
||||
// handling \textsubscript{....} FAILS if there still are nested {}
|
||||
$line = preg_replace('/\\\\textsubscript\{(.*)\}/U','<sub>\\1</sub>', $line);
|
||||
|
||||
|
||||
|
||||
if ($do_clean_extra_bracket) {
|
||||
// clean extra tex curly brackets, usually used for preserving capitals
|
||||
// must come before the final math replacement
|
||||
@@ -2452,7 +2469,7 @@ function JanosBibliographyStyle($bibentry) {
|
||||
}
|
||||
|
||||
if ($type=="article" && $bibentry->hasField("journal")) {
|
||||
$booktitle = '<span class="bibbooktitle">'.'In '.$bibentry->getField("journal").'</span>';
|
||||
$booktitle = '<span class="bibbooktitle">'.''.$bibentry->getField("journal").'</span>';
|
||||
}
|
||||
|
||||
|
||||
@@ -2774,12 +2791,16 @@ $('a.biburl').each(function() { // for each url "[bibtex]"
|
||||
if (!function_exists('javascript_math')) {
|
||||
function javascript_math() {
|
||||
?>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
tex2jax: {inlineMath: [["$","$"]]}
|
||||
});
|
||||
</script>
|
||||
<script src="<?php echo MATHJAX_URI ?>"></script>
|
||||
<script>
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']]
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" id="MathJax-script" async
|
||||
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user