Fonts & Character Setsinserting foreign language unicode characters into a LaTeX document

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
Jochen
Posts: 3
Joined: Fri Jul 16, 2021 11:05 am

inserting foreign language unicode characters into a LaTeX document

Post by Jochen »

My working-context is Windows-10, TeXLive, LaTeX, pdfLaTeX with editor TexWorks.
I am looking for a minimal (but complete) example of how to insert unicode characters from Japanese or Tamil by their unicode character codes ( like Hex UTF-32 4EAC (Japanese) or 0BAA (Tamil) ) into a LaTeX document with the output compiled into a pdf document.
So far, I tried many versions, also using XeTeX, but nothing worked. XeTeX would not even compile.
I would, if possible, prefer a solution in plain, simple LaTeX (maybe, using packages).
Thank you, Jochen

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

inserting foreign language unicode characters into a LaTeX document

Post by Ijon Tichy »

For CJK languages (Chinese, Japanese, Korean etc.) see package CJK. You also would need proper CJK fonts.

However, I would recommend to use XeLaTeX or LuaLaTeX. For those there are packages like babel-japanese, xecjk or lualatexja.

Please read the manuals of that packages for more information. Depending in the package there are different additional dependencies and rules to observe.

If you have problems in using them, please show us a Infominimal working example. That would help us to reproduce the problem.

If you only want to print single characters, you just need a proper font. Then with XeLaTeX or LuaLaTeX you can switch to that font and select the character directly, e.g., adding 京 to your source. With pdfLaTeX instead, you need a LaTeX font binding package, that maps the font to 8bit code positions (see the link in the first paragraph).

BTW: There is a good overview with examples at: How to write Japanese with LaTeX? or more in detail at Norbert Preinings blog.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Jochen
Posts: 3
Joined: Fri Jul 16, 2021 11:05 am

inserting foreign language unicode characters into a LaTeX document

Post by Jochen »

Thank you. My favorite minimal example would be something like this:

Code: Select all

\documentclass{article}
\usepackage{} ... whatever is needed 
\begin{document} 
  \char"41
  \char"4EAC 
  \char"0BAA
\end{document}
Jochen
Last edited by Stefan Kottwitz on Tue Jul 20, 2021 4:18 pm, edited 1 time in total.
Reason: code marked
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

inserting foreign language unicode characters into a LaTeX document

Post by Ijon Tichy »

\char is 8bit with pdfLaTeX. But with LuaLaTeX or XeLaTeX you could use it. But see the two documents I've linked in my last answer. For more information, e.g., about fonts see the two links at the end of my last comment.

BTW: Please try to use Code tags for block code.
Last edited by Ijon Tichy on Fri Jul 16, 2021 6:27 pm, edited 1 time in total.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Jochen
Posts: 3
Joined: Fri Jul 16, 2021 11:05 am

inserting foreign language unicode characters into a LaTeX document

Post by Jochen »

Thank you. I've got the feeling that installing a complete language package is an overkill for what I actually need. All I need is the ability to just insert few (ca. 1 - 20) single unicode-coded characters into an otherwise english language document. And I need it very seldom. Actually, it has almost nothing to do with Japanese or Tamil but just with unicode. I had hoped that this would be possible with relatively little effort.
Thank you, again, for your effort - and all the best.
Jochen
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

inserting foreign language unicode characters into a LaTeX document

Post by Ijon Tichy »

As I've already told: If you have a (OTF) font with the unicode symbols you want, you can use it very easy with LuaLaTeX or XeLaTeX (and package fontspec):

A very simple example could be:

Code: Select all

%!TeX LuaLaTeX
\documentclass{article}
\usepackage{fontspec}
\newfontfamily\Mincho{IPAexMincho}
\newfontfamily\Gothic{IPAexGothic}

\begin{document}
\section{Test of Japanese symbols with IPA fonts}
{\Mincho 日本語\char"4EAC}
{\Gothic 日本語\char"4EAC}
\end{document}
The example works out of the box with TeX Live 2021 and LuaLaTeX (or XeLaTeX).

With pdfLaTeX there is much more effort. Here I would absolutely recommend the usage of package CJK.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply