关于日期格式的宏定义

发布于 2021-05-20 23:04:24

基于ustcthesis的cls进行了修改

因为论文中需要的日期格式为 yyyy年m月,比如2021年5月2021年10月
以下为修改后的宏命令

\newcommand\hfut@format@date[2]{%
  \edef\hfut@@date{#2}%
  \def\hfut@@process@date##1-##2\@nil{%
    #1{##1}{##2}%
  }%
  \expandafter\hfut@@process@date\hfut@@date\@nil
}
\newcommand\hfut@date@format@zh[2]{#1年#2月}
\newcommand\hfut@date@month[1]{%
  \ifcase\number#1\or
    January\or February\or March\or April\or May\or June\or
    July\or August\or September\or October\or November\or December%
  \fi
}
\newcommand\hfut@date@format@en[2]{\hfut@date@month{#2}, #1}
\newcommand\hfut@date@zh{\hfut@format@date{\hfut@date@format@zh}{\hfut@date}}
\newcommand\hfut@date@en{\hfut@format@date{\hfut@date@format@en}{\hfut@date}}

现在

  • \hfut@date@zh2021年05月
  • \hfut@date@enMay, 2021

英文没问题。主要我想把 中文下的05月改为5月,请问大佬如何修改呢?

查看更多

关注者
0
被浏览
1.1k
zepinglee
zepinglee 2021-05-21
这家伙很懒,什么也没写!

1 年 number#2 月

2 个回答
 個亼滴兲箜
個亼滴兲箜 2021-05-20
这家伙很懒,什么也没写!

额直接用 \the\year 年 \the\month 月 不香么

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览