emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporting multilingual documents (with Japanese) to PDF
@ 2015-09-07 20:56 Luis Felipe López Acevedo
  0 siblings, 0 replies; 5+ messages in thread
From: Luis Felipe López Acevedo @ 2015-09-07 20:56 UTC (permalink / raw)
  To: emacs-orgmode

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...

-- 
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Exporting multilingual documents (with Japanese) to PDF
@ 2015-09-08  0:18 Luis Felipe López Acevedo
  2015-09-08  1:24 ` Thomas S. Dye
  2015-09-08  5:36 ` Robert Klein
  0 siblings, 2 replies; 5+ messages in thread
From: Luis Felipe López Acevedo @ 2015-09-08  0:18 UTC (permalink / raw)
  To: emacs-orgmode

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...

-- 
Luis Felipe López Acevedo
http://sirgazil.bitbucket.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exporting multilingual documents (with Japanese) to PDF
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2015-09-08  1:24 UTC (permalink / raw)
  To: Luis Felipe López Acevedo; +Cc: emacs-orgmode

Aloha Luis,

Luis Felipe López Acevedo <felipe.lopez@openmailbox.org> writes:

> 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...

The following illustrates one approach.  You'll probably have to augment
the definition of the LaTeX class by adding fonts, etc., but if you have
a working example on your system that should not be hard.  Note that
the example relies on the setup code, so you'll either need to read the
code from its own file or refresh the setup with C-c C-c when point is
on one of the #+ lines at the top.

#+SELECT_TAGS: export
#+EXCLUDE_TAGS: noexport
#+CREATOR: Emacs 24.5.1 (Org mode 8.3.1)
#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
#+OPTIONS: author:nil c:nil creator:nil d:(not "LOGBOOK") date:nil e:t
#+OPTIONS: email:nil f:t inline:t num:t p:nil pri:nil prop:nil stat:t
#+OPTIONS: tags:t tasks:t tex:t timestamp:t title:nil toc:nil todo:t |:t
#+LATEX_CLASS: japanese

* Acevedo example

#+attr_latex: :options [dnp]{JIS}{min}
#+begin_CJK*
I can write this 私はキランです in Japanese.
#+end_CJK*

* Setup code                                                       :noexport:
#+name: japanese-class
#+header: :results silent
#+begin_src emacs-lisp
(add-to-list 'org-latex-classes
                '("japanese"
                  "\\documentclass{scrartcl}
                         [NO-DEFAULT-PACKAGES]
                         [PACKAGES]
                         [EXTRA]
                   \\usepackage{CJK}
                   \\usepackage{hyperref}"
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                 ("\\paragraph{%s}" . "\\paragraph*{%s}")
                 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
#+end_src


* Local variables                                                  :noexport:
# Local Variables:
# coding: euc-japan
# eval: (sbe "japanese-class")

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exporting multilingual documents (with Japanese) to PDF
  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
  2015-09-08 17:57   ` Luis Felipe López Acevedo
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Klein @ 2015-09-08  5:36 UTC (permalink / raw)
  To: Luis Felipe López Acevedo; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Exporting multilingual documents (with Japanese) to PDF
  2015-09-08  5:36 ` Robert Klein
@ 2015-09-08 17:57   ` Luis Felipe López Acevedo
  0 siblings, 0 replies; 5+ messages in thread
From: Luis Felipe López Acevedo @ 2015-09-08 17:57 UTC (permalink / raw)
  To: Robert Klein; +Cc: emacs-orgmode

On 2015-09-08 00:36, Robert Klein wrote:
> 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

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
http://sirgazil.bitbucket.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-08 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).