0

When using the Unicode double quotes “ and ” in an English text when the package xeCJK is loaded, the behavior of punctuation changes everywhere (and not only in a CJK context), for example double quotes become fullwidth and that means there is way too much space when in a Latin alphabet context.

Compare the result of the following two lines, where the first one uses Unicode double quotes and the second TeX ligatures `` and ''

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xeCJK}
\begin{document}
(“This is a quoted sentence.”)

(``This is a quoted sentence.'') \end{document}

enter image description here

To avoid this I found a rather radical solution: I change the code of the xeCJK.sty file by redefining \c__xeCJK_CL_chars_clist and \c__xeCJK_OP_chars_clist:

\clist_const:Nn \c__xeCJK_CL_chars_clist
  {
    "2E3A ,
    "3001 , "3002 , "3009 , "300B , "300D , "300F , "3011 , "3015 , "3017 , "3019 ,
    "301B , "301E , "301F , "FE11 , "FE12 , "FE18 , "FE36 , "FE38 , "FE3A , "FE3C ,
    "FE3E , "FE40 , "FE42 , "FE44 , "FE48 , "FE50 , "FE52 , "FE5A , "FE5C , "FE5E ,
    "FF09 , "FF0C , "FF0E , "FF3D , "FF5D , "FF60 , "FF61 , "FF63 , "FF64
  }
\clist_const:Nn \c__xeCJK_OP_chars_clist
  {
    "3008 , "300A , "300C , "300E , "3010 , "3014 , "3016 , "3018 , "301A , "301D ,
    "FE17 , "FE35 , "FE37 , "FE39 , "FE3B , "FE3D , "FE3F , "FE41 , "FE43 , "FE47 ,
    "FE59 , "FE5B , "FE5D , "FF08 , "FF3B , "FF5B , "FF5F , "FF62
  }

But of course changing the code of a package that can be updated at any moment is definitely not a good idea, not to mention the fact that my CJK text now has no fullwidth doubles quotes any more.

So I was wondering whether there is a more elegant way to activate and de-activate fullwidth double-quotes without changing the code of xeCJK.sty.

yannis
  • 2,013
  • 19
  • 18

1 Answers1

1

Something like this perhaps

\documentclass{article}

\usepackage{xeCJK} \usepackage{newunicodechar} \newunicodechar{“}{% \iftrue % if latin script not sure best xecjk test ``% \else \string“% \fi} \newunicodechar{”}{% \iftrue % if latin script not sure best xecjk test ''% \else \string”% \fi}

\begin{document}

(“This is a quoted sentence.”)

(``This is a quoted sentence.'') \end{document}

David Carlisle
  • 757,742
  • Thank you David, it works (I was hoping for some single command from the xecjk package but this does the work just fine). Just a short question: what is \iftrue testing? I'm confused… – yannis Aug 01 '20 at 16:46
  • @yannis currently it is not testing anything so you will always get latin script quotes, if I knew anything at all about the xecjk packages it would be a test to say if latin of CJK scripts were being used at that point. – David Carlisle Aug 01 '20 at 16:48
  • OK, it seemed weird… So this is a solution when in a non-CJK environment but not a solution for having appropriate double quotes in CJK. But then again, there are special CJK quotes 〈 〉 《 》 「 」 『 』 why should anyone use the Latin script ones in the first place?… – yannis Aug 01 '20 at 16:53
  • @yannis I have no idea but presumably the package authors had something in mind when they made these be the full width versions. Perhaps you will get a better answer from someone who understands these things – David Carlisle Aug 01 '20 at 16:56
  • Related: https://tex.stackexchange.com/questions/43583/linebreak-and-enquote . \textquotedblleft and \textquotedblright are available, and also: "You can use \makexeCJKactive and \makexeCJKinactive to turn on and off xeCJK if you wish." – Cicada Aug 02 '20 at 05:28