Make the list of special characters user-extensible .
This commit is contained in:
parent
78a517a34d
commit
525b72ca4c
|
@ -2,6 +2,7 @@
|
||||||
@(require scribble/manual
|
@(require scribble/manual
|
||||||
"utils.rkt"
|
"utils.rkt"
|
||||||
(for-label racket/class
|
(for-label racket/class
|
||||||
|
racket/dict
|
||||||
scribble/render
|
scribble/render
|
||||||
scribble/xref))
|
scribble/xref))
|
||||||
|
|
||||||
|
@ -396,6 +397,13 @@ are own their own pages. A value of @racket[0] is treated the same as
|
||||||
|
|
||||||
Specializes a @racket[render<%>] class for generating Latex input.}}
|
Specializes a @racket[render<%>] class for generating Latex input.}}
|
||||||
|
|
||||||
|
@defparam[extra-character-conversions convs (dictof char? string?)]{
|
||||||
|
Maps (special) characters to strings corresponding to the Latex code that
|
||||||
|
should be used to render them. Scribble already converts many special
|
||||||
|
characters to the proper Latex commands. This parameter should be used in case
|
||||||
|
you need characters it does not support yet.
|
||||||
|
}
|
||||||
|
|
||||||
@; ----------------------------------------
|
@; ----------------------------------------
|
||||||
|
|
||||||
@section{PDF Renderer}
|
@section{PDF Renderer}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"latex-properties.rkt"
|
"latex-properties.rkt"
|
||||||
"private/render-utils.rkt"
|
"private/render-utils.rkt"
|
||||||
racket/class
|
racket/class
|
||||||
|
racket/dict
|
||||||
racket/runtime-path
|
racket/runtime-path
|
||||||
racket/port
|
racket/port
|
||||||
racket/string
|
racket/string
|
||||||
|
@ -11,7 +12,8 @@
|
||||||
setup/collects
|
setup/collects
|
||||||
file/convertible)
|
file/convertible)
|
||||||
(provide render-mixin
|
(provide render-mixin
|
||||||
make-render-part-mixin)
|
make-render-part-mixin
|
||||||
|
extra-character-conversions)
|
||||||
|
|
||||||
(define current-table-mode (make-parameter #f))
|
(define current-table-mode (make-parameter #f))
|
||||||
(define rendering-tt (make-parameter #f))
|
(define rendering-tt (make-parameter #f))
|
||||||
|
@ -47,6 +49,8 @@
|
||||||
(define-runtime-path skull-tex "scribble-skull.tex")
|
(define-runtime-path skull-tex "scribble-skull.tex")
|
||||||
(define skull-style (make-style #f (list (tex-addition skull-tex))))
|
(define skull-style (make-style #f (list (tex-addition skull-tex))))
|
||||||
|
|
||||||
|
(define extra-character-conversions (make-parameter (make-hash)))
|
||||||
|
|
||||||
(define (render-mixin % #:image-mode [image-mode #f])
|
(define (render-mixin % #:image-mode [image-mode #f])
|
||||||
(class %
|
(class %
|
||||||
(super-new)
|
(super-new)
|
||||||
|
@ -941,7 +945,8 @@
|
||||||
[else ses])))
|
[else ses])))
|
||||||
|
|
||||||
(define/private (display-protected s)
|
(define/private (display-protected s)
|
||||||
(define rtt (rendering-tt))
|
(define rtt (rendering-tt))
|
||||||
|
(define convs (extra-character-conversions))
|
||||||
(cond
|
(cond
|
||||||
[(eq? rtt 'exact)
|
[(eq? rtt 'exact)
|
||||||
(display s)]
|
(display s)]
|
||||||
|
@ -995,242 +1000,243 @@
|
||||||
[(#\uDF) "{\\ss}"]
|
[(#\uDF) "{\\ss}"]
|
||||||
[else
|
[else
|
||||||
(if ((char->integer c) . > . 127)
|
(if ((char->integer c) . > . 127)
|
||||||
;; latex-prefix.rkt enables utf8 input, but this does not work for
|
;; first, try user-defined conversions
|
||||||
;; all the characters below (e.g. ∞). Some parts of the table
|
(or (dict-ref convs c #f)
|
||||||
;; below are therefore necessary, but some parts probably are not.
|
;; latex-prefix.rkt enables utf8 input, but this does not work for
|
||||||
;; Which parts are necessary may depend on the latex version,
|
;; all the characters below (e.g. ∞). Some parts of the table
|
||||||
;; though, so we keep this table around to avoid regressions.
|
;; below are therefore necessary, but some parts probably are not.
|
||||||
(case c
|
;; Which parts are necessary may depend on the latex version,
|
||||||
[(#\╔ #\═ #\╗ #\║ #\╚ #\╝ #\╦ #\╠ #\╣ #\╬ #\╩) (box-character c)]
|
;; though, so we keep this table around to avoid regressions.
|
||||||
[(#\┌ #\─ #\┐ #\│ #\└ #\┘ #\┬ #\├ #\┤ #\┼ #\┴) (box-character c)]
|
(case c
|
||||||
[(#\┏ #\━ #\┓ #\┃ #\┗ #\┛ #\┳ #\┣ #\┫ #\╋ #\┻) (box-character c 2)]
|
[(#\╔ #\═ #\╗ #\║ #\╚ #\╝ #\╦ #\╠ #\╣ #\╬ #\╩) (box-character c)]
|
||||||
[(#\u2011) "\\mbox{-}"] ; non-breaking hyphen
|
[(#\┌ #\─ #\┐ #\│ #\└ #\┘ #\┬ #\├ #\┤ #\┼ #\┴) (box-character c)]
|
||||||
[(#\uB0) "$^{\\circ}$"] ; degree
|
[(#\┏ #\━ #\┓ #\┃ #\┗ #\┛ #\┳ #\┣ #\┫ #\╋ #\┻) (box-character c 2)]
|
||||||
[(#\uB2) "$^2$"]
|
[(#\u2011) "\\mbox{-}"] ; non-breaking hyphen
|
||||||
[(#\u039A) "K"] ; kappa
|
[(#\uB0) "$^{\\circ}$"] ; degree
|
||||||
[(#\u0391) "A"] ; alpha
|
[(#\uB2) "$^2$"]
|
||||||
[(#\u039F) "O"] ; omicron
|
[(#\u039A) "K"] ; kappa
|
||||||
[(#\u03A3) "$\\Sigma$"]
|
[(#\u0391) "A"] ; alpha
|
||||||
[(#\u03BA) "$\\kappa$"]
|
[(#\u039F) "O"] ; omicron
|
||||||
[(#\u03B1) "$\\alpha$"]
|
[(#\u03A3) "$\\Sigma$"]
|
||||||
[(#\u03B2) "$\\beta$"]
|
[(#\u03BA) "$\\kappa$"]
|
||||||
[(#\u03B3) "$\\gamma$"]
|
[(#\u03B1) "$\\alpha$"]
|
||||||
[(#\u03BF) "o"] ; omicron
|
[(#\u03B2) "$\\beta$"]
|
||||||
[(#\u03C3) "$\\sigma$"]
|
[(#\u03B3) "$\\gamma$"]
|
||||||
[(#\u03C2) "$\\varsigma$"]
|
[(#\u03BF) "o"] ; omicron
|
||||||
[(#\u03BB) "$\\lambda$"]
|
[(#\u03C3) "$\\sigma$"]
|
||||||
[(#\u039B) "$\\Lambda$"]
|
[(#\u03C2) "$\\varsigma$"]
|
||||||
[(#\u03BC) "$\\mu$"]
|
[(#\u03BB) "$\\lambda$"]
|
||||||
[(#\u03C0) "$\\pi$"]
|
[(#\u039B) "$\\Lambda$"]
|
||||||
[(#\ϖ) "$\\varpi$"]
|
[(#\u03BC) "$\\mu$"]
|
||||||
[(#\‘) "{`}"]
|
[(#\u03C0) "$\\pi$"]
|
||||||
[(#\’) "{'}"]
|
[(#\‘) "{`}"]
|
||||||
[(#\“) "{``}"]
|
[(#\’) "{'}"]
|
||||||
[(#\”) "{''}"]
|
[(#\“) "{``}"]
|
||||||
[(#\u2013) "{--}"]
|
[(#\”) "{''}"]
|
||||||
[(#\u2014) "{---}"]
|
[(#\u2013) "{--}"]
|
||||||
[(#\⟨ #\〈) "$\\langle$"] ; [MATHEMATICAL] LEFT ANGLE BRACKET
|
[(#\u2014) "{---}"]
|
||||||
[(#\⟩ #\〉) "$\\rangle$"] ; [MATHEMATICAL] RIGHT ANGLE BRACKET
|
[(#\⟨ #\〈) "$\\langle$"] ; [MATHEMATICAL] LEFT ANGLE BRACKET
|
||||||
[(#\∞) "$\\infty$"]
|
[(#\⟩ #\〉) "$\\rangle$"] ; [MATHEMATICAL] RIGHT ANGLE BRACKET
|
||||||
[(#\⇓) "$\\Downarrow$"]
|
[(#\∞) "$\\infty$"]
|
||||||
[(#\↖) "$\\nwarrow$"]
|
[(#\⇓) "$\\Downarrow$"]
|
||||||
[(#\↓) "$\\downarrow$"]
|
[(#\↖) "$\\nwarrow$"]
|
||||||
[(#\⇒) "$\\Rightarrow$"]
|
[(#\↓) "$\\downarrow$"]
|
||||||
[(#\→) "$\\rightarrow$"]
|
[(#\⇒) "$\\Rightarrow$"]
|
||||||
[(#\↘) "$\\searrow$"]
|
[(#\→) "$\\rightarrow$"]
|
||||||
[(#\↙) "$\\swarrow$"]
|
[(#\↘) "$\\searrow$"]
|
||||||
[(#\←) "$\\leftarrow$"]
|
[(#\↙) "$\\swarrow$"]
|
||||||
[(#\↑) "$\\uparrow$"]
|
[(#\←) "$\\leftarrow$"]
|
||||||
[(#\⇐) "$\\Leftarrow$"]
|
[(#\↑) "$\\uparrow$"]
|
||||||
[(#\−) "$\\longrightarrow$"]
|
[(#\⇐) "$\\Leftarrow$"]
|
||||||
[(#\⇑) "$\\Uparrow$"]
|
[(#\−) "$\\longrightarrow$"]
|
||||||
[(#\⇔) "$\\Leftrightarrow$"]
|
[(#\⇑) "$\\Uparrow$"]
|
||||||
[(#\↕) "$\\updownarrow$"]
|
[(#\⇔) "$\\Leftrightarrow$"]
|
||||||
[(#\↔) "$\\leftrightarrow$"]
|
[(#\↕) "$\\updownarrow$"]
|
||||||
[(#\↗) "$\\nearrow$"]
|
[(#\↔) "$\\leftrightarrow$"]
|
||||||
[(#\⇕) "$\\Updownarrow$"]
|
[(#\↗) "$\\nearrow$"]
|
||||||
[(#\א) "$\\aleph$"]
|
[(#\⇕) "$\\Updownarrow$"]
|
||||||
[(#\′) "$\\prime$"]
|
[(#\א) "$\\aleph$"]
|
||||||
[(#\∅) "$\\emptyset$"]
|
[(#\′) "$\\prime$"]
|
||||||
[(#\∇) "$\\nabla$"]
|
[(#\∅) "$\\emptyset$"]
|
||||||
[(#\♦) "$\\diamondsuit$"]
|
[(#\∇) "$\\nabla$"]
|
||||||
[(#\♠) "$\\spadesuit$"]
|
[(#\♦) "$\\diamondsuit$"]
|
||||||
[(#\♣) "$\\clubsuit$"]
|
[(#\♠) "$\\spadesuit$"]
|
||||||
[(#\♥) "$\\heartsuit$"]
|
[(#\♣) "$\\clubsuit$"]
|
||||||
[(#\♯) "$\\sharp$"]
|
[(#\♥) "$\\heartsuit$"]
|
||||||
[(#\♭) "$\\flat$"]
|
[(#\♯) "$\\sharp$"]
|
||||||
[(#\♮) "$\\natural$"]
|
[(#\♭) "$\\flat$"]
|
||||||
[(#\√) "$\\surd$"]
|
[(#\♮) "$\\natural$"]
|
||||||
[(#\∆) "$\\Delta$"] ; no better mapping for than \Delta for "increment"
|
[(#\√) "$\\surd$"]
|
||||||
[(#\u2211) "$\\sum$"] ; better than \Sigma, right?
|
[(#\∆) "$\\Delta$"] ; no better mapping for than \Delta for "increment"
|
||||||
[(#\u220F) "$\\prod$"] ; better than \Pi, right?
|
[(#\u2211) "$\\sum$"] ; better than \Sigma, right?
|
||||||
[(#\u2210) "$\\coprod$"]
|
[(#\u220F) "$\\prod$"] ; better than \Pi, right?
|
||||||
[(#\u222B) "$\\int$"]
|
[(#\u2210) "$\\coprod$"]
|
||||||
[(#\u222E) "$\\oint$"]
|
[(#\u222B) "$\\int$"]
|
||||||
[(#\¬) "$\\neg$"]
|
[(#\u222E) "$\\oint$"]
|
||||||
[(#\△) "$\\triangle$"]
|
[(#\¬) "$\\neg$"]
|
||||||
[(#\∀) "$\\forall$"]
|
[(#\△) "$\\triangle$"]
|
||||||
[(#\∃) "$\\exists$"]
|
[(#\∀) "$\\forall$"]
|
||||||
[(#\∘) "$\\circ$"]
|
[(#\∃) "$\\exists$"]
|
||||||
[(#\θ) "$\\theta$"]
|
[(#\∘) "$\\circ$"]
|
||||||
[(#\ϑ) "$\\vartheta$"]
|
[(#\θ) "$\\theta$"]
|
||||||
[(#\τ) "$\\tau$"]
|
[(#\ϑ) "$\\vartheta$"]
|
||||||
[(#\υ) "$\\upsilon$"]
|
[(#\τ) "$\\tau$"]
|
||||||
[(#\φ) "$\\phi$"]
|
[(#\υ) "$\\upsilon$"]
|
||||||
[(#\ϕ) "$\\varphi$"]
|
[(#\φ) "$\\phi$"]
|
||||||
[(#\δ) "$\\delta$"]
|
[(#\ϕ) "$\\varphi$"]
|
||||||
[(#\ρ) "$\\rho$"]
|
[(#\δ) "$\\delta$"]
|
||||||
[(#\ϱ) "$\\varrho$"]
|
[(#\ρ) "$\\rho$"]
|
||||||
[(#\ϵ) "$\\epsilon$"]
|
[(#\ϱ) "$\\varrho$"]
|
||||||
[(#\ε) "$\\varepsilon$"]
|
[(#\ϵ) "$\\epsilon$"]
|
||||||
[(#\χ) "$\\chi$"]
|
[(#\ε) "$\\varepsilon$"]
|
||||||
[(#\ψ) "$\\psi$"]
|
[(#\χ) "$\\chi$"]
|
||||||
[(#\ζ) "$\\zeta$"]
|
[(#\ψ) "$\\psi$"]
|
||||||
[(#\ν) "$\\nu$"]
|
[(#\ζ) "$\\zeta$"]
|
||||||
[(#\ω) "$\\omega$"]
|
[(#\ν) "$\\nu$"]
|
||||||
[(#\η) "$\\eta$"]
|
[(#\ω) "$\\omega$"]
|
||||||
[(#\ι) "$\\iota$"]
|
[(#\η) "$\\eta$"]
|
||||||
[(#\ξ) "$\\xi$"]
|
[(#\ι) "$\\iota$"]
|
||||||
[(#\Γ) "$\\Gamma$"]
|
[(#\ξ) "$\\xi$"]
|
||||||
[(#\Ψ) "$\\Psi$"]
|
[(#\Γ) "$\\Gamma$"]
|
||||||
[(#\Δ) "$\\Delta$"]
|
[(#\Ψ) "$\\Psi$"]
|
||||||
[(#\Ξ) "$\\Xi$"]
|
[(#\Δ) "$\\Delta$"]
|
||||||
[(#\Υ) "$\\Upsilon$"]
|
[(#\Ξ) "$\\Xi$"]
|
||||||
[(#\Ω) "$\\Omega$"]
|
[(#\Υ) "$\\Upsilon$"]
|
||||||
[(#\Θ) "$\\Theta$"]
|
[(#\Ω) "$\\Omega$"]
|
||||||
[(#\Π) "$\\Pi$"]
|
[(#\Θ) "$\\Theta$"]
|
||||||
[(#\Φ) "$\\Phi$"]
|
[(#\Π) "$\\Pi$"]
|
||||||
[(#\±) "$\\pm$"]
|
[(#\Φ) "$\\Phi$"]
|
||||||
[(#\∩) "$\\cap$"]
|
[(#\±) "$\\pm$"]
|
||||||
[(#\◇) "$\\diamond$"]
|
[(#\∩) "$\\cap$"]
|
||||||
[(#\⊕) "$\\oplus$"]
|
[(#\◇) "$\\diamond$"]
|
||||||
[(#\∓) "$\\mp$"]
|
[(#\⊕) "$\\oplus$"]
|
||||||
[(#\∪) "$\\cup$"]
|
[(#\∓) "$\\mp$"]
|
||||||
[(#\△) "$\\bigtriangleup$"]
|
[(#\∪) "$\\cup$"]
|
||||||
[(#\⊖) "$\\ominus$"]
|
[(#\△) "$\\bigtriangleup$"]
|
||||||
[(#\×) "$\\times$"]
|
[(#\⊖) "$\\ominus$"]
|
||||||
[(#\⊎) "$\\uplus$"]
|
[(#\×) "$\\times$"]
|
||||||
[(#\▽) "$\\bigtriangledown$"]
|
[(#\⊎) "$\\uplus$"]
|
||||||
[(#\⊗) "$\\otimes$"]
|
[(#\▽) "$\\bigtriangledown$"]
|
||||||
[(#\÷) "$\\div$"]
|
[(#\⊗) "$\\otimes$"]
|
||||||
[(#\⊓) "$\\sqcap$"]
|
[(#\÷) "$\\div$"]
|
||||||
[(#\▹) "$\\triangleleft$"]
|
[(#\⊓) "$\\sqcap$"]
|
||||||
[(#\⊘) "$\\oslash$"]
|
[(#\▹) "$\\triangleleft$"]
|
||||||
[(#\∗) "$\\ast$"]
|
[(#\⊘) "$\\oslash$"]
|
||||||
[(#\⊔) "$\\sqcup$"]
|
[(#\∗) "$\\ast$"]
|
||||||
[(#\∨) "$\\vee$"]
|
[(#\⊔) "$\\sqcup$"]
|
||||||
[(#\∧) "$\\wedge$"]
|
[(#\∨) "$\\vee$"]
|
||||||
[(#\◃) "$\\triangleright$"]
|
[(#\∧) "$\\wedge$"]
|
||||||
[(#\⊙) "$\\odot$"]
|
[(#\◃) "$\\triangleright$"]
|
||||||
[(#\★) "$\\star$"]
|
[(#\⊙) "$\\odot$"]
|
||||||
[(#\†) "$\\dagger$"]
|
[(#\★) "$\\star$"]
|
||||||
[(#\•) "$\\bullet$"]
|
[(#\†) "$\\dagger$"]
|
||||||
[(#\‡) "$\\ddagger$"]
|
[(#\•) "$\\bullet$"]
|
||||||
[(#\≀) "$\\wr$"]
|
[(#\‡) "$\\ddagger$"]
|
||||||
[(#\⨿) "$\\amalg$"]
|
[(#\≀) "$\\wr$"]
|
||||||
[(#\≤) "$\\leq$"]
|
[(#\⨿) "$\\amalg$"]
|
||||||
[(#\≥) "$\\geq$"]
|
[(#\≤) "$\\leq$"]
|
||||||
[(#\≡) "$\\equiv$"]
|
[(#\≥) "$\\geq$"]
|
||||||
[(#\⊨) "$\\models$"]
|
[(#\≡) "$\\equiv$"]
|
||||||
[(#\≺) "$\\prec$"]
|
[(#\⊨) "$\\models$"]
|
||||||
[(#\≻) "$\\succ$"]
|
[(#\≺) "$\\prec$"]
|
||||||
[(#\∼) "$\\sim$"]
|
[(#\≻) "$\\succ$"]
|
||||||
[(#\⊥) "$\\perp$"]
|
[(#\∼) "$\\sim$"]
|
||||||
[(#\≼) "$\\preceq$"]
|
[(#\⊥) "$\\perp$"]
|
||||||
[(#\≽) "$\\succeq$"]
|
[(#\≼) "$\\preceq$"]
|
||||||
[(#\≃) "$\\simeq$"]
|
[(#\≽) "$\\succeq$"]
|
||||||
[(#\≪) "$\\ll$"]
|
[(#\≃) "$\\simeq$"]
|
||||||
[(#\≫) "$\\gg$"]
|
[(#\≪) "$\\ll$"]
|
||||||
[(#\≍) "$\\asymp$"]
|
[(#\≫) "$\\gg$"]
|
||||||
[(#\∥) "$\\parallel$"]
|
[(#\≍) "$\\asymp$"]
|
||||||
[(#\⊂) "$\\subset$"]
|
[(#\∥) "$\\parallel$"]
|
||||||
[(#\⊃) "$\\supset$"]
|
[(#\⊂) "$\\subset$"]
|
||||||
[(#\≈) "$\\approx$"]
|
[(#\⊃) "$\\supset$"]
|
||||||
[(#\⋈) "$\\bowtie$"]
|
[(#\≈) "$\\approx$"]
|
||||||
[(#\⊆) "$\\subseteq$"]
|
[(#\⋈) "$\\bowtie$"]
|
||||||
[(#\⊇) "$\\supseteq$"]
|
[(#\⊆) "$\\subseteq$"]
|
||||||
[(#\≌) "$\\cong$"]
|
[(#\⊇) "$\\supseteq$"]
|
||||||
[(#\⊏) "$\\sqsubset$"]
|
[(#\≌) "$\\cong$"]
|
||||||
[(#\⊐) "$\\sqsupset$"]
|
[(#\⊏) "$\\sqsubset$"]
|
||||||
[(#\≠) "$\\neq$"]
|
[(#\⊐) "$\\sqsupset$"]
|
||||||
[(#\⌣) "$\\smile$"]
|
[(#\≠) "$\\neq$"]
|
||||||
[(#\⊑) "$\\sqsubseteq$"]
|
[(#\⌣) "$\\smile$"]
|
||||||
[(#\⊒) "$\\sqsupseteq$"]
|
[(#\⊑) "$\\sqsubseteq$"]
|
||||||
[(#\≐) "$\\doteq$"]
|
[(#\⊒) "$\\sqsupseteq$"]
|
||||||
[(#\⌢) "$\\frown$"]
|
[(#\≐) "$\\doteq$"]
|
||||||
[(#\∈) "$\\in$"]
|
[(#\⌢) "$\\frown$"]
|
||||||
[(#\∉) "$\\not\\in$"]
|
[(#\∈) "$\\in$"]
|
||||||
[(#\∋) "$\\ni$"]
|
[(#\∉) "$\\not\\in$"]
|
||||||
[(#\∝) "$\\propto$"]
|
[(#\∋) "$\\ni$"]
|
||||||
[(#\⊢) "$\\vdash$"]
|
[(#\∝) "$\\propto$"]
|
||||||
[(#\⊣) "$\\dashv$"]
|
[(#\⊢) "$\\vdash$"]
|
||||||
[(#\☠) "$\\skull$"]
|
[(#\⊣) "$\\dashv$"]
|
||||||
[(#\☺) "$\\smiley$"]
|
[(#\☠) "$\\skull$"]
|
||||||
[(#\☻) "$\\blacksmiley$"]
|
[(#\☺) "$\\smiley$"]
|
||||||
[(#\☹) "$\\frownie$"]
|
[(#\☻) "$\\blacksmiley$"]
|
||||||
[(#\ø) "{\\o}"]
|
[(#\☹) "$\\frownie$"]
|
||||||
[(#\Ø) "{\\O}"]
|
[(#\ø) "{\\o}"]
|
||||||
[(#\ł) "{\\l}"]
|
[(#\Ø) "{\\O}"]
|
||||||
[(#\Ł) "{\\L}"]
|
[(#\ł) "{\\l}"]
|
||||||
[(#\uA7) "{\\S}"]
|
[(#\Ł) "{\\L}"]
|
||||||
[(#\⟦ #\〚) "$[\\![$"]
|
[(#\uA7) "{\\S}"]
|
||||||
[(#\⟧ #\〛) "$]\\!]$"]
|
[(#\⟦ #\〚) "$[\\![$"]
|
||||||
[(#\↦) "$\\mapsto$"]
|
[(#\⟧ #\〛) "$]\\!]$"]
|
||||||
[(#\⊤) "$\\top$"]
|
[(#\↦) "$\\mapsto$"]
|
||||||
[(#\¥) "{\\textyen}"]
|
[(#\⊤) "$\\top$"]
|
||||||
[(#\™) "{\\texttrademark}"]
|
[(#\¥) "{\\textyen}"]
|
||||||
[(#\®) "{\\textregistered}"]
|
[(#\™) "{\\texttrademark}"]
|
||||||
[(#\©) "{\\textcopyright}"]
|
[(#\®) "{\\textregistered}"]
|
||||||
[(#\u2070) "$^0$"]
|
[(#\©) "{\\textcopyright}"]
|
||||||
[(#\u00b9) "$^1$"]
|
[(#\u2070) "$^0$"]
|
||||||
[(#\u00b2) "$^2$"]
|
[(#\u00b9) "$^1$"]
|
||||||
[(#\u00b3) "$^3$"]
|
[(#\u00b2) "$^2$"]
|
||||||
[(#\u2074) "$^4$"]
|
[(#\u00b3) "$^3$"]
|
||||||
[(#\u2075) "$^5$"]
|
[(#\u2074) "$^4$"]
|
||||||
[(#\u2076) "$^6$"]
|
[(#\u2075) "$^5$"]
|
||||||
[(#\u2077) "$^7$"]
|
[(#\u2076) "$^6$"]
|
||||||
[(#\u2078) "$^8$"]
|
[(#\u2077) "$^7$"]
|
||||||
[(#\u2079) "$^9$"]
|
[(#\u2078) "$^8$"]
|
||||||
[(#\u207a) "$^+$"]
|
[(#\u2079) "$^9$"]
|
||||||
[(#\u207b) "$^-$"]
|
[(#\u207a) "$^+$"]
|
||||||
[(#\⋖) "$\\precdot$"]
|
[(#\u207b) "$^-$"]
|
||||||
[(#\⋗) "$\\succdot$"]
|
[(#\⋖) "$\\precdot$"]
|
||||||
[(#\⋮) "\\vdots"]
|
[(#\⋗) "$\\succdot$"]
|
||||||
[(#\⋱) "$\\ddots$"]
|
[(#\⋮) "\\vdots"]
|
||||||
[(#\⋯) "$\\cdots$"]
|
[(#\⋱) "$\\ddots$"]
|
||||||
[(#\⋯) "\\hdots"]
|
[(#\⋯) "$\\cdots$"]
|
||||||
[else
|
[(#\⋯) "\\hdots"]
|
||||||
(cond
|
[else
|
||||||
[(char<=? #\uAC00 c #\uD7AF) ; Korean Hangul
|
(cond
|
||||||
(format "\\begin{CJK}{UTF8}{mj}~a\\end{CJK}" c)]
|
[(char<=? #\uAC00 c #\uD7AF) ; Korean Hangul
|
||||||
[else
|
(format "\\begin{CJK}{UTF8}{mj}~a\\end{CJK}" c)]
|
||||||
;; Detect characters that can be formed with combining characters
|
[else
|
||||||
;; and translate them to Latex combinations:
|
;; Detect characters that can be formed with combining characters
|
||||||
(define s (string-normalize-nfd (string c)))
|
;; and translate them to Latex combinations:
|
||||||
(define len (string-length s))
|
(define s (string-normalize-nfd (string c)))
|
||||||
(cond
|
(define len (string-length s))
|
||||||
[(len . > . 1)
|
(cond
|
||||||
(define combiner (case (string-ref s (sub1 len))
|
[(len . > . 1)
|
||||||
[(#\u300) "\\`{~a}"]
|
(define combiner (case (string-ref s (sub1 len))
|
||||||
[(#\u301) "\\'{~a}"]
|
[(#\u300) "\\`{~a}"]
|
||||||
[(#\u302) "\\^{~a}"]
|
[(#\u301) "\\'{~a}"]
|
||||||
[(#\u303) "\\~~{~a}"]
|
[(#\u302) "\\^{~a}"]
|
||||||
[(#\u304) "\\={~a}"]
|
[(#\u303) "\\~~{~a}"]
|
||||||
[(#\u306) "\\u{~a}"]
|
[(#\u304) "\\={~a}"]
|
||||||
[(#\u307) "\\.{~a}"]
|
[(#\u306) "\\u{~a}"]
|
||||||
[(#\u308) "\\\"{~a}"]
|
[(#\u307) "\\.{~a}"]
|
||||||
[(#\u30a) "\\r{~a}"]
|
[(#\u308) "\\\"{~a}"]
|
||||||
[(#\u30b) "\\H{~a}"]
|
[(#\u30a) "\\r{~a}"]
|
||||||
[(#\u30c) "\\v{~a}"]
|
[(#\u30b) "\\H{~a}"]
|
||||||
[(#\u327) "\\c{~a}"]
|
[(#\u30c) "\\v{~a}"]
|
||||||
[(#\u328) "\\k{~a}"]
|
[(#\u327) "\\c{~a}"]
|
||||||
[else #f]))
|
[(#\u328) "\\k{~a}"]
|
||||||
(define base (string-normalize-nfc (substring s 0 (sub1 len))))
|
[else #f]))
|
||||||
(if (and combiner
|
(define base (string-normalize-nfc (substring s 0 (sub1 len))))
|
||||||
(= 1 (string-length base)))
|
(if (and combiner
|
||||||
(format combiner (char-loop (string-ref base 0)))
|
(= 1 (string-length base)))
|
||||||
c)]
|
(format combiner (char-loop (string-ref base 0)))
|
||||||
[else c])])])
|
c)]
|
||||||
|
[else c])])]))
|
||||||
c)])))
|
c)])))
|
||||||
(loop (add1 i))))))]))
|
(loop (add1 i))))))]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user