[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Exporting multilingual documents (with Japanese) to PDF

From: Luis Felipe López Acevedo
Subject: Re: [O] Exporting multilingual documents (with Japanese) to PDF
Date: Tue, 08 Sep 2015 12:57:32 -0500
User-agent: Roundcube Webmail/1.0.6

On 2015-09-08 00:36, Robert Klein wrote:

On Mon, 07 Sep 2015 19:18:02 -0500
Luis Felipe López Acevedo <address@hidden> wrote:


I'm using Emacs 24.4.1 on Debian 8. I currently can export to PDF
documents that mix English and Spanish, but a simple document like
the following produces a PDF with no Japanese characters at all. Only
the English and Spanish text is visible.

     #+TITLE: Notes on Japanese
     #+DATE: 2015-09-07

     * 2015年9月7日

     - おはようございます!
     - Good morning!
     - ¡Buenos días!

The "Org PDF LaTeX Output" shows several errors like this one:

     ! Package inputenc Error: Unicode char \u8:年 not set up for use
with LaTeX.

The complete log:

Searching for a solution on the Web I found this post
http://blogs.fsfe.org/ciaran/?p=150. When I use "pdflatex JIS.tex" as
indicated there, I get a good PDF with Japanese characters.

So I'm wondering how to get this working on Org mode...

like Thomas Dye showed in his mail, you have to encapsulate the
Japanese text in LaTeX with \begin{CJK} and \end{CJK}.

You can also use links or macros (using links).  An example (for
Chinese, but Japanese is basically the same, except the fonts):

Put the following in your .emacs:

#+begin_src elisp
   "zh" nil
   (lambda (path desc format)
      ((eq format 'html)
       (format "%s" desc))
      ((eq format 'latex)
       (format "\\zh{%s}" desc)))))

Put the following in the head of your org file:

#+begin_src org
  #+LaTeX_HEADER: %% CJK stuff
  #+LaTeX_HEADER: \usepackage[encapsulated]{CJK}
  #+LaTeX_HEADER: \usepackage[CJK, overlap]{ruby}
  #+LaTeX_HEADER: \usepackage{pinyin}

  #+LaTeX_HEADER: \newcommand{\zh}[1]{\begin{CJK}{UTF8}{gkai}\Large
#1\end{CJK}} % gb2312 kai #+LaTeX_HEADER: \renewcommand{\rubysize}{0.5}

  #+LaTeX_HEADER: %% pinyin 1st and 3rd tone (shortened)
  #+LaTeX_HEADER: \usepackage{newunicodechar}
  #+LaTeX_HEADER: \newunicodechar{ǎ}{\v{a}}
  #+LaTeX_HEADER: \newunicodechar{ǐ}{\v{\i}}

  #+Macro: zh [[zh:][$1]]
#+end_src org

Then use CJK in your org file like this:

#+begin_src org
  Now you can user CJK characters like {{{zh(你好!)}}} (Nǐ hǎo) or

Best regards

Hmm, that's kinda complex. I think I'll limit myself to HTML exports then.

Thomas, mahalo nui loa; Robert, thank you very much :)

Luis Felipe López Acevedo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]