Browse Source

fix: better LaTeX display in latex2html (#94)

pull/97/head
Jens Kober 6 years ago
committed by Martin Monperrus
parent
commit
5480c6d71b
  1. 10
      bibtexbrowser.php

10
bibtexbrowser.php

@ -168,7 +168,7 @@ if (defined('ENCODING')) {
// USE_FIRST_THEN_LAST => Herbert Meyer // USE_FIRST_THEN_LAST => Herbert Meyer
@define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"? @define('USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT',false);// output authors in a comma separated form, e.g. "Meyer, H"?
@define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names? @define('USE_INITIALS_FOR_NAMES',false); // use only initials for all first names?
@define('USE_FIRST_THEN_LAST',false); // use only initials for all first names?
@define('USE_FIRST_THEN_LAST',false); // put first names before last names?
@define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT @define('FORCE_NAMELIST_SEPARATOR', ''); // if non-empty, use this to separate multiple names regardless of USE_COMMA_AS_NAME_SEPARATOR_IN_OUTPUT
@define('LAST_AUTHOR_SEPARATOR',' and '); @define('LAST_AUTHOR_SEPARATOR',' and ');
@ -1026,6 +1026,7 @@ function latex2html($line, $do_clean_extra_bracket=true) {
$line = char2html($line,"'",'a',"acute"); $line = char2html($line,"'",'a',"acute");
$line = char2html($line,"'",'c',"acute");
$line = char2html($line,"'",'e',"acute"); $line = char2html($line,"'",'e',"acute");
$line = char2html($line,"'",'i',"acute"); $line = char2html($line,"'",'i',"acute");
$line = char2html($line,"'",'o',"acute"); $line = char2html($line,"'",'o',"acute");
@ -1060,6 +1061,7 @@ function latex2html($line, $do_clean_extra_bracket=true) {
$line = char2html($line,'r','a',"ring"); $line = char2html($line,'r','a',"ring");
$line = char2html($line,'c','c',"cedil"); $line = char2html($line,'c','c',"cedil");
$line = char2html($line,'c','s',"cedil");
$line = char2html($line,'v','s',"caron"); $line = char2html($line,'v','s',"caron");
$line = str_replace('\\ae','æ', $line); $line = str_replace('\\ae','æ', $line);
@ -1078,6 +1080,12 @@ function latex2html($line, $do_clean_extra_bracket=true) {
$line = str_replace('\\v{c}','&#269',$line); $line = str_replace('\\v{c}','&#269',$line);
$line = str_replace('\\v{C}','&#268',$line); $line = str_replace('\\v{C}','&#268',$line);
// handling \textsuperscript{....} FAILS if there still are nested {}
$line = preg_replace('/\\\\textsuperscript\{(.*)\}/U','<sup>\\1</sup>', $line);
// handling \textsubscript{....} FAILS if there still are nested {}
$line = preg_replace('/\\\\textsubscript\{(.*)\}/U','<sub>\\1</sub>', $line);
if ($do_clean_extra_bracket) { if ($do_clean_extra_bracket) {
// clean extra tex curly brackets, usually used for preserving capitals // clean extra tex curly brackets, usually used for preserving capitals
// must come before the final math replacement // must come before the final math replacement

Loading…
Cancel
Save