Hi,

On Mon, 07 Sep 2015 19:18:02 -0500
Luis Felipe López Acevedo <felipe.lo...@openmailbox.org> wrote:

> Hi,
> 
> 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: 
> https://bitbucket.org/sirgazil/dnd/downloads/nihongo.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
  (org-add-link-type
   "zh" nil
   (lambda (path desc format)
     (cond
      ((eq format 'html)
       (format "%s" desc))
      ((eq format 'latex)
       (format "\\zh{%s}" desc)))))
#+end_src

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
  [[zh:][你好!]].
#+end_src

Best regards
Robert


Reply via email to