emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Robert Klein <roklein@roklein.de>
To: "Luis Felipe López Acevedo" <felipe.lopez@openmailbox.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Exporting multilingual documents (with Japanese) to PDF
Date: Tue, 8 Sep 2015 07:36:13 +0200	[thread overview]
Message-ID: <20150908073613.1a430b93@pckr150.mpip-mainz.mpg.de> (raw)
In-Reply-To: <50f675e03f1e1ee53526d58dea829ded@openmailbox.org>

Hi,

On Mon, 07 Sep 2015 19:18:02 -0500
Luis Felipe López Acevedo <felipe.lopez@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

  parent reply	other threads:[~2015-09-08  5:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08  0:18 Exporting multilingual documents (with Japanese) to PDF Luis Felipe López Acevedo
2015-09-08  1:24 ` Thomas S. Dye
2015-09-08  5:36 ` Robert Klein [this message]
2015-09-08 17:57   ` Luis Felipe López Acevedo
  -- strict thread matches above, loose matches on Subject: below --
2015-09-07 20:56 Luis Felipe López Acevedo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150908073613.1a430b93@pckr150.mpip-mainz.mpg.de \
    --to=roklein@roklein.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=felipe.lopez@openmailbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).