Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

附录中的参考文献另行编序号 #837

Closed
zepinglee opened this issue Mar 21, 2023 · 18 comments
Closed

附录中的参考文献另行编序号 #837

zepinglee opened this issue Mar 21, 2023 · 18 comments

Comments

@zepinglee
Copy link
Contributor

最近研究生院的姚老师反映说,LaTeX 模板中附录的参考文献没有按照《写作指南》要求“另行编序号”。这样编号的主要理由在于,附录是在参考文献之后。目前讨论的大致方案是,如果附录的文献要单独编号,顺序编码制引注使用 [A-1], [B-2] 的格式,每个附录的末尾有单独的参考文献表。

但是要实现这些就比较麻烦了。本科生的附录有单独的环境 surveytranslation,相对比较好处理。研究生的附录需要分 \chapter 单独编号,需要在 \appendix 进行大量 patch。而且需要兼容 bibtex + biber 两套方案(未来可能还有 citation-style-language)。

所以,大家有没有其他想法?

@Harry-Chen
Copy link
Member

是否可以直接从附录开始重新编号,这样应该会简单很多?

@zepinglee
Copy link
Contributor Author

是否可以直接从附录开始重新编号,这样应该会简单很多?

那么在全部附录结束后生成一个额外参考文献表?

@zepinglee
Copy link
Contributor Author

还可以考虑:

  1. 说服研究生院的老师修改格式,将附录放在主文档的参考文献前,这样参考文献就不需要另行编号了。参考伯克利的论文 http://www2.eecs.berkeley.edu/Pubs/TechRpts/2018/EECS-2018-105.html
  2. 禁止在附录中使用 \cite 等引用命令(可能有点太粗暴了)。

@note286
Copy link

note286 commented Mar 22, 2023

西安电子科技大学的本科毕业设计论文就是要求分开的,我至今尚未实现,正文-正文参考文献-附录-附录参考文献,而且附录参考文献编号也是要求分章编号,例如[A1][B1][B2]这种。我原本的设想就是如果有附录参考文献,就只支持biblatex,单独的参考文献列表好实现,但是编号修改一直没搞定。

附录中的图、表、式、参考文献等与正文分开,用阿拉伯数字另行编序号,注意在数码前冠以附录的序码。如:图A1;表B2;式(C-3);文献[D5]。


研究生的就是正常的,正文-附录-参考文献,参考文献编号都是顺序编码制。

@hushidong
Copy link

我想可以这样考虑:

把附录的部分当做一个与前面部分完全不相关的部分来考虑,也就是说要在附录部分实现一套新的参考文献系统,这样既不用去patch前面的部分相关的命令和环境,只要在附录部分重新实现一套就行。

比如:附录部分中的参考文献-引用标注用citeap来引用,著录列表用一个新环境bibenvap来输出。这样不用对前面正文其它章节用的命令做patch,而只要去实现citeap和bibenvap,相对来说就会简单很多。

这样处理,无论是bibtex还是biblatex,应该都可以实现。

后期在确保功能实现基础上,再考虑是否与前面正文部分进行整合,如果整合起来方便实现的话。

后面我用biblatex先做个例子出来先看看,这个思路是否可行。然后你们再考虑实现bibtex或者未来的csl的。

这样分步骤一步步实现,我想最后是能够拿出一个较好的解决方案的。

@hushidong
Copy link

@zepinglee 你前面说的禁用cite就是类似的思路。也不用禁用,在实现citeap后在appendix之后let一下cite等于citeap就可以了。

@hushidong
Copy link

我之前忘了,实际上biblatex已经考虑了这个需求的,刚刚想做个例子的时候想起来。所以,也不需去实现什么新的命令或环境了,直接 做设置就可以了的。

下面给出一个示例:


% !Mode:: "TeX:UTF-8"
% 用于测试gb7714-2015的标注样式,是否满足GB要求
\documentclass{ctexbook}
\usepackage[paperheight=8cm,vmargin=0.5cm]{geometry}
\usepackage{xcolor}
\usepackage[colorlinks]{hyperref}
\usepackage[backend=biber,style=gb7714-2015]{biblatex}%sorting=nyt

\begin{filecontents}[force]{\jobname.bib}
@Book{Peebles2001-100-100,
  Title                    = {Probability, random variable, and random signal Principles and \LaTeX{}},
  Address                  = {New York},
  Author                   = {von Peebles, Jr., P. Z.},
  Edition                  = {4},
  Pages                    = {100},
  Publisher                = {McGraw-Hill},
  Year                     = {2001}
}

@Book{蔡敏2006--,
  Title                    = {UML基础和Rose建模教程},
  Address                  = {北京},
  Author                   = {蔡敏 and 徐慧慧 and 黄柄强},
  Publisher                = {人民邮电出版社},
  Year                     = {2006},
  Month                    = {1}
}

\end{filecontents}

\addbibresource{\jobname.bib}

\DeclareRefcontext{ap}{labelprefix=A}

\let\cleardoublepage\clearpage


\begin{document}

\chapter{正文}

\begin{refsection}
正文内容
\cite{Peebles2001-100-100}

\cite[49]{蔡敏2006--}

\printbibliography

\end{refsection}


\appendix
\chapter{附录一}
\newrefcontext{ap}
\begin{refsection}

附录内容
\cite{Peebles2001-100-100}

\cite[49]{蔡敏2006--}


\printbibliography[heading=subbibliography]

\end{refsection}


\chapter{附录二}
\newrefcontext[labelprefix=B]
\begin{refsection}

附录内容
\cite{Peebles2001-100-100}

\cite[49]{蔡敏2006--}


\printbibliography[heading=subbibliography]

\end{refsection}

\end{document} 

结果为:
图片
图片
图片

@note286
Copy link

note286 commented Mar 22, 2023

@hushidong 胡老师,你看这个需求能实现吗?我尝试了\newrefcontext,暂时无法做到。

appendix - Can citeindex and bibindex contain section number in biblatex? - TeX - LaTeX Stack Exchange

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{A,title={A}}
@article{B,title={B}}
@article{C,title={C}}
@article{D,title={D}}
@article{E,title={E}}
@article{F,title={G}}
\end{filecontents}

\usepackage[style=gb7714-2015]{biblatex}
\addbibresource{\jobname}

\begin{document}

\section{mainbody}
text\cite{A}
text\cite{B}
\printbibliography

\appendix

\begin{refsection}

\section{appendix 1}
text\cite{C}
text\cite{A}
\section{appendix 2}
text\cite{D,E,F}
\printbibliography

\end{refsection}

\end{document}

image

@hushidong
Copy link

可以这样处理:

\documentclass{article}


\begin{filecontents}[force]{\jobname.bib}
@article{A,title={A}}
@article{B,title={B}}
@article{C,title={C}}
@article{D,title={D}}
@article{E,title={E}}
@article{F,title={F}}
\end{filecontents}

\usepackage[style=gb7714-2015]{biblatex} %,defernumbers=true
\addbibresource{\jobname}


\begin{document}

\section{mainbody}
text\cite{A}
text\cite{B}
\printbibliography

\appendix

\begin{refsection}

\section{appendix 1}
text\cite{C}
text\cite{D}
\end{refsection}

\begin{refsection}

\section{appendix 2}
text\cite{E,F}
\end{refsection}

\newrefcontext[labelprefix={A.}]
\printbibliography[section=1]
\newrefcontext[labelprefix={B.}]
\vspace{-1.3\baselineskip}
\printbibliography[heading=none,section=2]

\end{document} 

结果为:

图片

@hushidong
Copy link

其它的,你再发挥就好了,我目前想到的是这样的快速实现路径。里面有凑合的地方,但为了功能实现就勉强用了。

@hushidong
Copy link

或者这样也行:

\documentclass{article}


\begin{filecontents}[force]{\jobname.bib}
@article{A,title={A}}
@article{B,title={B}}
@article{C,title={C}}
@article{D,title={D}}
@article{E,title={E}}
@article{F,title={F}}
\end{filecontents}

\usepackage[style=gb7714-2015,defernumbers=true]{biblatex}%
\addbibresource{\jobname}

\begin{document}

\section{mainbody}
text\cite{A}
text\cite{B}
\printbibliography

\appendix

\begin{refsection}

\begin{refsegment}
\section{appendix 1}
text\cite{C}
text\cite{D}
\end{refsegment}

\begin{refsegment}
\section{appendix 2}
text\cite{E,F}
\end{refsegment}


\newrefcontext[labelprefix={A.}]
\printbibliography[segment=1]
\vspace{-1.3\baselineskip}
\newrefcontext[labelprefix={B.}]
\printbibliography[heading=none,segment=2]


\end{refsection}

\end{document} 

结果是一样的。

@hushidong
Copy link

refsegment本来是各个segment统一编号的,加上defernumber选项可以使其区分出refcontext来。

当然要注意:上述都要多次编译,即biber运行后还需要2次latex编译。

@note286
Copy link

note286 commented Mar 22, 2023

@hushidong 非常感谢!!!

@zepinglee
Copy link
Contributor Author

\chapter{附录二}
\newrefcontext[labelprefix=B]
\begin{refsection}
附录内容
\cite{Peebles2001-100-100}
\cite[49]{蔡敏2006--}
\printbibliography[heading=subbibliography]
\end{refsection}

这样需要手动编号,有些背离格式与内容分离原则。我再试试能不能在 \appendix 后的每个 \chapter 中自动设置 refsection,类似 biblatex 选项 refsection 的功能。

@zepinglee
Copy link
Contributor Author

zepinglee commented May 10, 2023

c208916 中实现该功能,支持 bibtex 和 biblatex 两种方式。感谢 @hushidong@atxy-blip 的帮助。

\section{参考文献}
附录中的参考文献示例(\cite{carlson1981two} 和 \cite{carlson1981two,taylor1983scanning,taylor1981study})。
\bibliographystyle{thuthesis-numeric}
\bibliography{ref/refs}

Screenshot 2023-05-10 at 20 27 03

@zepinglee
Copy link
Contributor Author

不过目前有多处 \bibliography,如果用户将默认的 bibtex 方案改为 biblatex,需要将这些都修改为 \printbibliography,不太方便。

我提议将 bibtex 的接口 \bibliography 改为 \addbibresource\printbibliography,同 biblatex 一致,这样就只需要修改 thusetup.tex 就可以了。

thuthesis/thusetup.tex

Lines 148 to 167 in c208916

% 参考文献使用 BibTeX + natbib 宏包
% 顺序编码制
\usepackage[sort]{natbib}
\bibliographystyle{thuthesis-numeric}
% 著者-出版年制
% \usepackage{natbib}
% \bibliographystyle{thuthesis-author-year}
% 本科生参考文献的著录格式
% \usepackage[sort]{natbib}
% \bibliographystyle{thuthesis-bachelor}
% 参考文献使用 BibLaTeX 宏包
% \usepackage[style=thuthesis-numeric]{biblatex}
% \usepackage[style=thuthesis-author-year]{biblatex}
% \usepackage[style=apa]{biblatex}
% \usepackage[style=mla-new]{biblatex}
% 声明 BibLaTeX 的数据库
% \addbibresource{ref/refs.bib}

初步想法:

  1. 兼容旧的接口 \bibliographystyle\bibliography
  2. bibtex 的 \printbibliography[] 如果有参数则给出警告。
  3. 主文档的 \bibliographystyle 也设置附录中的默认 bib style(bibunits\defaultbibliographystyle)。

另外 stone-zeng/fduthesis 目前就是这么处理的。

@atxy-blip
Copy link

我提议将 bibtex 的接口 \bibliography 改为 \addbibresource\printbibliography,同 biblatex 一致,这样就只需要修改 thusetup.tex 就可以了。】

我读过(也抄过)fduthesis 里面的相关代码,觉得曾老师的封装方案已经很完备了,可以直接借来用。新功能也可以直接拿 L3 写,就作为重构的一部分了。

或许我们可以另开一则 issue 来讨论这个问题?现在已经快20层楼了……

@zepinglee
Copy link
Contributor Author

我提议将 bibtex 的接口 \bibliography 改为 \addbibresource\printbibliography,同 biblatex 一致,这样就只需要修改 thusetup.tex 就可以了。】

我读过(也抄过)fduthesis 里面的相关代码,觉得曾老师的封装方案已经很完备了,可以直接借来用。新功能也可以直接拿 L3 写,就作为重构的一部分了。

或许我们可以另开一则 issue 来讨论这个问题?现在已经快20层楼了……

好的,在 #875 中继续讨论。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants