XeLaTeXで書く仕方 ・ Writing in japanese with XeLaTeX

  • 日本人であれば、XeLaTeXを使っていいです。長い説明するより簡単な例を示します。
  • \documentclass{article}
    \usepackage{xltxtra} %xltxtra = fontspec, xunicode, etc.
    \usepackage{verbatim}
    \usepackage{url}
    \setmainfont{IPA明朝}
    \linespread{1.05}
    \newfontfamily\en[Numbers=OldStyle,Ligatures=Historic]{TeX Gyre Pagella}
    \begin{document}

    日本語で書くためにはIPA明朝を使っていいです。しかし、時々英語などで書
    く機会があります。その時、
    \begin{verbatim}
    \verbatim{\en your text goes here}
    \end{verbatim}
    を入力したら、英語のためのフォントで書ける。

    たとえば、{\en here is a test to show you how writing both in
    english and in japanese is easy with \XeLaTeX. Of course, you can also mix any
    other languages you want.}

    {\en \XeLaTeX}に関しては次の{\en url}を参照してください:

    \url{http://tug.org/xetex/}
    \end{document}

    以上のファイルをXeLaTeXでコンパイルしてください。そうするようにTeXworksを使って、XeLaTeXを選択して、緑色のボタンを押すとpdfファイルを得る。

    以上は簡単な例だけです。私の場合は日本語の文書を書く必要がなくて、ただ混じられた言語のあるテキストを書けたいのです。日本語の論文を書く人であったら、polyglossiaパッケージを使っていいのではないかと思います。そのためにこのサイトを参照してください。

  • If you plan to write english text with some japanese text or quotes included in your text, and not an entire text in japanese, then you should only put the following command in your preamble :

    \newfontfamily\ja{IPA明朝}

    This way, you will just have to insert {\ja } and to typeset japanese inside the {}. Therefore if you wish to write, in your english text 一言だけ, you have to do like this {\ja 一言}. As an example of my short explanation, you can try to compile the following file :

    \documentclass{article}
    \usepackage{xltxtra} %xltxtra = fontspec, xunicode, etc.
    \setmainfont{TeX Gyre Pagella}
    \newfontfamily\ja{IPA明朝}
    \begin{document}
    Here is an english sentence, followed by {\ja 日本語の例。} \XeLaTeX {\ja は便利ですね。}
    \end{document}

    Here is a screenshot showing the output and the .tex file :

Advertisements
  1. Howdy there, are you having difficulties with the hosting? I needed to refresh the page about huge number of times in order to get the page to run!

  2. hello,

    I guess it might be a problem related to your connection, maybe to slow. Do you use your own connection ? If you use your own connection, and if it is not a problem related to this connection, then I would recommend to stop downloading when looking at website pages refreshing too slow, and to restart your downloads later.

    Regards,
    Alexandre Krispin

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: