Skip to content

Commit d7c502f

Browse files
committed
wip
1 parent 877806a commit d7c502f

File tree

5 files changed

+317
-29
lines changed

5 files changed

+317
-29
lines changed

TeXmacs/packages/standard/std-automatic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484

8585
<assign|bibitem-width|3em>
8686

87-
<assign|transform-bibitem|<macro|body|<strong|[<arg|body>] \ >>>
87+
<assign|transform-bibitem|<macro|body|[<arg|body>] \ >>
8888

8989
<assign|render-bibitem|<macro|text|<style-with|src-compact|none|<with|par-first|<minus|1tmpt|<value|bibitem-width>>|<yes-indent>><resize|<arg|text>|||<maximum|1r|<value|bibitem-width>>|>>>>
9090

TeXmacs/plugins/latex/progs/bibtex/gbt7714-2015-author-year.scm

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,31 @@
8484
(if has-author
8585
(let* ((n (length field-list))
8686
(author-count (- n 1))
87-
;; 参考文献表阈值:像plainnat一样显示前4位作者
88-
(max-authors 4)
87+
;; 参考文献表阈值:GB/T 7714-2015规定:≤3人全部列出,≥4人写"前3人+等"
88+
(max-authors 3)
8989
(show-count (min author-count max-authors))
90-
(has-more (> author-count max-authors)))
90+
(has-more (> author-count max-authors))
91+
;; 分隔符:中文不加空格,英文加空格
92+
(separator (if chinese? "," ", ")))
9193
(cond
92-
((equal? author-count 1)
94+
((= author-count 1)
9395
(let ((author-name (bib-format-name (list-ref field-list 1))))
9496
(gbt-add-suffix author-name field-type chinese? 1)))
9597
(else
9698
(let* ((first (bib-format-name (list-ref field-list 1)))
97-
;; 收集中间作者:从第2位到第show-count-1位
98-
(middle-count (- show-count 1))
99-
(middle (if (<= middle-count 0)
100-
""
101-
(let loop ((i 2) (count 0) (result ""))
102-
(if (or (>= i n) (>= count middle-count))
103-
result
104-
(loop (+ i 1) (+ count 1)
105-
(if (equal? result "")
106-
(bib-format-name (list-ref field-list i))
107-
`(concat ,result ", " ,(bib-format-name (list-ref field-list i)))))))))
99+
;; 收集中间作者
100+
;; 如果有更多作者(>3):收集第2到第3个作者(共2个中间作者)
101+
;; 如果没有更多作者(<=3):收集第2到第author-count-1个作者
102+
(middle (let loop ((i 2) (result ""))
103+
(if (or (>= i n)
104+
(if has-more
105+
(> i max-authors)
106+
(>= i author-count)))
107+
result
108+
(loop (+ i 1)
109+
(if (equal? result "")
110+
(bib-format-name (list-ref field-list i))
111+
`(concat ,result ,separator ,(bib-format-name (list-ref field-list i))))))))
108112
(last-part (if has-more
109113
(if chinese? "<#7b49>" "et al") ;;等
110114
(if (>= author-count 2)
@@ -113,9 +117,9 @@
113117
;; 构建作者字符串
114118
(author-str (cond
115119
((and (equal? middle "") (equal? last-part "")) first)
116-
((equal? middle "") `(concat ,first ", " ,last-part))
117-
((equal? last-part "") `(concat ,first ", " ,middle))
118-
(else `(concat ,first ", " ,middle ", " ,last-part)))))
120+
((equal? middle "") `(concat ,first ,separator ,last-part))
121+
((equal? last-part "") `(concat ,first ,separator ,middle))
122+
(else `(concat ,first ,separator ,middle ,separator ,last-part)))))
119123
(gbt-add-suffix author-str field-type chinese? author-count)))))
120124
"")))
121125

@@ -130,23 +134,33 @@
130134
(if has-author
131135
(let* ((n (length field-list))
132136
(author-count (- n 1)))
137+
;; 辅助函数:提取作者姓氏(英文)或完整姓名(中文)
138+
(define (get-author-display i)
139+
(let ((author (list-ref field-list i)))
140+
(if chinese?
141+
(bib-format-name author) ;; 中文:完整姓名
142+
;; 英文:只提取姓氏,不大写
143+
(let ((last-name-raw (list-ref author 3)))
144+
(if (bib-null? last-name-raw)
145+
""
146+
(bib-purify last-name-raw))))))
133147
(cond
134-
;; 作者数 ≥ 3:显示第一位 + et al
148+
;; 作者数 ≥ 3:显示第一位 + et al/等
135149
((>= author-count 3)
136-
(let ((first (bib-format-name (list-ref field-list 1))))
150+
(let ((first (get-author-display 1)))
137151
(if chinese?
138152
(gbt-add-suffix `(concat ,first "<#7b49>") field-type chinese? author-count)
139-
(gbt-add-suffix `(concat ,first ", et al") field-type chinese? author-count))))
153+
(gbt-add-suffix `(concat ,first " et al.") field-type chinese? author-count))))
140154
;; 作者数 = 2:显示两位,用"and"或"和"连接
141155
((= author-count 2)
142-
(let ((first (bib-format-name (list-ref field-list 1)))
143-
(second (bib-format-name (list-ref field-list 2))))
156+
(let ((first (get-author-display 1))
157+
(second (get-author-display 2)))
144158
(if chinese?
145159
(gbt-add-suffix `(concat ,first "<#548C>" ,second) field-type chinese? author-count)
146160
(gbt-add-suffix `(concat ,first " and " ,second) field-type chinese? author-count))))
147161
;; 作者数 = 1:显示一位
148162
((= author-count 1)
149-
(gbt-add-suffix (bib-format-name (list-ref field-list 1)) field-type chinese? author-count))
163+
(gbt-add-suffix (get-author-display 1) field-type chinese? author-count))
150164
;; 其他情况(应该不会发生)
151165
(else "")))
152166
"")))

TeXmacs/tests/tmu/204_25.bib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ @newspaper{bib-format-newspaper
172172
author = {王姝},
173173
title = {“双减”后首批中考学生迎考: 命题难度降低, 分流力度不变},
174174
journal = {新京报},
175+
year = {2023},
175176
date = {2023-06-21},
176177
pages = {A06},
177178
url = {https://www.bjnews.com.cn/detail/1687312345167891.html},
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
<TMU|<tuple|1.1.0|2026.1.1>>
2+
3+
<style|<tuple|generic|chinese|table-captions-above|number-europe|preview-ref|cite-author-year>>
4+
5+
<\body>
6+
<cite|bib-format-article> <citep|bib-format-article>
7+
8+
<cite|bib-format-book>
9+
10+
<cite|bib-format-inproceedings> <citep|bib-format-inproceedings>
11+
12+
<cite|bib-format-proceedings> <citep|bib-format-proceedings>
13+
14+
<cite|bib-format-manual>
15+
16+
<cite|bib-format-misc>
17+
18+
<cite|bib-format-phdthesis>
19+
20+
<cite|bib-format-mastersthesis>
21+
22+
<cite|bib-format-techreport>
23+
24+
<cite|bib-format-patent>
25+
26+
<cite|bib-format-electronic>
27+
28+
<cite|bib-format-standard>
29+
30+
<cite|bib-format-database>
31+
32+
<cite|bib-format-online>
33+
34+
<cite|bib-format-newspaper>
35+
36+
<cite|bib-format-collection>
37+
38+
<cite|bib-format-software>
39+
40+
<cite|bib-format-program>
41+
42+
<cite|bib-format-archive>
43+
44+
<cite|bib-format-map>
45+
46+
<cite|bib-format-dataset>
47+
48+
<cite|bib-format-other> <citep|bib-format-other>
49+
50+
<cite|bib-format-inbook>
51+
52+
<cite|bib-format-incollection>
53+
54+
<\bibliography|bib|tm-gbt7714-2015-author-year|204_25>
55+
<\bib-list|24>
56+
<bibitem*|<natbib-triple|中华人民共和国教育部|中华人民共和国教育部|2022>><label|bib-bib-format-electronic>教育部关于印发《研究生教育学科专业目录(2022年)》的通知[EB/OL]. <newblock>Http://www.moe.gov.cn/srcsite/A22/moe_833/202209/t20220913_660658.html.<newblock>
57+
58+
<bibitem*|<natbib-triple|中国载人航天工程办公室|中国载人航天工程办公室|2022>><label|bib-bib-format-misc>中国空间站科学实验资源手册[Z/OL]. <newblock>Http://www.cmse.gov.cn/kxzy/kxzyzy/202207/P020220704356248569283.pdf.<newblock>
59+
60+
<bibitem*|<natbib-triple|刘思雨|刘思雨|2022>><label|bib-bib-format-mastersthesis>基于深度学习的肺结节检测算法研究[D/OL]. <newblock>上海: 上海交通大学. <newblock>Https://dspace.sjtu.edu.cn/handle/12699/12345.<newblock>
61+
62+
<bibitem*|<natbib-triple|华为技术有限公司|华为技术有限公司|2024>><label|bib-bib-format-manual>华为云会议 用户使用手册: 第3.2版[M/OL]. <newblock>深圳. <newblock>Https://support.huaweicloud.com/usermanual-meeting/.<newblock>
63+
64+
<bibitem*|<natbib-triple|南京市档案馆|南京市档案馆|1969>><label|bib-bib-format-archive>南京长江大桥建设档案[A/OL]. <newblock>南京: 南京市档案馆. <newblock>Http://www.njdaj.gov.cn/daanc/J007-001-123.<newblock>
65+
66+
<bibitem*|<natbib-triple|国家互联网信息办公室|国家互联网信息办公室|2023>><label|bib-bib-format-online>《生成式人工智能服务管理办法(征求意见稿)》公开征求意见[EB/OL]. <newblock>Http://www.cac.gov.cn/2023-04/11/c_1683617348175741.htm.<newblock>
67+
68+
<bibitem*|<natbib-triple|国家基础地理信息中心|国家基础地理信息中心|2021>><label|bib-bib-format-map>中国1∶100万数字地貌图[CM/OL]. <newblock>第3版. <newblock>北京. <newblock>Https://doi.org/10.12345/CM202103.<newblock>
69+
70+
<bibitem*|<natbib-triple|国家市场监督管理总局,国家标准化管理委员会|国家市场监督管理总局和国家标准化管理委员会|2023>><label|bib-bib-format-standard>信息技术 人工智能 伦理审查指南: GB/T 43264-2023[S/OL]. <newblock>北京: 中国标准出版社. <newblock>Https://openstd.samr.gov.cn/bzgk/gb/newGbInfo?hcno=8D8A8E8F8A8B8C8D8E8F.<newblock>
71+
72+
<bibitem*|<natbib-triple|张凯,王磊|张凯和王磊|2023>><label|bib-bib-format-techreport>城市快速路交通流状态判别与预测技术报告[R/OL]. <newblock>北京: 交通运输部公路科学研究院. <newblock>Https://www.rioh.cn/uploads/tech/2023ITSC.pdf.<newblock>
73+
74+
<bibitem*|<natbib-triple|李建军,王雪|李建军和王雪|2022>><label|bib-bib-format-patent>一种面向自动驾驶的多模态融合感知系统: CN114123456A[P/OL]. <newblock>Https://pss-system.cponline.cnipa.gov.cn/documents/detail/CN114123456A.<newblock>
75+
76+
<bibitem*|<natbib-triple|李清泉,张远|李清泉和张远|2023>><label|bib-bib-format-book>人工智能导论[M/OL]. <newblock>第3版. <newblock>北京: 电子工业出版社. <newblock>Https://doi.org/10.1002/9781119123456.<newblock>
77+
78+
<bibitem*|<natbib-triple|王姝|王姝|2023>><label|bib-bib-format-newspaper>“双减”后首批中考学生迎考: 命题难度降低, 分流力度不变[N/OL]. <newblock>新京报, (A06). <newblock>Https://www.bjnews.com.cn/detail/1687312345167891.html.<newblock>
79+
80+
<bibitem*|<natbib-triple|王重|王重|2020>><label|bib-bib-format-inbook>南京长江大桥结构设计[M]//铁道部大桥工程局. 南京长江大桥技术总结: 第2版. <newblock>北京: 人民交通出版社.<newblock>
81+
82+
<bibitem*|<natbib-triple|王青,张志学,张立峰|王青等|2024>><label|bib-bib-format-article>基于深度学习的肺癌病理图像分类方法[J/OL]. <newblock>中国医学影像技术, 40(1): 52-58. <newblock>Https://doi.org/10.13929/j.issn.1003-3289.2024.01.012.<newblock>
83+
84+
<bibitem*|<natbib-triple|赵一,钱二,孙三,等|赵一等|2020>><label|bib-bib-format-other>内部工作手册[Z]. <newblock>北京: 内部发行.<newblock>
85+
86+
<bibitem*|<natbib-triple|赵军|赵军|2020>><label|bib-bib-format-incollection>长江岸线资源评价方法[G]//刘昌明,杨桂山. 长江岸线资源调查与评估. <newblock>北京: 科学出版社.<newblock>
87+
88+
<bibitem*|<natbib-triple|陈聪|陈聪|2023>><label|bib-bib-format-phdthesis>面向自动驾驶的鲁棒感知关键技术研究[D/OL]. <newblock>北京: 清华大学. <newblock>Https://doi.org/10.5000/THU2023PC001.<newblock>
89+
90+
<bibitem*|<natbib-triple|Apache Software Foundation|Apache Software Foundation|2023>><label|bib-bib-format-software>Apache Kafka[CP/OL]. <newblock>Version 3.5.0. <newblock>Https://downloads.apache.org/kafka/3.5.0/kafka-3.5.0-src.tgz.<newblock>
91+
92+
<bibitem*|<natbib-triple|Apache Software Foundation|Apache Software Foundation|2023>><label|bib-bib-format-program>Apache Kafka[CP/OL]. <newblock>Version 3.5.0. <newblock>Https://downloads.apache.org/kafka/3.5.0/kafka-3.5.0-src.tgz.<newblock>
93+
94+
<bibitem*|<natbib-triple|周济,谢友柏|周济和谢友柏|2022>><label|bib-bib-format-collection>中国机械工程学会年会论文集[G/OL]. <newblock>上海: 上海交通大学出版社. <newblock>Https://doi.org/10.5000/CME2022G001.<newblock>
95+
96+
<bibitem*|<natbib-triple|DIGNUM F, OMICINI A, TUYLS K|Dignum et al.|2024>><label|bib-bib-format-proceedings>Proceedings of the 23rd International Conference on Autonomous Agents and Multiagent Systems[C/OL]. <newblock>Auckland, New Zealand: International Foundation for Autonomous Agents and Multiagent Systems. <newblock>Https://doi.org/10.5555/3635637.<newblock>
97+
98+
<bibitem*|<natbib-triple|HE K, GKIOXARI G, DOLLáR P, et al|He et al.|2017>><label|bib-bib-format-dataset>COCO 2017 Dataset[DS/OL]. <newblock>Https://doi.org/10.5281/zenodo.3243629.<newblock>
99+
100+
<bibitem*|<natbib-triple|Kaggle|Kaggle|2020>><label|bib-bib-format-database>COVID-19 Open Research Dataset Challenge (CORD-19)[DB/OL]. <newblock>Https://www.kaggle.com/datasets/allen-institute/CORD-19-research-challenge.<newblock>
101+
102+
<bibitem*|<natbib-triple|LI Y S, HAN S|Li and Han|2024>><label|bib-bib-format-inproceedings>Efficient collaboration with unknown agents: Ignoring similar agents without checking similarity[C/OL]//Proceedings of the 23rd International Conference on Autonomous Agents and Multiagent Systems (AAMAS 2024). <newblock>Auckland, New Zealand: International Foundation for Autonomous Agents and Multiagent Systems. <newblock>Https://doi.org/10.5555/3635637.3663161.<newblock>
103+
</bib-list>
104+
</bibliography>
105+
</body>
106+
107+
<\initial>
108+
<\collection>
109+
<associate|page-medium|papyrus>
110+
<associate|page-screen-margin|false>
111+
</collection>
112+
</initial>
113+
114+
<\references>
115+
<\collection>
116+
<associate|auto-1|<tuple|?|1>>
117+
<associate|bib-bib-format-archive|<tuple|南京市档案馆 (1969)南京市档案馆|1>>
118+
<associate|bib-bib-format-article|<tuple|王青等 (2024)王青,张志学,张立峰|2>>
119+
<associate|bib-bib-format-book|<tuple|李清泉和张远 (2023)李清泉,张远|2>>
120+
<associate|bib-bib-format-collection|<tuple|周济和谢友柏 (2022)周济,谢友柏|2>>
121+
<associate|bib-bib-format-database|<tuple|Kaggle (2020)Kaggle|2>>
122+
<associate|bib-bib-format-dataset|<tuple|He et al. (2017)HE K, GKIOXARI G, DOLLáR P, et al|2>>
123+
<associate|bib-bib-format-electronic|<tuple|中华人民共和国教育部 (2022)中华人民共和国教育部|1>>
124+
<associate|bib-bib-format-inbook|<tuple|王重 (2020)王重|2>>
125+
<associate|bib-bib-format-incollection|<tuple|赵军 (2020)赵军|2>>
126+
<associate|bib-bib-format-inproceedings|<tuple|Li and Han (2024)LI Y S, HAN S|2>>
127+
<associate|bib-bib-format-manual|<tuple|华为技术有限公司 (2024)华为技术有限公司|1>>
128+
<associate|bib-bib-format-map|<tuple|国家基础地理信息中心 (2021)国家基础地理信息中心|1>>
129+
<associate|bib-bib-format-mastersthesis|<tuple|刘思雨 (2022)刘思雨|1>>
130+
<associate|bib-bib-format-misc|<tuple|中国载人航天工程办公室 (2022)中国载人航天工程办公室|1>>
131+
<associate|bib-bib-format-newspaper|<tuple|王姝 (2023)王姝|2>>
132+
<associate|bib-bib-format-online|<tuple|国家互联网信息办公室 (2023)国家互联网信息办公室|1>>
133+
<associate|bib-bib-format-other|<tuple|赵一等 (2020)赵一,钱二,孙三,等|2>>
134+
<associate|bib-bib-format-patent|<tuple|李建军和王雪 (2022)李建军,王雪|2>>
135+
<associate|bib-bib-format-phdthesis|<tuple|陈聪 (2023)陈聪|2>>
136+
<associate|bib-bib-format-proceedings|<tuple|Dignum et al. (2024)DIGNUM F, OMICINI A, TUYLS K|2>>
137+
<associate|bib-bib-format-program|<tuple|Apache Software Foundation (2023)Apache Software Foundation|2>>
138+
<associate|bib-bib-format-software|<tuple|Apache Software Foundation (2023)Apache Software Foundation|2>>
139+
<associate|bib-bib-format-standard|<tuple|国家市场监督管理总局和国家标准化管理委员会 (2023)国家市场监督管理总局,国家标准化管理委员会|1>>
140+
<associate|bib-bib-format-techreport|<tuple|张凯和王磊 (2023)张凯,王磊|2>>
141+
</collection>
142+
</references>
143+
144+
<\auxiliary>
145+
<\collection>
146+
<\associate|bib>
147+
bib-format-article
148+
149+
bib-format-article
150+
151+
bib-format-article
152+
153+
bib-format-article
154+
155+
bib-format-book
156+
157+
bib-format-book
158+
159+
bib-format-inproceedings
160+
161+
bib-format-inproceedings
162+
163+
bib-format-inproceedings
164+
165+
bib-format-inproceedings
166+
167+
bib-format-proceedings
168+
169+
bib-format-proceedings
170+
171+
bib-format-proceedings
172+
173+
bib-format-proceedings
174+
175+
bib-format-manual
176+
177+
bib-format-manual
178+
179+
bib-format-misc
180+
181+
bib-format-misc
182+
183+
bib-format-phdthesis
184+
185+
bib-format-phdthesis
186+
187+
bib-format-mastersthesis
188+
189+
bib-format-mastersthesis
190+
191+
bib-format-techreport
192+
193+
bib-format-techreport
194+
195+
bib-format-patent
196+
197+
bib-format-patent
198+
199+
bib-format-electronic
200+
201+
bib-format-electronic
202+
203+
bib-format-standard
204+
205+
bib-format-standard
206+
207+
bib-format-database
208+
209+
bib-format-database
210+
211+
bib-format-online
212+
213+
bib-format-online
214+
215+
bib-format-newspaper
216+
217+
bib-format-newspaper
218+
219+
bib-format-collection
220+
221+
bib-format-collection
222+
223+
bib-format-software
224+
225+
bib-format-software
226+
227+
bib-format-program
228+
229+
bib-format-program
230+
231+
bib-format-archive
232+
233+
bib-format-archive
234+
235+
bib-format-map
236+
237+
bib-format-map
238+
239+
bib-format-dataset
240+
241+
bib-format-dataset
242+
243+
bib-format-other
244+
245+
bib-format-other
246+
247+
bib-format-other
248+
249+
bib-format-other
250+
251+
bib-format-inbook
252+
253+
bib-format-inbook
254+
255+
bib-format-incollection
256+
257+
bib-format-incollection
258+
</associate>
259+
<\associate|toc>
260+
<vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|参考文献><datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.05fn>.<space|0.05fn>>>>>|<htab|5mm>><no-break><pageref|auto-1><vspace|0.5fn>
261+
</associate>
262+
</collection>
263+
</auxiliary>

0 commit comments

Comments
 (0)