279 lines
25 KiB
Markdown
279 lines
25 KiB
Markdown
---
|
|
title: '[emacs][muse] Carbon EmacsでMuseのPDFを生成する'
|
|
author: kazu634
|
|
date: 2009-01-09
|
|
url: /2009/01/10/_1191/
|
|
wordtwit_post_info:
|
|
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4481;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
|
|
categories:
|
|
- つれづれ
|
|
|
|
---
|
|
<div class="section">
|
|
<p>
|
|
<a href="http://f.hatena.ne.jp/sirocco634/20090110073921" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://f.hatena.ne.jp/sirocco634/20090110073921', '');" class="hatena-fotolife" target="_blank"><img src="http://cdn-ak.f.st-hatena.com/images/fotolife/s/sirocco634/20090110/20090110073921.png" alt="f:id:sirocco634:20090110073921p:image" title="f:id:sirocco634:20090110073921p:image" class="hatena-fotolife" /></a>
|
|
</p>
|
|
|
|
<h4>
|
|
対象とする人
|
|
</h4>
|
|
|
|
<ul>
|
|
<li>
|
|
小川版のpLatexを導入している人で、Emacs MuseでPDFを生成したい人
|
|
</li>
|
|
<li>
|
|
Emacsのデフォルト文字コードがshift-jisではない人
|
|
</li>
|
|
</ul>
|
|
|
|
<h4>
|
|
基本的な設定
|
|
</h4>
|
|
|
|
<p>
|
|
Carbon Emacsでの設定例は以下のサイトが参考になります。
|
|
</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<a href="http://homepage.mac.com/matsuan_tamachan/software/EmacsMuse.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://homepage.mac.com/matsuan_tamachan/software/EmacsMuse.html', 'emacs-muse のインストールと設定<BR> (Carbon Emacs & NTEmacs)');" target="_blank">emacs-muse のインストールと設定<BR> (Carbon Emacs & NTEmacs)</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://hawaii.naist.jp/~kohei-h/my/emacs-muse.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://hawaii.naist.jp/~kohei-h/my/emacs-muse.html', '機械学習序曲(仮) > Emacs Museを用いたスマートな文書作成法');" target="_blank">機械学習序曲(仮) > Emacs Museを用いたスマートな文書作成法</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://sourceforge.jp/magazine/07/04/11/0221217" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://sourceforge.jp/magazine/07/04/11/0221217', '文書作成に役立つEmacs Muse – SourceForge.JP Magazine');" target="_blank">文書作成に役立つEmacs Muse – SourceForge.JP Magazine</a>
|
|
</li>
|
|
<li>
|
|
<a href="http://hiro2.jp/2007-06-18-1.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://hiro2.jp/2007-06-18-1.html', '[hiro] muse-modeでpdf作成');" target="_blank">[hiro] muse-modeでpdf作成</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
を参考にするといいです。特に「<a href="http://hiro2.jp/2007-06-18-1.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://hiro2.jp/2007-06-18-1.html', '[hiro] muse-modeでpdf作成');" target="_blank">[hiro] muse-modeでpdf作成</a>」では小川版のplatexを用いた関数が定義されているようなので、これを用います。
|
|
</p>
|
|
|
|
<h4>
|
|
問題発生!
|
|
</h4>
|
|
|
|
<p>
|
|
小川版のpLatexは文字コードとしてshift-jisしかダメなようです。でもそれだと、文字コードの違うtexソースは文字化けして、platexを通りません。結果的に、dviファイルが作成されずエラーが出てPDFが作れなくなります。
|
|
</p>
|
|
|
|
<p>
|
|
「<a href="http://hiro2.jp/2007-06-18-1.html" onclick="__gaTracker('send', 'event', 'outbound-article', 'http://hiro2.jp/2007-06-18-1.html', '[hiro] muse-modeでpdf作成');" target="_blank">[hiro] muse-modeでpdf作成</a>」ではPDF作成用の関数を自前で定義しているようです:
|
|
</p>
|
|
|
|
<pre class="syntax-highlight">
|
|
<span class="synSpecial">(</span><span class="synStatement">defun</span> muse-latex-pdf-generate2 <span class="synSpecial">(</span>file output-path final-target<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>muse-publish-transform-output
|
|
file output-path final-target <span class="synConstant">"PDF"</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">function</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">lambda</span> <span class="synSpecial">(</span>file output-path<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">let</span> <span class="synSpecial">((</span>command <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"cd \"%s\"; platex \"%s\";"</span>
|
|
<span class="synSpecial">(</span>file-name-directory output-path<span class="synSpecial">)</span> file<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span>times <span class="synConstant"></span><span class="synSpecial">)</span>
|
|
result<span class="synSpecial">)</span>
|
|
<span class="synComment">;; XEmacs can sometimes return a non-number result. We'll err</span>
|
|
<span class="synComment">;; on the side of caution by continuing to attempt to generate</span>
|
|
<span class="synComment">;; the PDF if this happens and treat the final result as</span>
|
|
<span class="synComment">;; successful.</span>
|
|
<span class="synSpecial">(</span>while <span class="synSpecial">(</span><span class="synStatement">and</span> <span class="synSpecial">(</span><span class="synStatement"><</span> times <span class="synConstant">2</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">or</span> <span class="synSpecial">(</span><span class="synStatement">not</span> <span class="synSpecial">(</span><span class="synStatement">numberp</span> result<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">not</span> <span class="synSpecial">(</span><span class="synStatement">eq</span> result <span class="synConstant"></span><span class="synSpecial">))</span>
|
|
<span class="synComment">;; table of contents takes 2 passes</span>
|
|
<span class="synSpecial">(</span>file-readable-p
|
|
<span class="synSpecial">(</span>muse-replace-regexp-in-string
|
|
<span class="synConstant">"\\.tex\\'"</span> <span class="synConstant">".toc"</span> file <span class="synStatement">t</span> <span class="synStatement">t</span><span class="synSpecial">))))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> result <span class="synSpecial">(</span>shell-command command<span class="synSpecial">)</span>
|
|
times <span class="synSpecial">(</span><span class="synStatement">1+</span> times<span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synStatement">or</span> <span class="synSpecial">(</span><span class="synStatement">not</span> <span class="synSpecial">(</span><span class="synStatement">numberp</span> result<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">eq</span> result <span class="synConstant"></span><span class="synSpecial">))</span>
|
|
<span class="synStatement">t</span>
|
|
<span class="synStatement">nil</span><span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">let</span> <span class="synSpecial">((</span>dvi <span class="synSpecial">(</span>muse-replace-regexp-in-string
|
|
<span class="synConstant">".tex"</span> <span class="synConstant">""</span> file <span class="synStatement">t</span> <span class="synStatement">t</span><span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span>shell-command <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"cd \"%s\"; dvipdfmx \"%s\";"</span>
|
|
<span class="synSpecial">(</span>file-name-directory output-path<span class="synSpecial">)</span> dvi<span class="synSpecial">)))</span>
|
|
<span class="synSpecial">))</span>
|
|
<span class="synConstant">".aux"</span> <span class="synConstant">".toc"</span> <span class="synConstant">".out"</span> <span class="synConstant">".log"</span> <span class="synConstant">".dvi"</span><span class="synSpecial">))</span>
|
|
</pre>
|
|
|
|
<p>
|
|
単純にplatexを適切な回数分実行し、生成されたdviファイルをdvipdfmxに渡しているようです。
|
|
</p>
|
|
|
|
<p>
|
|
問題なのは生成されるtexファイルの文字コードがshift-jisではないことなので、以下の関数を定義してみました:
|
|
</p>
|
|
|
|
<pre class="syntax-highlight">
|
|
<span class="synComment">;; This function receives an argument and</span>
|
|
<span class="synComment">;; it converts that file into shift-jis.</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">defun</span> generate_shiftjis <span class="synSpecial">(</span>file<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">let*</span> <span class="synSpecial">((</span>tempfile <span class="synSpecial">(</span>expand-file-name <span class="synSpecial">(</span>make-temp-file <span class="synConstant">"tmp"</span> <span class="synStatement">nil</span> <span class="synConstant">".tex"</span><span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span>cmd1 <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"cp %s %s"</span> file tempfile<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span>cmd2 <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"nkf -s %s > %s"</span> tempfile file<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span>cmd3 <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"rm %s"</span> tempfile<span class="synSpecial">))</span>
|
|
result<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>call-process shell-file-name <span class="synStatement">nil</span> <span class="synStatement">nil</span> <span class="synStatement">t</span>
|
|
shell-command-switch cmd1<span class="synSpecial">)</span> <span class="synComment">; (shell-command cmd1)</span>
|
|
<span class="synSpecial">(</span>call-process shell-file-name <span class="synStatement">nil</span> <span class="synStatement">nil</span> <span class="synStatement">t</span>
|
|
shell-command-switch cmd2<span class="synSpecial">)</span> <span class="synComment">; (shell-command cmd2)</span>
|
|
<span class="synSpecial">(</span>call-process shell-file-name <span class="synStatement">nil</span> <span class="synStatement">nil</span> <span class="synStatement">t</span>
|
|
shell-command-switch cmd3<span class="synSpecial">)))</span> <span class="synComment">; (shell-command cmd3)</span>
|
|
</pre>
|
|
|
|
<p>
|
|
やっているのは
|
|
</p>
|
|
|
|
<ol>
|
|
<li>
|
|
既存のtexファイル(文字コードがshit-jisではない)を一時ファイルに待避
|
|
</li>
|
|
<li>
|
|
nkfで待避ファイルをshift-jisに変換し、その結果を既存のtexファイルにリダイレクト
|
|
</li>
|
|
<li>
|
|
待避ファイルの削除
|
|
</li>
|
|
</ol>
|
|
|
|
<p>
|
|
です。これをplatex実行前に行うようにしてみました。
|
|
</p>
|
|
|
|
<h4>
|
|
実際の設定
|
|
</h4>
|
|
|
|
<p>
|
|
このようになりました:
|
|
</p>
|
|
|
|
<pre class="syntax-highlight">
|
|
<span class="synComment">;; ============</span>
|
|
<span class="synComment">;; === muse ===</span>
|
|
<span class="synComment">;; ============</span>
|
|
<span class="synComment">;; load authoring mode</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-mode</span><span class="synSpecial">)</span>
|
|
<span class="synComment">;; load publishing styles I use</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-html</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-latex</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-texinfo</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-docbook</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-wiki</span><span class="synSpecial">)</span>
|
|
<span class="synComment">;; (setq muse-html-encoding-default 'utf-8)</span>
|
|
<span class="synComment">;; (setq muse-html-meta-content-encoding (quote utf-8))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> muse-latexcjk-encoding-default
|
|
<span class="synSpecial">(</span><span class="synStatement">cdr</span> <span class="synSpecial">(</span><span class="synStatement">assoc</span> <span class="synSpecial">'</span><span class="synIdentifier">utf-8</span> muse-latexcjk-encoding-map<span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span>
|
|
muse-mode-hook
|
|
<span class="synSpecial">'(</span><span class="synStatement">lambda</span> <span class="synSpecial">()</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> outline-regexp <span class="synConstant">"*+"</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> outline-minor-mode <span class="synStatement">t</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> coding-system-for-write 'utf-8<span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">require</span> <span class="synSpecial">'</span><span class="synIdentifier">muse-project</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>add-to-list <span class="synSpecial">'</span><span class="synIdentifier">muse-project-alist</span>
|
|
<span class="synSpecial">'(</span><span class="synConstant">"Default"</span>
|
|
<span class="synSpecial">(</span><span class="synConstant">"~/working/muse/default"</span> :default <span class="synConstant">"index"</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>:base <span class="synConstant">"html"</span> :path <span class="synConstant">"~/publish/html"</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>:base <span class="synConstant">"latex"</span> :path <span class="synConstant">"~/publish/pdf"</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>:base <span class="synConstant">"pdf"</span> :path <span class="synConstant">"~/publish/pdf"</span><span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> muse-latex-header
|
|
<span class="synSpecial">(</span>concat
|
|
<span class="synConstant">"\\documentclass{jsarticle}\n"</span>
|
|
<span class="synConstant">"\\usepackage[expert,deluxe,multi]{otf}\n"</span>
|
|
<span class="synConstant">"\\usepackage[dvipdfm]{graphicx}\n"</span>
|
|
<span class="synConstant">"\\usepackage{tabularx}\n"</span>
|
|
<span class="synConstant">"\\renewcommand{\\figurename}{Fig.}\n\n"</span>
|
|
<span class="synConstant">"\\usepackage{float}\n\n"</span>
|
|
<span class="synConstant">"\\usepackage{fancyhdr}\n"</span>
|
|
<span class="synConstant">"\\pagestyle{fancy}\n"</span>
|
|
<span class="synConstant">"\\lhead{<lisp>(muse-publishing-directive \"title\")</lisp>}\n"</span>
|
|
<span class="synConstant">"\\chead{}\n"</span>
|
|
<span class="synConstant">"\\rhead{<lisp>(muse-publishing-directive \"date\")</lisp>}\n"</span>
|
|
<span class="synConstant">"\\cfoot{\\thepage}\n"</span>
|
|
<span class="synConstant">"\\setlength{\\headheight}{16pt}\n"</span>
|
|
<span class="synConstant">"\\begin{document}\n\n"</span>
|
|
<span class="synConstant">"% フォントの選択\n"</span>
|
|
<span class="synConstant">"% \\usekanji{JY1}{mc}{m}{n} % 明朝\n"</span>
|
|
<span class="synConstant">"% \\usekanji{JY1}{mc}{bx}{n} % ゴシック\n"</span>
|
|
<span class="synConstant">"% \\usekanji{JY1}{gt}{m}{n} % ゴシック\n"</span>
|
|
<span class="synConstant">"% \\gtfamily % ヒラギノ角ゴシック\n"</span>
|
|
<span class="synConstant">"% \\bfseries % ヒラギノ明朝ボールド\n"</span>
|
|
<span class="synConstant">"% \\gtfamily\\bfseries % ヒラギノゴシックボールド\n"</span>
|
|
<span class="synConstant">"\\mgfamily % ヒラギノ丸ゴシック\n\n"</span>
|
|
<span class="synConstant">"%% 表紙作製\n"</span>
|
|
<span class="synConstant">"\\title{<lisp>(muse-publishing-directive \"title\")</lisp>}\n"</span>
|
|
<span class="synConstant">"\\author{<lisp>(muse-publishing-directive \"author\")</lisp>}\n"</span>
|
|
<span class="synConstant">"\\date{<lisp>(muse-publishing-directive \"date\")</lisp>}\n\n"</span>
|
|
<span class="synConstant">"\\maketitle\n"</span>
|
|
<span class="synConstant">"\\pagebreak\n\n"</span>
|
|
<span class="synConstant">"%% 目次ページ作製\n"</span>
|
|
<span class="synConstant">"% \\Large\n"</span>
|
|
<span class="synConstant">"% \\hypertarget{mokuji}{}\n"</span>
|
|
<span class="synConstant">"% \\begin{center}\\LARGE\\bf\n"</span>
|
|
<span class="synConstant">"% 目次のタイトル\n"</span>
|
|
<span class="synConstant">"% \\end{center}\n"</span>
|
|
<span class="synConstant">"% \\tableofcontents\n"</span>
|
|
<span class="synConstant">"% \\pagebreak\n\n"</span>
|
|
<span class="synConstant">"<lisp>(and muse-publish-generate-contents\n \"\\\\tableofcontents\n\\\\newpage\")</lisp>\n"</span><span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">defun</span> muse-latex-pdf-generate2 <span class="synSpecial">(</span>file output-path final-target<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>muse-publish-transform-output
|
|
file output-path final-target <span class="synConstant">"PDF"</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">function</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">lambda</span> <span class="synSpecial">(</span>file output-path<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">let</span> <span class="synSpecial">((</span>command <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"cd \"%s\"; platex \"%s\";"</span>
|
|
<span class="synSpecial">(</span>file-name-directory output-path<span class="synSpecial">)</span> file<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span>times <span class="synConstant"></span><span class="synSpecial">)</span>
|
|
result<span class="synSpecial">)</span>
|
|
<span class="synComment">;; Convert the character code into shift-jis</span>
|
|
<span class="synSpecial">(</span>generate_shiftjis file<span class="synSpecial">)</span>
|
|
<span class="synComment">;; XEmacs can sometimes return a non-number result. We'll err</span>
|
|
<span class="synComment">;; on the side of caution by continuing to attempt to generate</span>
|
|
<span class="synComment">;; the PDF if this happens and treat the final result as</span>
|
|
<span class="synComment">;; successful.</span>
|
|
<span class="synSpecial">(</span>while <span class="synSpecial">(</span><span class="synStatement">and</span> <span class="synSpecial">(</span><span class="synStatement"><</span> times <span class="synConstant">2</span><span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">or</span> <span class="synSpecial">(</span><span class="synStatement">not</span> <span class="synSpecial">(</span><span class="synStatement">numberp</span> result<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">not</span> <span class="synSpecial">(</span><span class="synStatement">eq</span> result <span class="synConstant"></span><span class="synSpecial">))</span>
|
|
<span class="synComment">;; table of contents takes 2 passes</span>
|
|
<span class="synSpecial">(</span>file-readable-p
|
|
<span class="synSpecial">(</span>muse-replace-regexp-in-string
|
|
<span class="synConstant">"\\.tex\\'"</span> <span class="synConstant">".toc"</span> file <span class="synStatement">t</span> <span class="synStatement">t</span><span class="synSpecial">))))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">setq</span> result <span class="synSpecial">(</span>shell-command command<span class="synSpecial">)</span>
|
|
times <span class="synSpecial">(</span><span class="synStatement">1+</span> times<span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">if</span> <span class="synSpecial">(</span><span class="synStatement">or</span> <span class="synSpecial">(</span><span class="synStatement">not</span> <span class="synSpecial">(</span><span class="synStatement">numberp</span> result<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">eq</span> result <span class="synConstant"></span><span class="synSpecial">))</span>
|
|
<span class="synStatement">t</span>
|
|
<span class="synStatement">nil</span><span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">let</span> <span class="synSpecial">((</span>dvi <span class="synSpecial">(</span>muse-replace-regexp-in-string
|
|
<span class="synConstant">".tex"</span> <span class="synConstant">""</span> file <span class="synStatement">t</span> <span class="synStatement">t</span><span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span>shell-command <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"cd \"%s\"; dvipdfmx \"%s\";"</span>
|
|
<span class="synSpecial">(</span>file-name-directory output-path<span class="synSpecial">)</span> dvi<span class="synSpecial">)))</span>
|
|
<span class="synSpecial">))</span>
|
|
<span class="synConstant">".aux"</span> <span class="synConstant">".toc"</span> <span class="synConstant">".out"</span> <span class="synConstant">".log"</span> <span class="synConstant">".dvi"</span><span class="synSpecial">))</span>
|
|
<span class="synComment">;; This function receives an argument and</span>
|
|
<span class="synComment">;; it converts that file into shift-jis.</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">defun</span> generate_shiftjis <span class="synSpecial">(</span>file<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span><span class="synStatement">let*</span> <span class="synSpecial">((</span>tempfile <span class="synSpecial">(</span>expand-file-name <span class="synSpecial">(</span>make-temp-file <span class="synConstant">"tmp"</span> <span class="synStatement">nil</span> <span class="synConstant">".tex"</span><span class="synSpecial">)))</span>
|
|
<span class="synSpecial">(</span>cmd1 <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"cp %s %s"</span> file tempfile<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span>cmd2 <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"nkf -s %s > %s"</span> tempfile file<span class="synSpecial">))</span>
|
|
<span class="synSpecial">(</span>cmd3 <span class="synSpecial">(</span><span class="synStatement">format</span> <span class="synConstant">"rm %s"</span> tempfile<span class="synSpecial">))</span>
|
|
result<span class="synSpecial">)</span>
|
|
<span class="synSpecial">(</span>call-process shell-file-name <span class="synStatement">nil</span> <span class="synStatement">nil</span> <span class="synStatement">t</span>
|
|
shell-command-switch cmd1<span class="synSpecial">)</span> <span class="synComment">; (shell-command cmd1)</span>
|
|
<span class="synSpecial">(</span>call-process shell-file-name <span class="synStatement">nil</span> <span class="synStatement">nil</span> <span class="synStatement">t</span>
|
|
shell-command-switch cmd2<span class="synSpecial">)</span> <span class="synComment">; (shell-command cmd2)</span>
|
|
<span class="synSpecial">(</span>call-process shell-file-name <span class="synStatement">nil</span> <span class="synStatement">nil</span> <span class="synStatement">t</span>
|
|
shell-command-switch cmd3<span class="synSpecial">)))</span> <span class="synComment">; (shell-command cmd3)</span>
|
|
<span class="synSpecial">(</span>muse-derive-style <span class="synConstant">"pdf"</span> <span class="synConstant">"latex"</span>
|
|
:final <span class="synSpecial">'</span><span class="synIdentifier">muse-latex-pdf-generate2</span>
|
|
:browser <span class="synSpecial">'</span><span class="synIdentifier">muse-latex-pdf-browse-file</span>
|
|
:link-suffix <span class="synSpecial">'</span><span class="synIdentifier">muse-latex-pdf-extension</span>
|
|
:osuffix <span class="synSpecial">'</span><span class="synIdentifier">muse-latex-pdf-extension</span><span class="synSpecial">)</span>
|
|
</pre>
|
|
</div> |