Skip to content

Commit

Permalink
update-20210401-remove space after citation in chinese line and corre…
Browse files Browse the repository at this point in the history
…ct the translator output of languages other than Chinese
  • Loading branch information
hushidong committed Apr 1, 2021
1 parent d36e9c2 commit 20b5a48
Show file tree
Hide file tree
Showing 18 changed files with 298 additions and 49 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ biblatex-gb7714-2015 宏包是中文参考文献著录/标注标准 `GB/T 7714-2
* [nwafuthesis(西北农林科技大学学位论文LaTeX文档类)](https://github.com/registor/nwafuthesis)
* [shtthesis (ShangHaiTech university THESIS)](https://github.com/lirundong/shtthesis)
* [SHMTUThesis(上海海事大学 LaTeX 学位论文模板)](https://github.com/hellckt/SHMTUThesis)
* [SJTUThesis(上海交通大学学位论文模板)](https://github.com/sjtug/SJTUThesis) (母校的论文模板,不得不说缘分真的很神奇,16年一出来就直接用上)
* [SJTUThesis(上海交通大学学位论文模板)](https://github.com/sjtug/SJTUThesis) (母校的论文模板,不得不说缘分真的很神奇,16年一出来就用上)
* [sustechthesis(Southern University of Science and Technology Thesis Template LaTeX Template)](https://github.com/Iydon/sustechthesis)
* [SwufeTeX(西南财经大学学位论文LaTeX模板)](https://github.com/OopsYao/swufethesis)
* [Thesis-Template-for-XJTU (西安交大毕业设计模板)](https://github.com/DXie123/Thesis-Template-for-XJTU)
* [ThuThesis(LaTeX Thesis Template for Tsinghua University )](https://github.com/tuna/thuthesis)
* [TongjiThesis(同济大学硕博士论文LaTeX模板)](https://github.com/marquistj13/TongjiThesis)
Expand Down Expand Up @@ -599,7 +600,7 @@ gbyntd 以语言、年份、作者、标题、降序排列
\hspace{\biblabelsep}}
```

示例见:https://github.com/hushidong/biblatex-gb7714-2015/issues/62
示例见:[issue](https://github.com/hushidong/biblatex-gb7714-2015/issues/62)



Expand Down Expand Up @@ -706,9 +707,25 @@ biblatex-7714-2015的顺序编码制样式特别设计了这样的环境,以
\setcounter{biburlnumpenalty}{100}%大于0允许在数字后面断行
\setcounter{biburlucpenalty}{100}%大于0允许在大写字母后面断行
\setcounter{biburllcpenalty}{100}%大于0允许在小写字母后面断行
```

* <b>中英文混排,有些英文断行不佳,导致行溢出,怎么解决?</b>


biblatex的参考文献表的换行是由tex的断行机制决定的,处理行(盒子)溢出就要用tex的方式处理:

```
{
%\hyphenation{Proce-edings}
\hyphenpenalty=5000 %断词阈值, 值越大越不容易出现断词
\tolerance=500 %丑度, 10000为最大无溢出盒子, 参考the texbook 第6章
\hbadness=100 %如果丑度超过hbadness这一阀值, 那么就会发出警告
\printbibliography[heading=subbibintoc,title=【参考文献】]
}
```

当然如果不想这么设置,可以手动的修改参考文献条目的内容,在需要换行的内容前加上-符号。
见:https://github.com/hushidong/biblatex-gb7714-2015/issues/89

* <b>当参考文献没有作者时,希望用佚名或Anon代替作者时,请问该怎么处理?</b>
Expand Down Expand Up @@ -824,6 +841,20 @@ biblatex-gb7714-2015设计了两种多语言对照参考文献的实现方式,
使用命令`\yearcite{bibtexkey}`给出仅包含年份的标签。


* <b>中文文档中,引用标注标签在一个句子中时,标签的`]`后面与中文字符之间存在一个空格,怎么消除?</b>


在引用命令后面加一个没有长度的空白即可,比如:
```
中文字符\cite{sally_history_1985}\mbox{}中文字符
中文字符\cite{sally_history_1985}\hbox{}中文字符
中文字符\cite{sally_history_1985}\makebox{}中文字符
中文字符\cite{sally_history_1985}\hspace{0pt}中文字符
```


* <b>在使用作者年制时,我希望文献表是按作者年份标题排序,而正文某处一个cite命令引用多个参考文献,且这些文献的标签是按年份作者标题排序,该怎么操作?</b>

Expand Down
Binary file modified biblatex-gb7714-2015.pdf
Binary file not shown.
41 changes: 41 additions & 0 deletions example/test-space-after-citelabel-inCJKline.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
\documentclass{article}
\usepackage[backend=biber,style=gb7714-2015]{biblatex}%citexref=true
\usepackage{ctex}

%\apptocmd{\cite}{\makebox{\rule{1em}{1pt}}}{}{}


\begin{filecontents}{\jobname.bib}
@book{sally_history_1985,
location = {Monterey, California},
title = {History of Algebraic Geometry},
isbn = {978-0-534-03723-9},
series = {Wadsworth Mathematics Series},
pagetotal = {xii+186},
publisher = {Wadsworth International Group, Belmont, {CA}},
author = {Dieudonné, Jean},
translator = {Sally, Judith D.},
date = {1985},
mrnumber = {780183},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
abcd\cite{sally_history_1985}abcd

中文字符\cite{sally_history_1985}中文字符

中文字符\cite{sally_history_1985}a\rule{1em}{1pt}中文字符

中文字符\cite{sally_history_1985}\mbox{}中文字符

中文字符\cite{sally_history_1985}\hbox{}中文字符

中文字符\cite{sally_history_1985}\makebox{}中文字符%

中文字符\cite{sally_history_1985}\hspace{0pt}中文字符%


\printbibliography
\end{document}
38 changes: 38 additions & 0 deletions example/test-translator-in-other-lan.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
%--
%测试译作中的译者的中英文的差异化处理
%

\documentclass{article}
\usepackage[backend=biber,style=gb7714-2015]{biblatex}%citexref=true
\usepackage{ctex}

\begin{filecontents}{\jobname.bib}
@Book{GPS1988--,
Title = {外国出版史},
Author = {{昂温, G} and {昂温, P S}},
Publisher = {中国书籍出版社},
Translator = {陈生诤},
Year = {1988},
Location = {北京}
}


@book{sally_history_1985,
location = {Monterey, California},
title = {History of Algebraic Geometry},
isbn = {978-0-534-03723-9},
series = {Wadsworth Mathematics Series},
pagetotal = {xii+186},
publisher = {Wadsworth International Group, Belmont, {CA}},
author = {Dieudonné, Jean},
translator = {Sally, Judith D.},
date = {1985},
mrnumber = {780183},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}
11 changes: 11 additions & 0 deletions example/updatehistory.tex
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@

add a value for option gbnamefmt, the result of setting this value is like:Liu Qiangda.


\item 完善译著中除中文外其它语言的译者的输出。(20210401)

improve the translator output of languages other than Chinese for tranlations.

\item 去除中文行内上标标注后面因xeCJK自动添加的空白。(20210401)

remove the space after the superscript citation in chinese line automatically added by xeCJK.



\end{enumerate}


Expand Down
40 changes: 33 additions & 7 deletions gb7714-2015.bbx
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@
\NewBibliographyString{phdthesiscn}
\NewBibliographyString{editorcn}
\NewBibliographyString{editorscn}
\NewBibliographyString{bytranslatorcn}



Expand All @@ -884,7 +885,7 @@
\DefineBibliographyStrings{english}{
bibliography = {\str@bibliography},
references = {\str@references},
bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\
bytranslatorcn = {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\
and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
andcn = {\addcomma},%and本地化字符串的中文对应词
andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分
Expand Down Expand Up @@ -2261,46 +2262,71 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%
% 修改译者位置格式
% v1.0w,20210401,hzz,增加对英文等其它语言译者的处理
%
% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
\renewbibmacro*{bytranslator+others}{\bibauthorfont%
\ifnameundef{translator}
{}
{%\usebibmacro{bytranslator+othersstrg}
{\iffieldequalstr{usere}{chinese}{}{\usebibmacro{bytranslator+othersstrg}}
%\setunit{\addspace}%
\printnames[bytranslator]{translator}%
\clearname{translator}%
%从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
%比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
\usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
\iffieldequalstr{usere}{chinese}{\usebibmacro{bytranslator+othersstrg}}{}%“译”的位置换到下面来,即放到译者后面。
%\setunit{\addspace}%
\newunit}%
\usebibmacro{withothers}}
\renewbibmacro*{bytranslator+othersstrg}{%
\def\abx@tempa{bytranslator}%
\ifnamesequal{translator}{commentator}
{\appto\abx@tempa{co}%
\clearname{commentator}}
{\ifnamesequal{translator}{annotator}
{\appto\abx@tempa{an}%
\clearname{annotator}}
{}}%
\ifnamesequal{translator}{introduction}
{\appto\abx@tempa{in}%
\clearname{introduction}}
{\ifnamesequal{translator}{foreword}
{\appto\abx@tempa{fo}%
\clearname{foreword}}
{\ifnamesequal{translator}{afterword}
{\appto\abx@tempa{af}%
\clearname{afterword}}
{}}}%
\iffieldequalstr{usere}{chinese}{\bibstring{bytranslatorcn}}
{\bibstring{\abx@tempa}}}
%
% 修改作者数量超过限定值,做省略时的处理格式
% v1.0,20160701,hzz
% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
%
% v1.0w,20210401,hzz,针对其它语言的译者后的标点与中文不同做处理
% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
% \printnames由start-stop控制项数,默认是1和maxnames/minnames
\renewbibmacro*{name:andothers}{\bibauthorfont%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}{\ifnumgreater{\value{liststop}}{1}%
{\finalandcomma}%
}{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma
{\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。
{}%
\printdelim{andothersdelim}\printdelim{strandothersdelim}%
}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
\ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\addcomma\addthinspace}{}}{}%为了实现上述第二个示例情况做的处理
}}
% 修改省略作者后的本地化字符串,比如et al.
% v1.0o,20190103,hzz
%
Expand Down
24 changes: 19 additions & 5 deletions gb7714-2015.cbx
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,33 @@
% 修改postnote的输出格式
\DeclareFieldFormat{postnote}{#1}


%修改\mkbibsuperscript宏在最后加上一个空白使得xeCJK不会自动在引用标签后面加上中英文之间的空白
%hzz,v1.0w,2021-0401
\renewrobustcmd{\mkbibsuperscript}[1]{%
\unspace\allowhyphens\textsuperscript{%
\begingroup
\protected\long\def\mkbibsuperscript##1{%
\blx@warning{Nested superscript}%
\mkbibbrackets{##1}}%
#1\endgroup}\kern\z@}

%
% 重定义cite命令
%
% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
{[\usebibmacro{cite:init}%
\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 \textsuperscript
{[\usebibmacro{cite:init}%]
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}]%
\printfield{postnote}}
{%[
\usebibmacro{cite:dump}]%
\printfield{postnote}}%\kern\p@ \kern\z@

%\renewcommand{\cite}[1]{\textsuperscript{[\supercite{#1}]}\kern\z@}
% v1.0p 以前用的方式
%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
% {\usebibmacro{cite:init}%
Expand Down Expand Up @@ -333,7 +347,7 @@
\ifboolexpr{
( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} )
or
test {\iffieldequals{labelprefix}{\cbx@lastprefix}}
test {\iffieldequals{labelprefix}{\cbx@lastprefix}}%
}
{\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}}
{\savefield{entrykey}{\cbx@lastkey}%
Expand Down
34 changes: 28 additions & 6 deletions gb7714-2015ay.bbx
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@
\NewBibliographyString{phdthesiscn}
\NewBibliographyString{editorcn}
\NewBibliographyString{editorscn}
\NewBibliographyString{bytranslatorcn}

%
% 修改一些当地化字符串
Expand All @@ -823,7 +824,7 @@
\DefineBibliographyStrings{english}{
bibliography = {\str@bibliography},
references = {\str@references},
bytranslator= {\str@bytranslator\adddot}, %将trans. by 改成 译
bytranslatorcn= {\str@bytranslator\adddot}, %将trans. by 改成 译
and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词
andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分
Expand Down Expand Up @@ -2038,29 +2039,50 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%
% 修改译者位置格式
% v1.0w,20210401,hzz,增加对英文等其它语言译者的处理
%
% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
\renewbibmacro*{bytranslator+others}{\bibauthorfont%
\ifnameundef{translator}
{}
{%\usebibmacro{bytranslator+othersstrg}
{\iffieldequalstr{usere}{chinese}{}{\usebibmacro{bytranslator+othersstrg}}
%\setunit{\addspace}%
\printnames[bytranslator]{translator}%
\clearname{translator}%
%从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
%比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
\usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
\iffieldequalstr{usere}{chinese}{\usebibmacro{bytranslator+othersstrg}}{}%“译”的位置换到下面来,即放到译者后面。
%\setunit{\addspace}%
\newunit}%
\usebibmacro{withothers}}
\renewbibmacro*{bytranslator+othersstrg}{%
\def\abx@tempa{bytranslator}%
\ifnamesequal{translator}{commentator}
{\appto\abx@tempa{co}%
\clearname{commentator}}
{\ifnamesequal{translator}{annotator}
{\appto\abx@tempa{an}%
\clearname{annotator}}
{}}%
\ifnamesequal{translator}{introduction}
{\appto\abx@tempa{in}%
\clearname{introduction}}
{\ifnamesequal{translator}{foreword}
{\appto\abx@tempa{fo}%
\clearname{foreword}}
{\ifnamesequal{translator}{afterword}
{\appto\abx@tempa{af}%
\clearname{afterword}}
{}}}%
\iffieldequalstr{usere}{chinese}{\bibstring{bytranslatorcn}}
{\bibstring{\abx@tempa}}}
%
% 修改作者数量超过限定值,做省略时的处理格式
% v1.0,20160701,hzz
% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
%
% v1.0w,20210401,hzz,针对其它语言的译者后的标点与中文不同做处理
% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
% \printnames由start-stop控制项数,默认是1和maxnames/minnames
\renewbibmacro*{name:andothers}{\bibauthorfont%
Expand All @@ -2076,7 +2098,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
\ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\addcomma\addthinspace}{}}{}%为了实现上述第二个示例情况做的处理
}}
% 修改省略作者后的本地化字符串,比如et al.
Expand Down
Loading

0 comments on commit 20b5a48

Please sign in to comment.