![estilo de ambiente literal autodefinido alterado após o uso de xeCJK](https://rvso.com/image/461923/estilo%20de%20ambiente%20literal%20autodefinido%20alterado%20ap%C3%B3s%20o%20uso%20de%20xeCJK.png)
Então, emuma pergunta anteriorPerguntei como criar um ambiente literal com fonte, altura e largura especificadas para compor arte ASCII japonesa. E eles me ajudaram com isso, agora tenho um pacote adequado que posso usar para fazer isso. Se parece com isso:
\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.ttf
é uma fonte desenvolvida para fazer esse tipo de composição:https://font.aahub.org/
Mas, você sabe, ele foi criado para compor arte ASCII japonesa. Seria bom se eu pudesse digitar alguns caracteres CJK no corpo principal do documento.
Estou usando XeLatex
, então gostaria apenas de adicionar \usepackage{xeCJK}
ao arquivo. Mas a arte ASCII resultante está quebrada. Sem \usepackage{xeCJK}
isso funciona bem.
EXEMPLO:
\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}
Não xeCJK
:
Com xeCJK
:
Não sei por que isso aconteceu. Onde devo procurar para resolver esse problema? Obrigado em avançado.
Responder1
A arte ASCII contém caracteres compatíveis com o uso da fonte CJK. Como U+FF64
U+30FD
. Se a sua fonte CJK não tiver esses glifos, ela não poderá ser impressa corretamente. Entretanto, xeCJK
inseriria alguns espaços entre caracteres CJK e outros. Você não está disposto a mantê-los.
Você pode desativar a modificação feita xeCJK
por definindo \xeCJKsetup{xeCJKactive=false}
. Ou você pode remover esses espaços e alterar a fonte 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}%
}