zepinglee / gbt7714-bibtex-style

GB/T 7714-2015 BibTeX Style
LaTeX Project Public License v1.3c
1.18k stars 198 forks source link

如何支持bib中type类型? #87

Closed fu123456 closed 2 years ago

fu123456 commented 2 years ago

这个package如何支持bib中type类型,比如我想要的一个博士论文的参考文献格式如下: 赵温波. 2003.径向基概率神经网络研究[D]:[博士] .合肥:中国科学技术大学,21-24. 但是默认的类型“[博士]”是没有的,我在bib中添加了“type={博士}”,编译后也 是不行,这个可以通过修改底层文件实现这个功能的吗?

sikouhjw commented 2 years ago

https://github.com/CTeX-org/gbt7714-bibtex-style/blob/2cb5f32991bdc10e5499438c81c88111e405291a/gbt7714.dtx#L240

fu123456 commented 2 years ago

我这个要求有什么临时办法可以解决吗?因为学校的参考文献格式有这个要求。

sikouhjw commented 2 years ago

赵温波. 2003.径向基概率神经网络研究[D]:[博士] .合肥:中国科学技术大学,21-24.

你这也不是国标啊。 如果要输出 type,可以用 biblatex-gb7714-2015,用 biber 编译。

\begin{filecontents*}{test.bib}
@phdthesis{test,
  author  = {赵温波},
  title   = {径向基概率神经网络研究},
  school  = {中国科学技术大学},
  year    = {2003},
  type    = {[博士]},
  address = {合肥},
}
\end{filecontents*}
\documentclass{ctexart}
\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}
\addbibresource[location=local]{test.bib}
\begin{document}
  \cite{test}
  \printbibliography[heading=bibliography,title=参考文献]
\end{document}
fu123456 commented 2 years ago

非常感谢,之前也看到这个包。

zepinglee commented 2 years ago

可以修改 bst

FUNCTION {mastersthesis}
{ "D]: [硕士" set.entry.mark
  monograph
}

FUNCTION {phdthesis}
{ "D]: [博士" set.entry.mark
  monograph
}

不支持 type 有几方面原因:国标中的学位论文类型只有 [D],没有必要进行区分;BibTeX 的标准文献类型有 @mastersthesis@phdthesis 能够区分,没必要使用 type;而且 BibTeX 的标准域 type 只用于 @techreport

@thesistype 的录入方式是 biblatex 定义的,但是这样控制格式就很不方便,没法用同一 bib 适应不同格式。比如 https://github.com/CTeX-org/gbt7714-bibtex-style/issues/87#issuecomment-944859703 的输出结果是“[D]. [博士].”,还有的学校要求的格式是 [博士学位论文]

fu123456 commented 2 years ago

我想在问下,按照国标,期刊或者会议全名之后,可以在跟着一个简写吗?比如下面这个例子(第一个只是会议的全称,第二个是会议的全称加上简称)。 Greedy Hierarchical Variational Autoencoders for Large-Scale Video Prediction[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2021. Greedy Hierarchical Variational Autoencoders for Large-Scale Video Prediction[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 2021. 这个在一些期刊或者会议上有这种写法。国标也没有明确说第二种写法不合适,我想问你大佬你的看法。带上简称有一个好处,别人可以很快看出来这个期刊或者会议是什么,毕竟 圈内说哪一个会议都是说简称。

fu123456 commented 2 years ago

@sikouhjw @zepinglee

sikouhjw commented 2 years ago

我想在问下,按照国标,期刊或者会议全名之后,可以在跟着一个简写吗?比如下面这个例子(第一个只是会议的全称,第二个是会议的全称加上简称)。 Greedy Hierarchical Variational Autoencoders for Large-Scale Video Prediction[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2021. Greedy Hierarchical Variational Autoencoders for Large-Scale Video Prediction[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). 2021. 这个在一些期刊或者会议上有这种写法。国标也没有明确说第二种写法不合适,我想问你大佬你的看法。带上简称有一个好处,别人可以很快看出来这个期刊或者会议是什么,毕竟 圈内说哪一个会议都是说简称。

我对参考文献不是很熟悉。

8.2.3 其他题名信息根据信息资源外部特征的具体情况决定取舍。其他题名信息包括副题名,说明题名文字,多卷书的分卷书名、卷次、册次,专利号,报告号,标准号等。

我感觉简称可以放“其他题名”里面。

hushidong commented 2 years ago

当然可以的,要强调一些信息显然不影响写参考文献的目的。国标中并不强制要求期刊名或者会议名怎么写。你自己在会议名上加上就行,当然这样会增加一些信息,后面如果哪个格式要求不能加,你自己得去掉。

fu123456 commented 2 years ago

"后面如果哪个格式要求不能加,你自己得去掉".你说的这个意思是什么意 思?这个简写一般都是可以在全写后面加上的,这个全写一般网上都可以 搜索到,在圈内大家都是这么使用,期刊或者会议管网上也会显示简写。 我最近在写学位论文。我现在的情况是统一都在期刊和会议名的后面尽量 都加上一个简写,比如我上面展示的。所有的参考文献98%以上都是有简写 的。但是极个别比较冷僻的期刊或者会议,这个简写就没有写上。这个是 ok的吧。我现在就是存在一个“折中”的问题。一个方案就是都是全写,没 有简写。第二个是全写加上简写(少部分文献没有简写)。我现在暂时选 择第二个方案。但是就是显得不是绝对统一了。大佬你如何看?

hushidong commented 2 years ago

我之前的意思是,如果你是修改bib文件加上了简写,然后哪天又觉得不好要去掉或者什么人要求你去掉的话,那么就要再改bib把它去掉。

你写学位论文,我觉得关键是学校的要求,学校如果没有什么强制要求,那你写上就行。 所谓无禁止即可尝试。

下面的示例修改了一下上面示例中标题后的标点。

\begin{filecontents*}{test.bib}
@phdthesis{test,
  author  = {赵温波},
  title   = {径向基概率神经网络研究},
  school  = {中国科学技术大学},
  year    = {2003},
  type    = {[博士]},
  address = {合肥},
  pages={21-24}
}
\end{filecontents*}
\documentclass{ctexart}
\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}

\DeclareFieldFormat[thesis]{title}{#1\addcolon\addthinspace}

\addbibresource[location=local]{test.bib}
\begin{document}
  \cite{test}
  \printbibliography[heading=bibliography,title=参考文献]
\end{document}
hushidong commented 2 years ago

一个更好的思路是把这信息放到一个域(字段)中,然后修改参考文献样式来实现,那么若下次不需要这一信息,也无需去掉,只要把这一文献样式修改去掉即可。比如:下面的例子中将简写信息放到一个shortbooktitle中,然后修改样式来输出。

\begin{filecontents*}{test.bib}
@phdthesis{test,
  author  = {赵温波},
  title   = {径向基概率神经网络研究},
  school  = {中国科学技术大学},
  year    = {2003},
  type    = {[博士]},
  address = {合肥},
  pages={21-24}
}

@Inproceedings{Nemec1997-209-214,
  Title                    = {Force control of redundant robots},
  Author                   = {B Nemec},
  Booktitle                = {Processings of Symposium on Robot Control},
  shortbooktitle ={(PSRC)},
  Pages                    = {209-214},
  Country                  = {Nantes France},
  Year                     = {1997}
}

@Article{Chiani1998-2998-3008,
  Title                    = {Error probability for block codes over channels with block interference},
  Author                   = {Chiani, M.},
  Journal                  = {IEEE Trans. Inf. Theory},
  shortbooktitle ={(ITIT)},
  Number                   = {7},
  Pages                    = {2998-3008},
  Volume                   = {44},
  Year                     = {1998}
}

\end{filecontents*}
\documentclass{ctexart}
\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}

\DeclareFieldFormat[thesis]{title}{#1\addcolon\addthinspace}

\renewbibmacro*{maintitle+booktitle}{%
  \usebibmacro{booktitle}\setunit{\addspace}\printfield{shortbooktitle}%
  \newunit}

\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
  \usebibmacro{journal}\setunit{\addspace}\printfield{shortbooktitle}%
  %\setunit*{\addspace}%
  \setunit*{\addcomma\addspace}%修改为增加一个逗号
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  %\usebibmacro{volume+number+eid}%
  %\setunit{\addspace}%
  \usebibmacro{issue+date}%
  %\setunit{\addcolon\space}%
  \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
  %换成逗号和空格
  \usebibmacro{issue}%
  \usebibmacro{volume+number+eid}%把卷期放到年份后面
  %\newunit
  }

\addbibresource[location=local]{test.bib}
\begin{document}
  \nocite{*}
  \printbibliography[heading=bibliography,title=参考文献]
\end{document}

结果为:

图片

zepinglee commented 2 years ago

我想在问下,按照国标,期刊或者会议全名之后,可以在跟着一个简写吗?

国标中没有具体要求,你可以在 booktitle 自由发挥。

fu123456 commented 2 years ago

一个更好的思路是把这信息放到一个域(字段)中,然后修改参考文献样式来实现,那么若下次不需要这一信息,也无需去掉,只要把这一文献样式修改去掉即可。比如:下面的例子中将简写信息放到一个shortbooktitle中,然后修改样式来输出。

\begin{filecontents*}{test.bib}
@phdthesis{test,
  author  = {赵温波},
  title   = {径向基概率神经网络研究},
  school  = {中国科学技术大学},
  year    = {2003},
  type    = {[博士]},
  address = {合肥},
  pages={21-24}
}

@Inproceedings{Nemec1997-209-214,
  Title                    = {Force control of redundant robots},
  Author                   = {B Nemec},
  Booktitle                = {Processings of Symposium on Robot Control},
  shortbooktitle ={(PSRC)},
  Pages                    = {209-214},
  Country                  = {Nantes France},
  Year                     = {1997}
}

@Article{Chiani1998-2998-3008,
  Title                    = {Error probability for block codes over channels with block interference},
  Author                   = {Chiani, M.},
  Journal                  = {IEEE Trans. Inf. Theory},
  shortbooktitle ={(ITIT)},
  Number                   = {7},
  Pages                    = {2998-3008},
  Volume                   = {44},
  Year                     = {1998}
}

\end{filecontents*}
\documentclass{ctexart}
\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}

\DeclareFieldFormat[thesis]{title}{#1\addcolon\addthinspace}

\renewbibmacro*{maintitle+booktitle}{%
  \usebibmacro{booktitle}\setunit{\addspace}\printfield{shortbooktitle}%
  \newunit}

\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
  \usebibmacro{journal}\setunit{\addspace}\printfield{shortbooktitle}%
  %\setunit*{\addspace}%
  \setunit*{\addcomma\addspace}%修改为增加一个逗号
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  %\usebibmacro{volume+number+eid}%
  %\setunit{\addspace}%
  \usebibmacro{issue+date}%
  %\setunit{\addcolon\space}%
  \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
  %换成逗号和空格
  \usebibmacro{issue}%
  \usebibmacro{volume+number+eid}%把卷期放到年份后面
  %\newunit
  }

\addbibresource[location=local]{test.bib}
\begin{document}
  \nocite{*}
  \printbibliography[heading=bibliography,title=参考文献]
\end{document}

结果为:

图片

你这个编译命令是什么,我使用“xelatex->bibtex->xelatex”或者”xelatex->biber->xelatex“输出不了参考文献,整个文档只有“test“这个单词。

fu123456 commented 2 years ago

国标中所有英文的名字都是大写字母,感觉这个很别扭。一般都是第一个字母大写,该单词随后的字幕小写。

hushidong commented 2 years ago

用的第二个命令就是biber那一套,你直接考示例编译,我给的示例里面都没有test这个文本信息的,你应该编译的不是一个文件。

hushidong commented 2 years ago

再加个选项,gbnamefmt=lowercase

fu123456 commented 2 years ago

在国标中,英文姓名是否全部大写还是首字母大写,以及题目中是第一个字母大写,还是随后的每一个实词都大写,这些理论上应该都可以吧?应该没有明确说一定都大写或者怎么样,只不过在国标给定的参考文献样例中,确实是姓名都全部大写,题目只有首字母大写,后面全部都小写了。这个默认的设置有特别的道理吗?

hushidong commented 2 years ago

国标是清楚的,按要求写就好了。但更关键的是学校和老师的要求,所以才会有这些选项来实现多样性的调整。

至于道理,其实没什么特别的道理,只能说是习惯,习惯形成以后就变成惯例了。

fu123456 commented 2 years ago

大佬,你解决了我很多问题,感谢。使用biblatex也基本ok。不过还有一个问题。就是使用biblatex,使用”\printbibliography“这个命令打印出参考文献。我发现论文参考文献 ,在每一页底部有空白部分,我看了下,每一条参考文献都是在当前页,不跨页,我想跨页,也就是一个参考文献可以在两页(一部分在上页的底部,一部分在当前页最上边)。这个如何设定呢?

hushidong commented 2 years ago

这个问题是tex内部分页机制产生的,有很多因素的影响:页面设置、字体字号、行距、文献条目的间距等等,主要是垂直方向上的尺度问题。只要根据要求设置好字体、行距、间距就行。不需要关注太多。word也是有这种问题的。

你测试一下整个例子可以看到,不是每一页的情况可能都会不同的。


\documentclass{ctexart}
\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}
\usepackage[showframe,showcrop]{geometry}

\DeclareFieldFormat[thesis]{title}{#1\addcolon\addthinspace}

\renewbibmacro*{maintitle+booktitle}{%
  \usebibmacro{booktitle}\iffieldundef{shortbooktitle}{}{\setunit{\addspace}\printfield{shortbooktitle}}%
  \newunit}

\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
  \usebibmacro{journal}\iffieldundef{shortbooktitle}{}{\setunit{\addspace}\printfield{shortbooktitle}}%
  %\setunit*{\addspace}%
  \setunit*{\addcomma\addspace}%修改为增加一个逗号
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  %\usebibmacro{volume+number+eid}%
  %\setunit{\addspace}%
  \usebibmacro{issue+date}%
  %\setunit{\addcolon\space}%
  \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
  %换成逗号和空格
  \usebibmacro{issue}%
  \usebibmacro{volume+number+eid}%把卷期放到年份后面
  %\newunit
  }

\addbibresource[location=local]{biblatex-examples.bib}
\begin{document}
  \nocite{*}
  \printbibliography[heading=bibliography,title=参考文献]
\end{document} 

结果为: 图片

图片

zepinglee commented 2 years ago

大佬,你解决了我很多问题,感谢。使用biblatex也基本ok。不过还有一个问题。就是使用biblatex,使用”\printbibliography“这个命令打印出参考文献。我发现论文参考文献 ,在每一页底部有空白部分,我看了下,每一条参考文献都是在当前页,不跨页,我想跨页,也就是一个参考文献可以在两页(一部分在上页的底部,一部分在当前页最上边)。这个如何设定呢?

这个是 biblatex.def\interlinepenalty, \widowpenalty\clubpenalty 三个参数控制的,而且其实这个比较合理,比如清华就要求“每一条文献的内容要尽量写在同一页内;遇有被迫分页的情况,可通过“留白”或微调本页行距的方式尽量将同一条文献内容放在一页。”

另外还可以把 bibsep 设成弹性距离。

zepinglee commented 2 years ago

在国标中,英文姓名是否全部大写还是首字母大写,以及题目中是第一个字母大写,还是随后的每一个实词都大写,这些理论上应该都可以吧?应该没有明确说一定都大写或者怎么样,只不过在国标给定的参考文献样例中,确实是姓名都全部大写,题目只有首字母大写,后面全部都小写了。这个默认的设置有特别的道理吗?

有,主要是参照了 ISO 690。

Screen Shot 2021-10-17 at 13 46 32
fu123456 commented 2 years ago

大佬们,我还有一个问题,比如:现在有一个期刊的参考文献,但是没有卷号,页码信息,但是有doi信息,这个时候按照国标我的参考文献应该是添加上doi信息吗?当然其他的我都统一没有添加doi信息的。

sikouhjw commented 2 years ago

大佬们,我还有一个问题,比如:现在有一个期刊的参考文献,但是没有卷号,页码信息,但是有doi信息,这个时候按照国标我的参考文献应该是添加上doi信息吗?当然其他的我都统一没有添加doi信息的。

图片

fu123456 commented 2 years ago

参考文献(电子资源),网页的时间和引用的时间在bib文件中如何体现? 按照这个项目主页,我使用了urldate这个关键字指定引用时间,编译后发现识别不了。那么这个电子资源时间和引用的时间如何在bib文件中通过关键字指定呢? 两个两个图显示了这两种时间。 gbt1 gbt2

sikouhjw commented 2 years ago

参考文献(电子资源),网页的时间和引用的时间在bib文件中如何体现? 按照这个项目主页,我使用了urldate这个关键字指定引用时间,编译后发现识别不了。那么这个电子资源时间和引用的时间如何在bib文件中通过关键字指定呢? 两个两个图显示了这两种时间。 gbt1 gbt2

\begin{filecontents*}{test.bib}
@article{libingmu2008hanguo,
  author       = {李炳穆},
  title        = {韩国图书馆法},
  journal      = {图书情报工作},
  year         = {2008},
  volume       = {52},
  number       = {6},
  pages        = {6--12},
  urldate      = {2013-10-25},
  url          = {http://www.docin.com/p-400265742.html},
}
@newspaper{yujianbin2013women,
  author       = {余建斌},
  title        = {我们的科技一直在追赶: 访中国工程院院长周济},
  journal      = {人民日报},
  year         = {2013},
  date         = {2013-01-12},
  number       = {2},
  urldate      = {2013-03-20},
  url          = {http://paper.people.com.cn/rmrb/html/2013-01/12/nw.D110000renmrb_20130112_5-02.htm},
}
\end{filecontents*}
\documentclass{ctexart}
\usepackage{gbt7714}
\bibliographystyle{gbt7714-numerical}
\begin{document}
  \nocite{*}
  \bibliography{test.bib}
\end{document}

国标中的参考文献,在 https://github.com/CTeX-org/gbt7714-bibtex-style/blob/master/test/testbst/support/standard.bib 都有

fu123456 commented 2 years ago

如何一个期刊论文引用的话,如何是出版了,就是[J]了,不需要什么网络链接和doi信息了。但是如何一个期刊论文只是在网上论文库中有,还没有出版,只有doi号,相当于[J/OL], 这个时候引用这个期刊论文时,引用时间,pdf文件链接以及doi号都要写上是吧 gbt3 感觉这个严格说,下面给的参考文献的格式和上面文字描述的格式要求也不是严格对应。

fu123456 commented 2 years ago

gbt4

zepinglee commented 2 years ago

如何一个期刊论文引用的话,如何是出版了,就是[J]了,不需要什么网络链接和doi信息了。

已出版的期刊也可以提供 URL 或 DOI。

但是如何一个期刊论文只是在网上论文库中有,还没有出版,只有doi号,相当于[J/OL], 这个时候引用这个期刊论文时,引用时间,pdf文件链接以及doi号都要写上是吧

最好有 URL 或 DOI,引用时间可有可无。

感觉这个严格说,下面给的参考文献的格式和上面文字描述的格式要求也不是严格对应。

对于期刊这些不是纯网页的文献,引用时间不重要。

fu123456 commented 2 years ago

大佬,你解决了我很多问题,感谢。使用biblatex也基本ok。不过还有一个问题。就是使用biblatex,使用”\printbibliography“这个命令打印出参考文献。我发现论文参考文献 ,在每一页底部有空白部分,我看了下,每一条参考文献都是在当前页,不跨页,我想跨页,也就是一个参考文献可以在两页(一部分在上页的底部,一部分在当前页最上边)。这个如何设定呢?

这个是 biblatex.def\interlinepenalty, \widowpenalty\clubpenalty 三个参数控制的,而且其实这个比较合理,比如清华就要求“每一条文献的内容要尽量写在同一页内;遇有被迫分页的情况,可通过“留白”或微调本页行距的方式尽量将同一条文献内容放在一页。”

另外还可以把 bibsep 设成弹性距离。

这个我看了使用biblatex编译的参考文献,在每一页的底部的空白部分大小差距比较大,有的比较少,有的比较多的空白。 看起来视觉上不和谐。这个有什么办法可以自动解决下吗?因为参考文献还可能随时在更新。 但是使用gbt7714宏包,每一页底部的白色空白基本上比较平均,相对来说比较小。

fu123456 commented 2 years ago

The solution in https://tex.stackexchange.com/questions/43260/biblatex-no-pagebreak-in-bibliography-entry does work. Add the following code in the tex file

\patchcmd{\bibsetup}{\interlinepenalty=5000}{\interlinepenalty=10000}{}{}