El estilo del entorno palabra por palabra autodefinido cambió después de usar xeCJK.

El estilo del entorno palabra por palabra autodefinido cambió después de usar xeCJK.

Entonces, enuna pregunta previaPregunté cómo crear un entorno textual con fuente, altura y ancho específicos para componer arte ASCII japonés. Y me ayudaron con eso, ahora tengo un paquete adecuado que puedo usar para hacerlo. Se parece a esto:

\ProvidesPackage{jart}[2023/03/05 Japanese ASCII Art]
\RequirePackage{fancyvrb}
\RequirePackage{xfp}

\usepackage{fontspec}

\newfontfamily\verbatimfont[%
  NFSSFamily       = {myverbatimfont}%
]{aahub.ttf}

\fvset{fontsize=\small,xleftmargin=2em}

\newdimen\jart@num
\jart@num=16pt\relax

\newdimen\jart@px
\jart@px=16pt\relax

\DefineVerbatimEnvironment{jart}{Verbatim}{%
  fontfamily=myverbatimfont,%
  numbers=none,%
  framesep=0.5em,%
  rulecolor=white,%
  baselinestretch=\fpeval{\jart@num/\jart@px}%
}

aahub.ttfes una fuente desarrollada para realizar este tipo de composición tipográfica mediante:https://font.aahub.org/

Pero, ya sabes, está creado para componer arte japonés ASCII. Sería bueno si pudiera escribir algunos caracteres CJK en el cuerpo principal del documento.

Estoy usando XeLatex, así que simplemente agregaría \usepackage{xeCJK}al archivo. Pero el arte ASCII resultante está roto. Sin \usepackage{xeCJK}él funciona bien.

EJEMPLO:

\documentclass{article}
\usepackage{jart}
% \usepackage{xeCJK}
\begin{document}
This is a minial working example of typesetting Japanese ASCII art.


\begin{jart}
                          ______
                     ,、.- '''"´          ` ' ‐ 、,
                  ,、 ''"                    `' .、
                ,、 '"          .......................         \
              /       ..........::::::::::::::::::::::::::::::::::::::::::::::....... ...   ヽ
            /      ....:::::::::::::::;;::::::::::::::::;:::;、r'" \:::::::::::::::::.....::..   ヽ
.          /      ..::::::::::::::::::::/ `ヽ,:/ノ     \ィ'ヽ:::::::::::::::..   ヽ
.         /      ..:::::::::::::::::::;、:ィ'    `  ヽ        ヽ  \:::::::::::::..   ',
        , '      ..:::::::::::::::;、r':/,'    .....          ヽ   ヽ::::::::::..  ',
.      , '      ..::::::::::;、 '" / ,'  / ,、-ヽ          ',    ヽ::::::::.. /
      /      ..::::::::/  /  ,'  //   ヽ.   ヽ    ヽ ',     ヽ::::::::/
     /     ...::::::::/  /    ;   /       ヽ  ヽ  ヽ 丶 ',    ヽ/
    /     ..::::::::::::i゙  /     ,'  i           ヽ ヾ、  ヽ \',    ',
.   /   ....:::::::::::::::::i../    ,、 ,'   | ,.、----- 、,  ',  ',.\  ヾ' 、ヽ    ',
  /   ..:::::::::::::::::::::/   ,、 '" ,'   |´          ',  !. ‐ヽ ヽ ヾ 、   ',
 / ....::::::::::::::::::::::/  ,、 '".--、i //!. |            ', l   ヽ. ',、. ', ` 、 ',
  \::::::::::::::::::::/ ,、 '" / ,r''''''|〃  | |,.|ィ===ミ、     ', |, -ノ-、  /‐!   | \ ',
   `' 、:.:/ ,、 '" |.  │ ! /~|   l ',            lノ===ミ、 /l |    |   \
    ,、r'ィ"‐-:、;;;_|   ヽ ヽ、|    i ',\\\               { l i lヽ !
   ´       ,'     \ l    .',、'、       ,  \\\!| l  ! ' ,ヽ !
          /       ` l    ',ヽヽ               |!| ヽ .| ',.ヽ!
.         /         l     ! `ヽ  、_..-、_,   /.ハ. V  ',
         /        ,、 -',    ',‐‐―┐           / /  |   ',
       , '     ,、- '''´   ',    ',    |.        ィ ´  /    |ー-、 ',
      /      l       ',    ',  ト> ‐ <´_!   /   / / ',
    /        ',        ',    ', ├---゙ニi゙、.,,,,,{  /    / / |\ ',
  /   /      ヽ       ',    ',│ ||  ||  ||ヽ     / ト, |  ヽ ヽ
'"    /        >         ',    ',ヽ. ||  ||  ||:}      /   | l. l   ヽ '

\end{jart}

\end{document}

No xeCJK:

sin resultado xeCJK

Con xeCJK:

con xeCJK

No estoy seguro de por qué ha sucedido esto. ¿Dónde debería buscar para resolver este problema? Gracias de antemano.

Respuesta1

El arte ASCII contiene caracteres que admiten el uso de la fuente CJK. Como U+FF64 U+30FD. Si su fuente CJK no tiene estos glifos, no podrá imprimirse correctamente. Mientras tanto, xeCJKse insertarían algunos espacios entre caracteres CJK y otros. No estás dispuesto a conservarlos.

Puede desactivar la modificación realizada por xeCJK, configurando \xeCJKsetup{xeCJKactive=false}. O puedes eliminar esos espacios y cambiar la fuente CJK.

% In jart.sty, choose one of them, I prefer the first one
\newcommand{\turnoffxecjk}{\xeCJKsetup{xeCJKactive=false}}
% \newcommand{\turnoffxecjk}{\xeCJKsetup{CJKglue=,CJKecglue=,}\CJKfontspec{aahub.ttf}}
% and
\DefineVerbatimEnvironment{jart}{Verbatim}{%
  formatcom=\turnoffxecjk,%
  fontfamily=myverbatimfont,%
  numbers=none,%
  framesep=0.5em,%
  rulecolor=white,%
  baselinestretch=\fpeval{\jart@num/\jart@px}%
}

información relacionada