0

After the questionhttps://tex.stackexchange.com/questions/550268/typewriter-font-for-korean-language/550277#550277 has been solved I'm running in the next problem, I want to have the words like Chapter from the \chapter command automatically translated.

MWE:

\documentclass{book}
\tracinglostchars=2
\usepackage{polyglossia}
\setdefaultlanguage{korean}
\usepackage{xeCJK}

\setCJKmainfont{Noto Sans CJK SC}
\setCJKmonofont{Noto Sans CJK SC}
%\newfontfamily\hangulfont{Noto Sans CJK SC}                                                                                        
\begin{document}

\chapter{ 다음에 의해 생성됨}
\obeylines
00027         printf({"{}JUST A PRINT STATEMENT\(\backslash\)n"{}});
00027         printf({"{}Just a print statement\(\backslash\)n"{}});
00028         printf({"large 다음에 의해 생성됨 Doxygen 1.8.19\(\backslash\)n"{}});
\begin{verbatim}
00027         printf({"{}A PRINT STATEMENT TEXT"{}});                                                                               00027         printf({"{}a print statement text"{}});                                                                               00028         printf({" 다음에 의해 생성됨 1.8.19"{}});                                                                             \end{verbatim}
\end{document}    

But this gives the error:

! Package polyglossia Error: The current latin font  does not contain the "Hang
ul" script!
(polyglossia)                Please define \hangulfont with \newfontfamily comm
and.

See the polyglossia package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.11 \begin{document}

so uncommenting the line:

%\newfontfamily\hangulfont{Noto Sans CJK SC}

but this leads to:

! Package polyglossia Error: The current latin font NotoSansCJKSC(1) does not c
ontain the "Hangul" script!
(polyglossia)                Please define \hangulfont with \newfontfamily comm
and.

See the polyglossia package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.18 \begin{verbatim}
3
  • Combining xeCJK and polyglossia is not really recommended (or at least it wasn't in 2011, see the answers to tex.stackexchange.com/questions/36878/…) because they both try to do the same thing (allow writing in different scripts) and by doing so they interfere which eachother.
    – Marijn
    Jun 20, 2020 at 13:22
  • The problem with the xeCJK is that it does not translate the Chapter text. So would you recommend to remove the xeCJK / \newfont... and \setCJK ? and replace with just \setmainfont and \setmonofont
    – albert
    Jun 20, 2020 at 13:27
  • 2
    Basically there are two choices: either use xeCJK, define the chapter name manually (\renewcommand{\chaptername} etc.) and don't use polyglossia, or don't use xeCJK and use polyglossia instead. From these two options polyglossia is a bit more feature-complete, besides the names for chapters, figures, tables etc. there are also hyphenation rules and other formatting conventions implemented that xeCJK doesn't have.
    – Marijn
    Jun 20, 2020 at 13:38

1 Answer 1

0

Besides defining

\newfontfamily\hangulfont{Noto Sans CJK SC}

it seems that it is also necessary to define:

\newfontfamily\hangulfonttt{Noto Sans CJK SC}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .