Skip to content

修复问题 #15 #47

Closed
chouheiwa wants to merge 1 commit intoNewFuture:masterfrom
chouheiwa:master
Closed

修复问题 #15 #47
chouheiwa wants to merge 1 commit intoNewFuture:masterfrom
chouheiwa:master

Conversation

@chouheiwa
Copy link

#15 该问题的核心原因是在新版编译器中hyperref包不能使用\let 命令了,而CJK命令中的\CJKnumber又使用了\let

该问题的临时修复方案,是定义一个新的函数来处理。但是目前我只做到支持到10,再大的情况就不支持了(因为我没用到超过十)。

@NewFuture
Copy link
Owner

这个是GPT提供的实现,参考一下,好使吗?

\documentclass{article}

% 定义中文数字
\def\CJKnumber#1{\CJKnumhelper#1!}
\def\CJKnumhelper#1{%
  \ifx#1!\else
    \ifcase#1 \or\or\or\or\or\or\or\or\or\fi
    \expandafter\CJKnumhelper
  \fi
}

% 定义数位
\def\CJKdigits#1{%
  \ifnum#1>999 \CJKnumber{\the\numexpr #1/1000} 千 \fi
  \ifnum#1>99 \CJKnumber{\the\numexpr (#1/100) mod 10} 百 \fi
  \ifnum#1>9 \CJKnumber{\the\numexpr (#1/10) mod 10} 十 \fi
  \CJKnumber{\the\numexpr #1 mod 10}%
}

\begin{document}

阿拉伯数字 2024 转换为中文:\CJKdigits{2024}

\end{document}

@NewFuture
Copy link
Owner

#54 似乎解决了,谢谢♥

@NewFuture NewFuture closed this Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants