2

I'm having difficulty displaying CJK fonts in a glossary with bib2gls. I'm using MikTeX, which I think may produce different results to TeXLive. Here's a MWE:

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\usepackage[record,style=indexgroup,nomain]{glossaries-extra}

\newglossary*{japanese}{Japanese to English}
\newglossary*{english}{English to Japanese}

\newrobustcmd{\cjkname}[1]{\begin{CJK}{UTF8}{ipxm}#1\end{CJK}}
\glsnoexpandfields

\newcommand*{\englishlettergroup}[1]{#1}
\newcommand*{\japaneselettergroup}[1]{\cjkname{#1}}
\newcommand*{\bibglslettergrouptitle}[4]{\unexpanded{\csuse{#4lettergroup}{#1}}}

\GlsXtrLoadResources[
  src=testcjk2,% bib file
  sort={ja-JP},% locale used to sort primary entries
  dual-sort={en-GB},% locale used to sort secondary entries
  type=japanese,% put the primary entries in the 'japanese' glossary
  dual-type=english% put the dual entries in the 'english' glossary
]

\begin{document}

\begin{CJK}{UTF8}{ipxm}日本語はだいじょうぶ\end{CJK}

Japanese: \gls{squareroot}

English: \gls{dual.squareroot}

\printunsrtglossaries
\end{document}

Where the file testcjk2.bib is

@dualentry{squareroot,
  name={\cjkname{ルート}},
  description={square root}
}

The MWE comes from an answer here. The resulting document looks as shown below. The Japanese text from \begin{CJK}{UTF8}{ipxm}日本語はだいじょうぶ\end{CJK} displays fine, but that from the .bib file does not. Thanks in advance.

enter image description here

closed as off-topic by gusbrs, Bobyandbob, moewe, Andrew Swann, TeXnician Apr 30 '18 at 6:53

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • @gusbrs It's a good guess, I also had the same idea, but it appears not to change anything. – James Apr 26 '18 at 0:09
  • James, yes, I tried it here without it, and I can't reproduce the issue (it works as expected here). Sorry I deleted the original comment, leaving yours hanging, but it was a bad guess. Anyway, I'm using TeXLive, so if you are assuming there might be a difference with MikTeX, it may well be. So I can't really be of much help. – gusbrs Apr 26 '18 at 0:16
  • Indeed, CJKuft8 does already load [uft8]{inputenc}. – gusbrs Apr 26 '18 at 0:21
  • Try adding % Encoding: UTF-8 at the start of the .bib file. – Nicola Talbot Apr 26 '18 at 10:19
  • 4
    I'm voting to close this question as off-topic because the issue was solved by an update of MikTeX. – gusbrs Apr 30 '18 at 2:15

Browse other questions tagged or ask your own question.