4

This minimal example of how to use the CJK package, as instructed here works perfectly on my system:

\documentclass{article}
\usepackage{CJK}

\begin{document}
\begin{CJK}{UTF8}{gbsn}
你好
You can mix latin letters and chinese.
\end{CJK}
\end{document}

However, as I inserted the part with \begin{CJK}{UTF8}{gbsn} and \end{CJK} with a short sentence in Chinese in between to my document, the compiler (pdflatex) complained and threw a bunch of Undefined control sequence.... errors pointing to the line right after \end{CJK}.

The document I'm working on is a slightly tweaked version of classicthesis (supported by arsclassica). Most of the content are in French, so I included some more packages (mostly to have guillmets « » and the spacing between the colon, question mark and exclamation mark to be correct.

The packages included with their options are:

\usepackage [%eulerchapternumbers,%eulermath,drafting,
listings,listsseparated,beramono,pdfspacing,%listings,
                    subfig,parts,dottedtoc]{classicthesis}
\usepackage[french]{arsclassica}
\usepackage[left=3.5cm,right=2.5cm,top=2.5cm,bottom=2cm,includefoot]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[american,french]{babel}

%For French quotation:
\usepackage[french=guillemets]{csquotes}


%For a few chinese words:
\usepackage{CJK}

\begin{document}
\raggedbottom
\selectlanguage{french}

des langues étrangères appliquées et d'effectuer le travail à l'hôtel...     
Bien que j'aie rencontré des difficultés car ce sont mes...

\begin{CJK}{UTF8}{gbsn}
文章
\end{CJK}
des langues étrangères appliquées et d'effectuer le travail à l'hôtel...

\end{document}

Error: Undefined control sequence. des langues é

Undefined control sequence. des langues étrangè

EDIT: if the whole content is only in English (i.e. no character with accent á è é à... ) then it compiles without problem. Before CJK environment starts the compiling is all find, but right after the CJK environment ends, the compiler starts to complain about the French characters with accent:

(in my "complete" version, it did not even export the output -- perhaps it stopped after too many errors) enter image description here

So I guess the reason is behind the documentclass which classicthesis is based on, or some other settings with the font etc., but I don't know to to fix this. How do I change the options of the included packages or change the .sty files to include a Chinese sentence between the French content?

3
  • 2
    Why do you expect from us to extend your snippets to something we can try? Make a complete example that demonstrates the error. Commented Jul 26, 2016 at 11:46
  • @UlrikeFischer edited with example :)
    – Jim Raynor
    Commented Jul 26, 2016 at 12:15
  • This doesn't compile, a \documentclass command is missing. Commented Jul 26, 2016 at 12:22

1 Answer 1

4

The error can be easily reproduce in a simple example:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%For a few chinese words:
\usepackage{CJK}

\begin{document}

des langues étrangères 


\begin{CJK}{UTF8}{gbsn}
文章
\end{CJK}

des langues étrangères 

\end{document}

The solution is to use either

\usepackage[encapsulated]{CJK}

or the newer

\usepackage{CJKutf8}

instead of CJK.

2
  • The documentclass is "scrreprt" but this works! Thanks ;)
    – Jim Raynor
    Commented Jul 27, 2016 at 16:57
  • Adding "encapsulated" does not work, still having Undefined control sequence errors after the end tag
    – Raptor
    Commented Jan 3 at 2:49

You must log in to answer this question.

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