Closed
Conversation
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}
|
Owner
|
#54 似乎解决了,谢谢♥ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#15 该问题的核心原因是在新版编译器中hyperref包不能使用
\let命令了,而CJK命令中的\CJKnumber又使用了\let。该问题的临时修复方案,是定义一个新的函数来处理。但是目前我只做到支持到10,再大的情况就不支持了(因为我没用到超过十)。