Add experimental version of muse-blosxom.el to project
[muse-el.git] / muse-latexcjk.el
blob5713143f7affa0f7aabb38143384c87bd6d6a736
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;
3 ;; Muse LaTeX Publishing with CJK support
4 ;;
5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7 (require 'muse-latex)
9 (defcustom muse-latexcjk-header
10 "\\documentclass{article}
12 \\usepackage{CJK}
13 \\usepackage{indentfirst}
14 \\usepackage[CJKbookmarks=true]{hyperref}
15 \\usepackage[pdftex]{graphicx}
17 \\begin{document}
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>}
24 \\maketitle
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)
30 :group 'muse-latex)
32 (defcustom muse-latexcjk-footer
34 \\end{CJK*}
35 \\end{document}"
36 "Footer used for publishing LaTeX files(CJK)."
37 :type '(choice string file)
38 :group 'muse-latex)
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)
50 :group 'muse-latex)
52 (defcustom muse-latexcjk-encoding-default "{GB}{song}"
53 "The default emacs coding use if no special characters are found"
54 :type 'string
55 :group 'muse-latex)
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)))
65 (if match
66 (cdr match)
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)