diff --git a/collects/scribble/latex-render.rkt b/collects/scribble/latex-render.rkt index 8d542a02..082a7e54 100644 --- a/collects/scribble/latex-render.rkt +++ b/collects/scribble/latex-render.rkt @@ -966,33 +966,37 @@ [(#\u207a) "$^+$"] [(#\u207b) "$^-$"] [else - ;; Detect characters that can be formed with combining characters - ;; and translate them to Latex combinations: - (define s (string-normalize-nfd (string c))) - (define len (string-length s)) (cond - [(len . > . 1) - (define combiner (case (string-ref s (sub1 len)) - [(#\u300) "\\`{~a}"] - [(#\u301) "\\'{~a}"] - [(#\u302) "\\^{~a}"] - [(#\u303) "\\~~{~a}"] - [(#\u304) "\\={~a}"] - [(#\u306) "\\u{~a}"] - [(#\u307) "\\.{~a}"] - [(#\u308) "\\\"{~a}"] - [(#\u30a) "\\r{~a}"] - [(#\u30b) "\\H{~a}"] - [(#\u30c) "\\v{~a}"] - [(#\u327) "\\c{~a}"] - [(#\u328) "\\k{~a}"] - [else #f])) - (define base (string-normalize-nfc (substring s 0 (sub1 len)))) - (if (and combiner - (= 1 (string-length base))) - (format combiner (char-loop (string-ref base 0))) - c)] - [else c])]) + [(char<=? #\uAC00 c #\uD7AF) ; Korean Hangul + (format "\\begin{CJK}{UTF8}{mj}~a\\end{CJK}" c)] + [else + ;; Detect characters that can be formed with combining characters + ;; and translate them to Latex combinations: + (define s (string-normalize-nfd (string c))) + (define len (string-length s)) + (cond + [(len . > . 1) + (define combiner (case (string-ref s (sub1 len)) + [(#\u300) "\\`{~a}"] + [(#\u301) "\\'{~a}"] + [(#\u302) "\\^{~a}"] + [(#\u303) "\\~~{~a}"] + [(#\u304) "\\={~a}"] + [(#\u306) "\\u{~a}"] + [(#\u307) "\\.{~a}"] + [(#\u308) "\\\"{~a}"] + [(#\u30a) "\\r{~a}"] + [(#\u30b) "\\H{~a}"] + [(#\u30c) "\\v{~a}"] + [(#\u327) "\\c{~a}"] + [(#\u328) "\\k{~a}"] + [else #f])) + (define base (string-normalize-nfc (substring s 0 (sub1 len)))) + (if (and combiner + (= 1 (string-length base))) + (format combiner (char-loop (string-ref base 0))) + c)] + [else c])])]) c)]))) (loop (add1 i))))))) diff --git a/collects/scribble/scribble.tex b/collects/scribble/scribble.tex index 29a3bd43..e897e143 100644 --- a/collects/scribble/scribble.tex +++ b/collects/scribble/scribble.tex @@ -11,7 +11,8 @@ \usepackage[htt]{hyphenat} \usepackage[usenames,dvipsnames]{color} \hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true} -\IfFileExists{tocstyle.sty}{\usepackage{tocstyle}\usetocstyle{standard}} +\IfFileExists{tocstyle.sty}{\usepackage{tocstyle}\usetocstyle{standard}}{} +\IfFileExists{CJK.sty}{\usepackage{CJK}}{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Configuration that is especially meant to be overridden: