\documentclass{article}
% allow Japanese characters in the main text
\usepackage[whole]{bxcjkjatype}
% allow unicode characters in the PDF table of contents
\usepackage[unicode]{hyperref}
\begin{document}
...
\end{document}
arXiv has a noble policy which accepts non-English articles, as explained in this FAQ entry. But the TeX compiler in the arXiv is the standard one, not modified for East Asian languages. One way is just to post the compiled PDF, but this is discouraged, as explained in this FAQ entry. In the following I describe how you can post a CJK article to the arXiv. The key point is that the arXiv has the full install of TeX Live, so we can use whatever macros in it.
I strongly recommend you to get the standard full install of TeX Live, if you haven't done that already. Yes it takes a lot of disk space. But your aim here is to prepare a tricky TeX file which can be processed by the arXiv auto-compiler. Being able to compile your file on your local specialized TeX installation doesn't say much about whether the arXiv can compile it. So, just get the full TeX Live, and test your file against that.
I was helped a lot by the good folks at TeX.StackExchange. See this question and this question, for example.
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{min}
... main material ...
\end{CJK}
\end{document}
You should now save the file in UTF8. Don't think of using EUC or SJIS, which brings you a lot of pain. {min}
stands for the mincho font for Japanese. For Chinese, you should replace it with {song}
. Check that your file compiles with latex
or pdflatex
.
00README.XXX
, with a line saying nohypertex
. This stops arxiv to automatically include hyperref
facility. Otherwise, it fails to compile. For more on 00README.XXX, read this FAQ entry.
sample1.tex
and the generated PDF so far. That's it!
\def\figurename{図}
. This can't appear in the preamble, because CJK characters are only allowed within \begin{CJK}...\end{CJK}
.
\usepackage[CJKbookmarks]{hyperref}
Don't forget to add the option CJKbookmarks
. Also, note that you should not remove the line nohypertex
from 00README.XXX
. You still need to stop arXiv from attempting to insert hypertex automatically.
FOO.out
containing the bookmark data, is in UTF8. (Here I'm assuming your tex file is named FOO.tex
.) You need to change it to UTF16-BE and write it out in octal sequences.
perl tweakbookmark.perl <FOO.out >tmp.out
mv tmp.out FOO.out
You then need to add a line to your TeX file saying
\let\WriteBookmarks\relax
to stop overwriting the corrected FOO.out
file with the uncorrected one. Compile the code again.
Here's sample2.tex
and the generated PDF so far.
ipamp.ttf
. If you use a font named FONT.ttf
, just replace all appearances of ipamp
with FONT
in the following.
CJK.sty
uses a trick which decomposes a CJK font into 256 subfonts. You need to generate 256 TeX font metric files as follows:
ttf2tfm ipamp.ttf -q ipamp@Unicode@
Then you add the following lines to your TeX file:
\makeatletter
\AtBeginDvi{\pdfmapline{=ipamp@Unicode@ <ipamp.ttf}}
\DeclareFontFamily{C70}{ipamp}{\hyphenchar \font\m@ne}
\DeclareFontShape{C70}{ipamp}{l}{n}{ <-> CJK * ipamp}{}
\DeclareFontShape{C70}{ipamp}{m}{n}{ <-> CJK * ipamp}{\CJKnormal}
\DeclareFontShape{C70}{ipamp}{bx}{n}{ <-> CJKb * ipamp}{\CJKbold}
\makeatother
and change \begin{CJK}{UTF8}{min}
to \begin{CJK}{UTF8}{ipamp}
. Here's sample3.tex
and the generated PDF so far.
Licence.txt ignore
so that the licence file doesn't appear in the final download in the arXiv entry. Here is a sample 00README.XXX file.
ipamp.ttf
, it's around 8 Mbytes, which is above the upper bound for an individual file at the arXiv as of 2011. So you need to remove the unnecessary characters from the font file.
perl generatefontforgescript.perl FOO.tex FOO.bbl > select.pe
fontforge -script select.pe ipamp.ttf ipamp-select.ttf
If you're not using bibtex
, you can leave out FOO.bbl
above.
This creates a smallish ttf file, named imamp-select.ttf
.
\AtBeginDvi{\pdfmapline{=ipamp@Unicode@ <ipamp-select.ttf}}
so that it uses the smaller font you just prepared.