# Too large space after single quotation mark (’) U+2019 with zxjatype package

I have in my text just some words in Japanese and a use the zxjatype and the zxjafont packages to get a rendering for Japanese fonts. But the problem is all the occurrences of the single quotation mark () is followed by a too large blank space.

So, with the following MWE…

\documentclass{article}
\usepackage{zxjatype}
\usepackage[ipa]{zxjafont}
\begin{document}

\section{日本語}
Machin
お早う

l’orem

\textsf{こんにちわ}

\end{document}

I get this rendering:

I add that I can’t replace the character with the ' one. I really need to use U+2019.

So, how can I delete the blanc space after the quotation mark?

Update: I need to use U+2019 specially.

• I get no space with l'orem (straight quote instead of U+2019). Apparently, zxjatype assumes that there is a transition between Latin and Japanese at U+2019. – egreg Nov 16 '17 at 22:02
• Yes, with ' it work correctly, but I really need to use because it is related to other thinks. – fauve Nov 16 '17 at 22:09
• I added another workaround – egreg Nov 16 '17 at 22:25

The character U+2019 apparently implies a transition to Japanese. It's not clear what rule is followed, but spaces are added at transitions; moreover the character U+2019 in IPAMincho has the same width as kana characters, resulting in very wide space.

This doesn't happen when ' is used.

\documentclass{article}
\usepackage{zxjatype}
\usepackage[ipa]{zxjafont}

\begin{document}

\section{日本語}

Machinお早うMachin

l’orem

l'orem

\textsf{こんにちわ}

\end{document}

I don't read Japanese, so I can't know whether this has adverse effects:

\documentclass{article}
\usepackage{zxjatype}
\usepackage[ipa]{zxjafont}

\XeTeXcharclass’=\XeTeXcharclassA

\begin{document}

\section{日本語}

Machinお早うMachin

l’orem

l'orem

\textsf{こんにちわ}

\end{document}

• Great, that exactly what I was searching. So there is a similar hack for (U+2014 EM DASH) character? It seam having also a strange behavior with zxjafont. Or have I to open a new tread? – fauve Nov 16 '17 at 22:37
• Since zxjatype treats U+2019 as a Japanese character, the font is switched and the spacing is tuned. The package provides a command \textrawen and rawentext environment, which disable these processes and output characters using Latin character font. They are explained here by the package author (unfortunately in Japanese). – yudai-nkt Nov 17 '17 at 9:36
• \textrawen may be best used with your newunicodechar package, I guess. – yudai-nkt Nov 17 '17 at 9:40

I have some time now, so I'd like to post my comment on egreg's answer as my own with some additional information.

As egreg guesses, U+2019 is considered to be a Japanese character and the following adjustments are carried out:

• Switching to Japanese font
• Insertion of a space between CJK and Latin characters

If you want to disable these adjustments, \textrawen provided by zxjatype is the way to go. I think this is safer than using a low-level primitive.

\documentclass{article}
\usepackage{zxjatype}
\usepackage[ipa]{zxjafont}
\begin{document}

\section{日本語}
Machin
お早う

l’orem
l\textrawen{’}orem

\textsf{こんにちわ}

\end{document}

If you don't want to use \textrawen every time you write and all the in your document can safely be assumed to be a Latin character, you can use the newunicodechar package.

\documentclass{article}
\usepackage{newunicodechar}
\usepackage{zxjatype}
\usepackage[ipa]{zxjafont}
\newunicodechar{’}{\textrawen{’}}
\begin{document}

\section{日本語}
Machin
お早う

l’orem

\textsf{こんにちわ}

\end{document}

By the way, the space between "Machin" and "お早う" is different in OP's code and egreg's code. Consider the following example:

\documentclass{article}
\usepackage{zxjatype}
\usepackage[ipa]{zxjafont}
\xeCJKsetup{
CJKecglue =
{ \hspace { 1em } }
% initially set to \hspace { 0.25em plus 0.15em minus 0.05em } by zxjatype.
}
\begin{document}
Machin%
お早う
Machin
\end{document}

The former space is the one between CJK and Latin characters as I noted above, and the latter is just a whitespace inserted by \n. Either one is OK, but please be sure to be consistent within one document.

As the names suggest, zxjatype is a package to typeset a Japanese document with XeLaTeX and xeCJK is to typeset a CJK document with XeLaTeX. Since you said

I have in my text just some words in Japanese

in the question, you don't seem to be making an entire document in Japanese but to put several Japanese words in a Latin character document. In such cases, using zxjatype and xeCJK is an overkill or can even be harmful like this question.

If you just want to use a font that has Japanese glyphs, fontspec is enough.

\documentclass{article}
\usepackage{fontspec}
\newfontfamily{\mainja}{ipam.ttf}
\newfontfamily{\sansja}{ipag.ttf}
\newcommand*{\textsfja}[1]{{\sansja #1}}
\begin{document}
English, Français, and {\mainja 日本語} \par
\sffamily English, Français, and \textsfja{日本語}
\end{document}

Note that since spaces between CJK and Latin characters are not automatically inserted without zxjatype, you will need to use an ASCII whitespace to delimit words.

• It’s much better, but is there a way to only activate CJK behavior only in a specific environment such as \japanese and keep the thinks out of this environment work normally? – fauve Nov 19 '17 at 19:08
• @fauve Considering your purpose, I don't think you need zxjatype. Please refer to the update. – yudai-nkt Nov 20 '17 at 4:51

Finaly, instead of using zxjatype I resolve the problem with xeCJK.