2

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?

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

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.

  • The documentclass is "scrreprt" but this works! Thanks ;) – Jim Raynor Jul 27 '16 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.