-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
Hi, @yihui
I want to replace number in 'Chapter 1' with Chinese decimal number(一、二、三)[Chapter 1 -> 第一章], I have written a function as follow:
function(i) paste('第',c('一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三','二十四','二十五')[i],'章',sep='')
It worked correctly in console:
y <- function(i) paste('第',c('一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三','二十四','二十五')[i],'章',sep='')
y(25)
[1] "第二十五章"
But when I add it to _bookdown.yaml:
....
chapter_name: !expr function(i) paste('第',c('一','二','三','四','五','六','七','八','九','十','十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三','二十四','二十五')[i],'章',sep='')
...
After it built, the result is '第NA章'.
想锻炼一下写英文,尝试着用英语描述问题,见谅!
我想用’第一章'代替'Chapter 1‘,我该怎么做才能达到目的?我的上述方法为何达不到目的,有何问题?请赐教!感谢。
Metadata
Metadata
Assignees
Labels
No labels