类似于书目的引用命令

类似于书目的引用命令

我有一个图书项目,其中会用到引文,作为章节的题词和正文。我计划制作一个引文索引,并适当引用来源。一些引文将摘录自文章或书籍,而另一些则是报纸报道的间接引文或从音频或视频来源转录的引文,有些甚至可能是伪造的(并以此形式报道)。我希望将引文的详细来源归入附录,就像参考书目一样,同时在正文旁边保留对来源的简短引用。

在附录中,引用将像书目中的书籍一样列出,并能够控制每个元素的格式:斜体、粗体、引号样式、分段、缩进等。此外,实际的书目参考也会被引用。也许已经有一个为此设计的软件包?如果没有,我会很高兴进行快速而粗糙的破解。

我想克隆参考书目环境并修改名称,例如更改@Article@Quotesource、更改titletext等,并修改显示样式以满足我的需求。我怀疑如果我尝试这种黑客攻击,我很快就会遇到错误,所以如果已经存在类似的东西,那就更好了。

为了澄清我的想法,这里有一个梦想的实现:

文本主体中期望的输出:

在此处输入图片描述

附录中期望的输出:

在此处输入图片描述

所需引用输入:

在此处输入图片描述

通常的书目输入:

在此处输入图片描述

在正文中输入如下内容:

在此处输入图片描述

% !TeX TXS-program:compile = txs:///xelatex
% !TEX encoding = UTF-8 Unicode
% !BIB TXS-program = biber
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
\@Book{Shakespeare:Hamlet:Folio1,
  author =       {William Shakespeare},
  title =        {Mr. {W}illiam {S}hakespeares Comedies, Histories, \& Tragedies: Published According to the True Originall Copies [The ``First Folio'']},
  publisher =    {Isaac Jaggard and Ed Blount},
  Year =         {1623}
}
\@Book{Shakespeare:Hamlet:Quarto1,
  author =       {William Shakespeare},
  title =        {The {T}ragicall {H}istorie of {H}amlet {P}rince of {D}enmarke. As it hath beene diuerse times acted by his {H}ighnesse seruants in the {C}ittie of {L}ondon : as also in the two {V}niuersities of {C}ambridge and {O}xford, and else-where [The ``First Quarto'']},
  publisher =    {Nicholas Ling \& J. Trundell (London)},
  Year =         {1603}
}
\@Book{Shakespeare:Hamlet:Quarto2,
  author =       {William Shakespeare},
  title =        {The {T}ragicall {Historie} of Hamlet, {P}rince of {D}enmarke. Newly imprinted and enlarged to almost as much againe as it was, according to the true and perfect {C}oppie [The ``Second Quarto'']},
  publisher =    {Nicholas Ling},
  Year =         {1604}
}
\end{filecontents}
\usepackage[paperwidth=20.3cm,paperheight=27.2cm]{geometry}% committed to this
\usepackage{libertine}% pretty, I think
\usepackage{ifxetex}% be flexible when compiling
\ifxetex
  \usepackage{fontspec}
  \defaultfontfeatures{Ligatures={TeX}}
\else
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage{lmodern} 
\fi
\usepackage[english]{babel}% I also use French
\usepackage[babel]{csquotes}% pass babel to csquotes
\usepackage{epigraph}
\setlength{\epigraphwidth}{8cm}
\usepackage{hyperref}
\usepackage[backend = biber, 
            style = authoryear,
            bibencoding = utf8,
            language = english,
            url = true]{biblatex}
\addbibresource{biblio.bib}
\usepackage{verbatim}% provides !verb||! command and comment environment
\usepackage{listings}% provides lstlisting command
\usepackage[usenames,dvipsnames,svgnames]{xcolor}% to paint a background color
\lstset{%
  language=[LaTeX]TeX,
  backgroundcolor=\color{gray!10}, % package xcolor needed
  frameround=ffff,
  frame=single,
  rulecolor=\color{NavyBlue},
  keywordstyle=\color{RoyalBlue},
  basicstyle=\scriptsize\ttfamily,
  stringstyle=\ttfamily,
  showstringspaces=false,
  breaklines=true,
  columns=fullflexible,
  tabsize=2,
  keepspaces
}

\setlength\parindent{0pt}
\usepackage{parskip}

\begin{document}

\chapter{Questions Princes Ask}

\epigraph{To be or not to be, that is the Question}{William Shakespeare (Hamlet, 1623)}

I have a book project that will be peppered with citations, as epigraphs to chapters and in the body of the text. I plan to have an index of the citations with proper reference to the source. Some citations will be extracted from articles or books, while others will be indirect quotes from newspaper accounts or transcripted from audio or video sources, some may even be apocryphal (and reported as such). I wish to have the detailed source of the citation relegated to an appendix, much like a bibliography, while keeping a short reference to the source next to it in the body of the text. 

In the appendix, the citation would be listed much like books are in a bibliography, with the ability to control the formatting for each element: italics, bold, style for quote marks, parskip, indent, etc.. In addition, the actual bibliographic reference would also be quoted. Perhaps there already is a package designed for this? If not, I will be happy for a quick and dirty hack.

What I have in mind is cloning the bibliography environment and modifying the names, e.g. change \texttt{@Article} to \texttt{@Quotesource}, change \texttt{title} to \texttt{text}, etc. and where the display styles would be modified to suit my need. I suspect that if I attempt this hacking, I will soon run into bugs, so if something like this already exists, that would be better.  

\newpage
The \texttt{.bib} equivalent would be filled with citations entry like the following:
\begin{lstlisting}
\@Quotesource{Shakespeare:2bNot:Folio1,
  text =                        {To be or not to be, that is the {Q}uestion},
  author =                  {William Shakespeare},
  bio =                         {William Shakespeare (26 April 1564 [baptised] – 23 April 1616) was an English poet, playwright, and actor, widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist.},
  hour =                        {}, % empty in this example
  day =                         {}, % empty in this example
  month =                   {}, % empty in this example
  year =                        {circa 1603},
  century =                 {XVII},
  language =                {English},
  country =                 {England},
  type =                        {written, published, dated}, % as opposed to e.g. 'oral tradition, undated'
  status =                  {Several written sources exist, all consistent with William Shakespeare being the source.}, % as opposed to e.g. 'apocryphal' or 'doubtful'
  context =                 {The opening phrase of a soliloquy in the "Nunnery Scene" of William Shakespeare's play Hamlet.},
  description =         {In the speech, a despondent Prince Hamlet contemplates death and suicide while waiting for Ophelia, the love of his life. He bemoans the pains and unfairness of life but acknowledges the alternative might be still worse.},
  significance =        {One of the most widely known and quoted lines in modern English, and the soliloquy has been referenced in innumerable works of theatre, literature and music.},
  variant =                 {Shakespeare:2bNot:Quarto1, Shakespeare:2bNot:Quarto2},
  bibref =                  {Shakespeare:Hamlet:Folio1}% label in the .bib file
}

\@Quotevariant{Shakespeare:2bNot:Quarto1
  text = {To be, or not to be, that is the question},
  year = {1603}, % overwrites year given in \@Quotesource, other info unchanged
  bibref = {Shakespeare:Hamlet:Quarto1}% reference to label in the .bib file
}

\@Quotevariant{Shakespeare:2bNot:Quarto2
  text = {To be, or not to be, I there's the point},
  year = {1604}, % overwrites year given in \@Quotesource, other info unchanged
  bibref = {Shakespeare:Hamlet:Quarto2}% reference to label in the .bib file
}

\end{lstlisting}

\newpage
In the .bib file, I would have a standard bibliographic entry like:

\begin{lstlisting}

\@Book{Shakespeare:Hamlet:Folio1,
  author =       {William Shakespeare},
  title =        {Mr. {W}illiam {S}hakespeares Comedies, Histories, \& Tragedies: Published According to the True Originall Copies [The ``First Folio'']},
  publisher =    {Isaac Jaggard and Ed Blount},
  Year =         {1623}
}

\@Book{Shakespeare:Hamlet:Quarto1,
  author =       {William Shakespeare},
  title =        {The {T}ragicall {H}istorie of {H}amlet {P}rince of {D}enmarke. As it hath beene diuerse times acted by his {H}ighnesse seruants in the {C}ittie of {L}ondon : as also in the two {V}niuersities of {C}ambridge and {O}xford, and else-where [The ``First Quarto'']},
  publisher =    {Nicholas Ling \& J. Trundell (London)},
  Year =         {1603}
}

\@Book{Shakespeare:Hamlet:Quarto2,
  author =       {William Shakespeare},
  title =        {The {T}ragicall {Historie} of Hamlet, {P}rince of {D}enmarke. Newly imprinted and enlarged to almost as much againe as it was, according to the true and perfect {C}oppie [The ``Second Quarto'']},
  publisher =    {Nicholas Ling},
  Year =         {1604}
}

\end{lstlisting}

\newpage
In the body of the latex file, something like this:
\begin{lstlisting}
\begin{document}

\quote[titleyear,parencite]{Shakespeare:2bNot:Folio1} is more than just a cool quote.

\appendix

\nocite{Shakespeare:2bNot:Quarto1}% list the citation in appendix
\nocite{Shakespeare:2bNot:Quarto2}% even though it's not quoted in the text

\printquote[author, text, bio, century, type, status, context, significance,  variant]{Shakespeare:2bNot}


\end{document}
\end{lstlisting}

The expected output would be something like this:

\bigskip
``To be or not to be'' (Hamlet, 1623) is more than just a cool quote. 

\bigskip
where the citations would be listed in the appendix in a separate section. Below I fake the desired output with some hard-coding.

\newpage
\section*{Citations}
\nocite{Shakespeare:Hamlet:Quarto1}
\nocite{Shakespeare:Hamlet:Quarto2}

\textbf{[1]} William Shakespeare. \textit{To be or not to be, that is the Question}. 
\begin{quote}
\textbf{Author}: William Shakespeare (26 April 1564 [baptised] – 23 April 1616) was an English poet, playwright, and actor, widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist.

\textbf{Century}: XVII. 

\textbf{Status}: written, published, dated. 

\textbf{Context}: The opening phrase of a soliloquy in the ``Nunnery Scene'' of William Shakespeare's play Hamlet. 

\textbf{Description}: In the speech, a despondent Prince Hamlet contemplates death and suicide while waiting for Ophelia, the love of his life. He bemoans the pains and unfairness of life but acknowledges the alternative might be still worse. 

\textbf{Significance}: One of the most widely known and quoted lines in modern English, and the soliloquy has been referenced in innumerable works of theatre, literature and music. 

\textbf{Variant}: Shakespeare, \textit{The First Quarto} (1603), Shakespeare, \textit{The Second Quarto} (1604).
\end{quote}

\textbf{[2]} William Shakespeare. \textit{To be or not to be, I there's the point}. 
\begin{quote}
\textbf{Variant of}: \textbf{[1]}, \textbf{[3]}.
\end{quote}

\textbf{[3]} William Shakespeare. \textit{To be or not to be,  that is the question}. 
\begin{quote}
\textbf{Variant of}: \textbf{[1]}, \textbf{[2]}.
\end{quote}


\bigskip\bigskip

with, naturally, some flexibility in defining styles. 

[The empty page that follows is unexpected] 

\printbibliography


\end{document}

答案1

这不是直接的答案,而是指向解决方案的可能路径的指针。去年,我为一个图书目录开发了一种 BibTeX 样式,bookdb.bst这涉及扩展常规 BibTeX 文件之一。运行texdoc bookdb以查看用户手册,如果您想要了解内部细节,可以阅读bookdb.bst。用户手册没有描述内部代码,但下一期 TUGboat 中会有一篇关于此内容的文章。祝你好运。

相关内容