1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;; Muse LaTeX Publishing with CJK support
5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9 (defcustom muse-latexcjk-header
10 "\\documentclass{article}
13 \\usepackage{indentfirst}
14 \\usepackage[CJKbookmarks=true]{hyperref}
15 \\usepackage[pdftex]{graphicx}
18 \\begin{CJK*}<lisp>(muse-latexcjk-encoding)</lisp>
20 \\title{<lisp>(muse-publishing-directive \"title\")</lisp>}
21 \\author{<lisp>(muse-publishing-directive \"author\")</lisp>}
22 \\date{<lisp>(muse-publishing-directive \"date\")</lisp>}
26 <lisp>(and muse-publish-generate-contents
27 \"\\\\tableofcontents\n\\\\newpage\")</lisp>\n\n"
28 "Header used for publishing LaTeX files(CJK)."
29 :type
'(choice string file
)
32 (defcustom muse-latexcjk-footer
36 "Footer used for publishing LaTeX files(CJK)."
37 :type
'(choice string file
)
40 (defcustom muse-latexcjk-encoding-map
41 '((utf-8 .
"{UTF8}{song}")
42 (japanese-iso-8bit .
"[dnp]{JIS}{min}")
43 (chinese-big5 .
"{Bg5}{bsmi}")
44 (mule-utf-8 .
"{UTF8}{song}")
45 (chinese-iso-8bit .
"{GB}{song}")
46 (chinese-gbk .
"{GBK}{song}"))
47 "An alist mapping emacs coding systems to appropriate CJK codings.
48 Use the base name of the coding system (ie, without the -unix)"
49 :type
'(alist :key-type coding-system
:value-type string
)
52 (defcustom muse-latexcjk-encoding-default
"{GB}{song}"
53 "The default emacs coding use if no special characters are found"
57 (defun muse-latexcjk-encoding ()
58 (muse-latexcjk-transform-content-type buffer-file-coding-system
))
60 (defun muse-latexcjk-transform-content-type (content-type)
61 "Using `muse-cjklatex-encoding-map', try and resolve an emacs coding
62 system to an associated CJK coding system."
63 (let ((match (assoc (coding-system-base content-type
)
64 muse-latexcjk-encoding-map
)))
67 muse-latexcjk-encoding-default
)))
69 (unless (assoc "latexcjk" muse-publishing-styles
)
70 (muse-derive-style "latexcjk" "latex"
71 :header
'muse-latexcjk-header
72 :footer
'muse-latexcjk-footer
)
73 (muse-derive-style "pdfcjk" "latexcjk"
74 :final
'muse-latex-pdf-generate
75 :browser
'muse-latex-pdf-browse-file
76 :osuffix
'muse-latex-pdf-extension
))
78 (provide 'muse-latexcjk
)