# Writing in Hindi and other scripts (was: Re: [OS X TeX] Installing CJK)

Thomas Schröder hydrochlorix at gmx.net
Thu Jul 15 14:43:21 CEST 2004

Hi everybody,

I wanted to write a few words in Hindi in a LaTeX document and was
surprised that using the original CJK tip from Peder Axensten didn't
work. Turns out the Cyberbit.ttf font has no characters of the
Devanagari script in which Hindi is written. I then looked around the
web for a solution and found the Titus TrueType font which has support
for Devanagari on this site:

http://titus.fkidg1.uni-frankfurt.de/unicode/tituut.asp

than that the font is free for private use. Using the original mail
from Peder I was able to install and use the Titus TrueType font.

I'm in the process of learning Hindi and am therefor no expert and
don't know yet if with this method you can do everything that is
necessary for writing correct Hindi. But I think it is lots easier than
using a preprocessor or writing it in a Roman style similar to the
ArabTeX package and so I thought somebody else might find it useful,
too. That being said, here is how I installed everything. I'll use
Peder's original mail and give my comments underneath as how things
will differ for the Titus font.

Am 01.11.2003 um 21:26 schrieb Peder Axensten:

> The original instructions are by Olivier Delloye -- thank you Olivier!
> Without your help I feel I would never have succeded with the
> installation!
>
> Renaming "Cyberbit.ttf" (in step 3) was absent from the original
> instructions
> and I've changed step 5 and a few other things -- So don't blame
> Olivier
> if you have problems!
>
>
> 1. Installation of UCS Package
>   uncompress/untar the file
>   move the whole "ucs" directory to somewhere appropriate in your
> TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/tex/latex/ucs/)

I think this is not necessary anymore because Gerben has incorporated
the UCS package for some time now in his distribution.

> 2. Installation of CJK Package
> - uncompress/untar the "cjk-4.5.1.tar.gz" file
> - move the whole directory to somewhere appropriate in your TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/tex/latex/cjk/)

This is a necessary step because it isn't included yet, at least not in
my version.

> 3. Installation of Unicode True Type font (cyberbit)
>   ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/
>   uncompress it and rename "Cyberbit.ttf" to "cyberbit.ttf" (no
> capitals)

From here on things will differ, obviously :-)

http://titus.fkidg1.uni-frankfurt.de/unicode/tituut.asp and rename it
to tituscbz.ttf i.e. no capitals.

You'll need this, too.

> - make sure "cyberbit.ttf" and "Unicode.sfd" are in the same directory

In this case tituscbz.ttf and Unicode.sfd.

> - from the terminal, go to that directory and run
>   "ttf2tfm cyberbit.ttf -w cyberbit at Unicode@"
>   in order to create ".tfm" and ".enc" files

ttf2tfm tituscbz.ttf -w tituscbz at Unicode@

> - move all the ".tfm" files to somewhere appropriate in your TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/fonts/tfm/bitstrea/cyberbit)

You might also put the tfm files in your private TeX folder e.g.
~/Library/texmf/fonts/tfm/tituscbz. If this is confusing,  there's
many, many threads on this list, where to put TeX files. I'll go with
the private TeX folder, if it's all right with you :-)
Therefor: put all .tfm files in ~/Library/texmf/fonts/tfm/tituscbz.

> - move all the ".enc" files to somewhere appropriate in your TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/pdftex/enc/)

Move all the .enc files to ~/Library/texmf/tex/tituscbz/enc

> http://delloye.free.fr/cyberbit.map
>   and move it to somewhere appropriate in your TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/pdftex/config/)

This will obviously not work, but we'll just create our own .map file.
The map file looks like this:

tituscbz00 <tituscbz.ttf <tituscbz00.enc
tituscbz01 <tituscbz.ttf <tituscbz01.enc
....

You'll recognize two of the just created .enc files, so all you have to
do is this: for every .enc file that has been created, put it on one
line and put its name without the .enc, the name of the font file i.e.
tituscbz.ttf with a "<"-sign and finally another "<"-sign directly in
front of it. And make sure the .map file has Unix line endings and not
Mac line endings. Name the .map file "tituscbz.map" and move it to
~/Library/texmf/fonts/map. Sounds a little weird, I know, but from the
example above you should be able to understand what I mean.

> http://delloye.free.fr/c70cyberbit.fd
>   and move it to somewhere appropriate in your TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/tex/latex/cyberbit/)

I downloaded this file, hacked it a little bit and renamed it to
"c70tituscbz.fd". The contents is this:

----
\ProvidesFile{tituscbz.fd}
% character set: Unicode U+0080 - U+FFFD
% font encoding: Unicode

\DeclareFontFamily{C70}{tituscbz}{\hyphenchar \font\m at ne}
\DeclareFontShape{C70}{tituscbz}{m}{n}{<-> CJK * tituscbz}{}
\DeclareFontShape{C70}{tituscbz}{bx}{n}{<-> CJKb * tituscbz}{\CJKbold}

\endinput
----

Move "c70tituscbz.fd" to ~/Library/texmf/tex/tituscbz/.

> - move the "cyberbit.ttf" to somewhere appropriate in your TeX-tree
>   (e.g. /usr/local/teTeX/share/texmf.local/fonts/truetype/ -- check in
> your
>   /usr/local/teTeX/share/texmf/web2c/texmf.cnf file the "%TrueType
> outline
>   fonts" line and the "TTFONTS" value. You have to copy the
> Cybebrbit.ttf file
>   in a directory included in the TTFONTS path.)

Things will differ a little bit here because Gerben's setup has changed
since Peder's mail. Move tituscbz.ttf to
~/Library/texmf/fonts/truetype/. Then type in the Terminal:

sudo updmap --enable Map tituscbz.map

This will enable the Titus font for the use with pdflatex. The rest
above isn't necessary.

> 4. Declaration of the new font
> - open /usr/local/tetex/share/texmf.local/web2c/updmap.cfg (if there
> is none,
>   first copy it from
> /usr/local/tetex/share/texmf.tetex/web2c/updmap.cfg)
>   and add this line "MixedMap cyberbit.map" (without quotes) to the
> file.

This isn't necessary, either, with Gerben's new setup.

> - run "sudo texhash" in the terminal

If you put all of the files in your private folder, then this isn't
necessary, either.

> - run "sudo updmap" in the terminal

We already did this in a modified version above.

> 5. Using the new environment in LaTeX
> You just need to include the three following lines in the preamble :
>   \usepackage[encapsulated]{CJK}
>   \usepackage{ucs}
>   \usepackage[utf8]{inputenc}

This is necessary.

> It may also be a good idea to create a new command :
>   \newcommand{\cjktext}[1]{\begin{CJK}{UTF8}{cyberbit}#1\end{CJK}}

We'll have to change this, obviously because we use a different font:

\newcommand{\cjktext}[1]{\begin{CJK}{UTF8}{tituscbz}#1\end{CJK}}

> Now, when you want to type chinese, you just use the command:
>   \cjktext{enter your chinese text here}

Now, when you want to type Hinde, you just use the command:

And that's it! Apparently, the Titus font also supports Arabic, Hebrew
and Russian and what not, but not Chinese. I can live with that because
I don't speak Chinese and there's always the original Cyberbit font
that you can use when you are in need of Chinese. Anyways, with this
tip you should be able to use any Unicode font that's out there or may
come out in the future in case neither Titus or Cyberbit incorporate
the language you'd like to use.

Thanks to Peder for the original and very comprehensive mail!

I hope this will be useful for some of you. I at least find it useful
and I also had a little fun, figuring things out :-)

Bye, Thomas

-----------------------------------------------------
Post: <mailto:MacOSX-TeX at email.esm.psu.edu>