Skip to content

Allowing CJK characters to have catcode 13? #189

@setchin

Description

@setchin

The (u)ptex manual states that the CJK characters have kcatcode 16-18 (14-20), however, it seems impossible to assign catcode 13 (active characters) to them.

Admittedly, assigning CJK characters as active characters has very limited usage. But it may be helpful in some cases (to do some trick), for example, I notice that in a printed Japanese bunko book, the contents delimited by full-width brackets “()” always has a smaller font size. If we are able to change the character code of these brackets, we can actually write very decent code like this (though with a little bit risk):

\makeatletter
\let\old@lparen(
\let\old@rparen)
\catcode`(=\active
\catcode`)=\active
\protected\def({\begingroup\small\old@lparen}
\protected\def){\old@rparen\endgroup}
\makeatother

However, this will throw an error as stated in the manual.

While such issues always have a workaround (for example defining a user macro and apply such macro every time), I wonder:

  1. if there is any trick that could achieve similar effect?
  2. In XeLaTeX, such modification is actually feasible! What is the reason behind the design of (u)ptex to prevent catcode modification of Unicode characters?

Any help or explanation is much appreciated. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions