* (bug 27324) \euro support for <math>
Reapplied r87284 with a tweak to allow \euro through to conservative HTML output. Parser test case added to confirm that \euro is HTMLable and the other euro variants are renderable to images. This commit also includes tweaks to HTMLification of \phi, \varphi, and \varepsilon (conservative HTML) and changes the non-conservative HTMLification of number sets from plain letters to the dedicated Unicode chars for their symbols. These changes are not included in tests, but don't alter what input is supported.
This commit is contained in:
parent
6d5b5679fd
commit
dd490761b5
|
@ -45,16 +45,19 @@ let modules_ams = ref false
|
|||
let modules_nonascii = ref false
|
||||
let modules_encoding = ref UTF8
|
||||
let modules_color = ref false
|
||||
let modules_euro = ref false
|
||||
|
||||
(* wrappers to easily set / reset module properties *)
|
||||
let tex_use_ams () = modules_ams := true
|
||||
let tex_use_nonascii () = modules_nonascii := true
|
||||
let tex_use_color () = modules_color := true
|
||||
let tex_use_euro () = modules_euro := true
|
||||
let tex_mod_reset () = (
|
||||
modules_ams := false;
|
||||
modules_nonascii := false;
|
||||
modules_encoding := UTF8;
|
||||
modules_color := false
|
||||
modules_color := false;
|
||||
modules_euro := false;
|
||||
)
|
||||
|
||||
(* Return TeX fragment for one of the encodings in (UTF8,LATIN1,LATIN2) *)
|
||||
|
@ -68,6 +71,7 @@ let get_preface () = "\\nonstopmode\n\\documentclass[12pt]{article}\n" ^
|
|||
(if !modules_nonascii then get_encoding !modules_encoding else "") ^
|
||||
(if !modules_ams then "\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\usepackage{amssymb}\n" else "") ^
|
||||
(if !modules_color then "\\usepackage[dvips,usenames]{color}\n" else "") ^
|
||||
(if !modules_euro then "\\usepackage{eurosym}\n" else "") ^
|
||||
"\\usepackage{cancel}\n\\pagestyle{empty}\n\\begin{document}\n$$\n"
|
||||
|
||||
(* TeX fragment appended after the content *)
|
||||
|
@ -97,7 +101,7 @@ let find = function
|
|||
| "\\epsilon" -> LITERAL (TEX_ONLY "\\epsilon ")
|
||||
| "\\Epsilon" -> (tex_use_ams (); LITERAL (HTMLABLEC (FONT_UF,
|
||||
"\\mathrm{E}", "Ε")))
|
||||
| "\\varepsilon" -> LITERAL (TEX_ONLY "\\varepsilon ")
|
||||
| "\\varepsilon" -> LITERAL (HTMLABLEC (FONT_UF, "\\varepsilon ", "ε"))
|
||||
| "\\zeta" -> LITERAL (HTMLABLEC (FONT_UF, "\\zeta ", "ζ"))
|
||||
| "\\Zeta" -> (tex_use_ams (); LITERAL (HTMLABLEC (FONT_UF,
|
||||
"\\mathrm{Z}", "Ζ")))
|
||||
|
@ -142,9 +146,9 @@ let find = function
|
|||
"\\mathrm{T}", "Τ")))
|
||||
| "\\upsilon" -> LITERAL (HTMLABLEC (FONT_UF, "\\upsilon ", "υ"))
|
||||
| "\\Upsilon" -> LITERAL (HTMLABLEC (FONT_UF, "\\Upsilon ", "Υ"))
|
||||
| "\\phi" -> LITERAL (TEX_ONLY "\\phi ")
|
||||
| "\\phi" -> LITERAL (HTMLABLEC (FONT_UF, "\\phi ", "ϕ"))
|
||||
| "\\Phi" -> LITERAL (HTMLABLEC (FONT_UF, "\\Phi ", "Φ"))
|
||||
| "\\varphi" -> LITERAL (TEX_ONLY "\\varphi ")
|
||||
| "\\varphi" -> LITERAL (HTMLABLEC (FONT_UF, "\\varphi ", "φ"))
|
||||
| "\\chi" -> LITERAL (HTMLABLEC (FONT_UF, "\\chi ", "χ"))
|
||||
| "\\Chi" -> (tex_use_ams (); LITERAL (HTMLABLEC (FONT_UF,
|
||||
"\\mathrm{X}", "Χ")))
|
||||
|
@ -419,6 +423,11 @@ let find = function
|
|||
| "\\asymp" -> LITERAL (TEX_ONLY "\\asymp ")
|
||||
| "\\doteq" -> LITERAL (TEX_ONLY "\\doteq ")
|
||||
| "\\parallel" -> LITERAL (TEX_ONLY "\\parallel ")
|
||||
| "\\euro" -> (tex_use_euro (); LITERAL (HTMLABLEC (FONT_UF, "\\mbox{\\euro}", "€")))
|
||||
| "\\geneuro" -> (tex_use_euro (); LITERAL (TEX_ONLY "\\mbox{\\geneuro}"))
|
||||
| "\\geneuronarrow" -> (tex_use_euro (); LITERAL (TEX_ONLY "\\mbox{\\geneuronarrow}"))
|
||||
| "\\geneurowide" -> (tex_use_euro (); LITERAL (TEX_ONLY "\\mbox{\\geneurowide}"))
|
||||
| "\\officialeuro" -> (tex_use_euro (); LITERAL (TEX_ONLY "\\mbox{\\officialeuro}"))
|
||||
| "\\implies" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\implies ", "⇒")))
|
||||
| "\\mod" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mod ", "mod")))
|
||||
| "\\Diamond" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\Diamond ", "◊")))
|
||||
|
@ -427,16 +436,17 @@ let find = function
|
|||
| "\\dotsi" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\dotsi ", "⋅⋅⋅")))
|
||||
| "\\dotsm" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\dotsm ", "⋅⋅⋅")))
|
||||
| "\\dotso" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UF, "\\dotso ", "...")))
|
||||
| "\\reals" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "<b>R</b>")))
|
||||
| "\\Reals" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "<b>R</b>")))
|
||||
| "\\R" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "<b>R</b>")))
|
||||
| "\\C" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "<b>C</b>")))
|
||||
| "\\cnums" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "<b>C</b>")))
|
||||
| "\\Complex" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "<b>C</b>")))
|
||||
| "\\Z" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{Z}", "<b>Z</b>")))
|
||||
| "\\natnums" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{N}", "<b>N</b>")))
|
||||
| "\\N" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{N}", "<b>N</b>")))
|
||||
| "\\Q" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{Q}", "<b>Q</b>")))
|
||||
| "\\reals" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "ℝ")))
|
||||
| "\\Reals" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "ℝ")))
|
||||
| "\\R" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{R}", "ℝ")))
|
||||
| "\\C" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "ℂ")))
|
||||
| "\\cnums" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "ℂ")))
|
||||
| "\\Complex" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{C}", "ℂ")))
|
||||
| "\\Z" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{Z}", "ℤ")))
|
||||
| "\\natnums" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{N}", "ℕ")))
|
||||
| "\\N" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{N}", "ℕ")))
|
||||
| "\\Q" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{Q}", "ℚ")))
|
||||
| "\\H" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\mathbb{H}", "ℍ")))
|
||||
| "\\lVert" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\lVert ", "||")))
|
||||
| "\\rVert" -> (tex_use_ams (); LITERAL (HTMLABLE (FONT_UFH,"\\rVert ", "||")))
|
||||
| "\\nmid" -> (tex_use_ams (); LITERAL (TEX_ONLY "\\nmid "))
|
||||
|
|
|
@ -50,3 +50,19 @@ BUG 26380: Add \widetilde support to match \widehat
|
|||
</p>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
BUG 27324: Euro symbol for math
|
||||
!! input
|
||||
<math>\euro 200</math>
|
||||
<math>\geneuro</math>
|
||||
<math>\geneuronarrow</math>
|
||||
<math>\geneurowide</math>
|
||||
<math>\officialeuro</math>
|
||||
!! result
|
||||
<p><span class="texhtml" dir="ltr">€200</span>
|
||||
<img class="tex" alt="\geneuro" src="/images/math/9/8/b/98b63c235ee187a38267e0e170b10e9d.png" />
|
||||
<img class="tex" alt="\geneuronarrow" src="/images/math/a/a/4/aa4a1ed370f4ee705c6930384bf89502.png" />
|
||||
<img class="tex" alt="\geneurowide" src="/images/math/4/4/0/4404468e6187fb04e4f7e1f15e550825.png" />
|
||||
<img class="tex" alt="\officialeuro" src="/images/math/d/7/0/d708de0eed23dbd6f02b99ea9073547b.png" />
|
||||
</p>
|
||||
!! end
|
||||
|
|
Loading…
Reference in New Issue