![在最终参考书目中手动添加手稿来源](https://linux22.com/image/326314/%E5%9C%A8%E6%9C%80%E7%BB%88%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E4%B8%AD%E6%89%8B%E5%8A%A8%E6%B7%BB%E5%8A%A0%E6%89%8B%E7%A8%BF%E6%9D%A5%E6%BA%90.png)
答案1
对于文件中已有的内容,.bib
使用 可以很容易地对这些引用进行分组biblatex
。请参阅按参考文献类型划分参考书目 举个基本的例子。由于您手动输入了未发布的来源,并且您希望的格式不太利于解决问题.bib
,我建议将它们组织在 CSV 文件中,然后使用 来datatool
打印它们。
以下文档作为概念证明,可以满足您的要求。首先是 CSV 文件。它具有以下列结构:
ArchiveName ArchiveAbbrev SourceName SourcePrefix SourceNumber
因此一行对应一个单独的项目:
"Archivo di Stato di Firenze", "ASFi", "Mediceo del Principato", "Filze", "810"
在示例文档中,我使用简单的分段来格式化标题,但您可以按照自己喜欢的任何方式进行操作。代码非常简单:我通读文件并根据需要生成标题,否则我会输出逗号和源编号。没有对条目进行排序,因为这在 Excel 或 OpenOffice 中很容易完成。
\begin{filecontents}{manuscripts.csv}
"ArchiveName","ArchiveAbbrev","SourceName","SourcePrefix","SourceNumber"
"Archivo di Stato di Firenze","ASFi","Mediceo del Principato","Filze",810
"Archivo di Stato di Firenze","ASFi","Mediceo del Principato","Filze",4323
"Archivo di Stato di Firenze","ASFi","Miscellanea Medicea","Filze",2634
"Archivo di Stato di Firenze","ASFi","Strozzi","Filze",480
"Archivo di Stato di Mantova","ASMn","Archivio Gonzaga",,"b1117"
"Archivo di Stato di Mantova","ASMn","Archivio Gonzaga",,"b1140"
"Archivo di Stato di Mantova","ASMn","Archivio Gonzaga",,"b1920"
\end{filecontents}
\documentclass{article}
\setcounter{secnumdepth}{0}
\usepackage{datatool}
\DTLloadrawdb{manuscripts}{manuscripts.csv}
\def\lastsource{}
\def\lastarch{}
\begin{document}
\DTLforeach{manuscripts}{\archive=ArchiveName,\archabbrev=ArchiveAbbrev,\sourcename=SourceName,\sourceprefix=SourcePrefix,\sourcenum=SourceNumber}{%
\DTLifstringeq{\archive}{\lastarch}
{\DTLifstringeq{\sourcename}{\lastsource}
{, \sourcenum}%
{\let\lastsource\sourcename
\subsection{\sourcename}
\DTLifnullorempty{\sourceprefix}{}{\sourceprefix~}\sourcenum}}
{\let\lastarch\archive
\let\lastsource\sourcename
\section{\archive\DTLifnullorempty{\archabbrev}{}{ (\archabbrev)}}
\subsection{\sourcename}
\DTLifnullorempty{\sourceprefix}{}{\sourceprefix~}\sourcenum}%
}
\end{document}