我正在写一份包含大量参考书目的提案。我希望以粗体格式引用我自己的论文,以普通格式引用其他论文,例如 [2,11-13,14,15]。有什么办法吗?目前,我必须这样做 [2,11-13,15][14],但这很丑。之前回答过一个相关问题(粗体引用编号),但全部引用加粗,这是我不想要的。
我在文档末尾使用 \bibitem。
\documentclass{article}
\usepackage{cite}
\begin{document}
Some text where I cite papers of which I have written one~\cite{refA, refB, refC,
refD}\textbf{\cite{myPaper}}; I have to cite them in this awkward form.
Instead I would like the citation to appear like [1-3,{\textbf 4},5]. No way to do
that with the \texttt{$\backslash$cite} command?
\begin{thebibliography}{}
\bibitem{refA}
RefA
\bibitem{refB}
RefB
\bibitem{refC}
RefC
\bibitem{myPaper}
My Paper; I have written this one.
\bibitem{refD}
RefD
\end{thebibliography}
\end{document}
答案1
这是问题的部分解决方案,它太长且格式太复杂,不适合作为注释。部分解决方案是因为它具有以下缺点和不理想的输出格式:
\bibitem
应替换为 ,\mybibitem
以便将引用数设置为粗体。(这是一个缺点,因为latex-bibitemstyler
Günter 在评论中提到的程序可能不再起作用。但是,很可能可以使用 进行替换sed
)- 粗体参考编号优先
- 粗体参考编号未排序
- 粗体参考数字未压缩
后三种效果可以在下图中看到。
话虽如此。这是我的定义\mybibitem
:
\newcommand{\mybibitem}[1]{\stepcounter{enumiv} \bibitem[\textbf{\arabic{enumiv}}]{#1}}
为了完整性,生成上述示例的完整代码如下:
\documentclass{article}
\usepackage{cite}
\newcommand{\mybibitem}[1]{\stepcounter{enumiv} \bibitem[\textbf{\arabic{enumiv}}]{#1}}
\begin{document}
Bold reference numbers come first: \cite{refA, refB, refI, refD}
Bold papers are not compressed: \cite{refD, refE, refF}
Bold reference numbers are not sorted: \cite{refF, refD, refE}
Combination of mentioned effects: \cite{refA, refF, refH, refD, refE, refB, refC, refG, refI}
\begin{thebibliography}{}
\bibitem{refA} RefA
\bibitem{refB} RefB
\bibitem{refC} RefC
\mybibitem{refD} RefD
\mybibitem{refE} RefE
\mybibitem{refF} RefF
\bibitem{refG} RefG
\bibitem{refH} RefH
\bibitem{refI} RefI
\end{thebibliography}
\end{document}
答案2
另一个解决该问题的方法是在最近开发的嗜酒TeX/LaTeX 的书目处理器。为此,我们可以定义生成引文标签的函数,并确保每当参考文献包含“de Broglie”作为作者时,该标签都会显示为粗体。因此,对于以下文件
主目录
@Article{refA,
title = {Can quantum-mechanical description of physical reality be considered complete?},
author = {A. Einstein and B. Podolsky and N. Rosen},
journal = {Phys.\ Rev.},
volume = {47},
year = {1935},
pages = {777--780}
}
@Book{refB,
title = {Probability Theory: The Logic of Science},
year = {2003},
author = {E. T. Jaynes},
publisher = {Cambridge University Press}
}
@Incollection{refC,
title = {On the present status of the radiation problem},
author = {Albert Einstein},
booktitle = {The Collected Papers of Albert Einstein},
publisher = {Princeton University Press},
year = {1989},
pages = {357--375},
volume = {2}
}
@Mastersthesis{refD,
title = {Optical aberration coefficients},
author = {Matthew Peter Rimmer},
school = {University of Rochester},
year = {1963}
}
@Phdthesis{refBOLD,
title = {On the theory of quanta},
author = {Louis-Victor de Broglie},
school = {University of Paris},
year = {1925}
}
主文件
TEMPLATES:
article = <au>, \enquote{<title>,} \textit{<journal>} \textbf{<volume>},{ }...
[<startpage>--<endpage>|<startpage>|<eid>|] (<year>).
book = <au>, \textit{<title>} (<publisher>, <year>).
incollection = <au>, \enquote{<title>,} in \textit{<booktitle>}, [Chap.~<chapter>, ]...
[pp.~<startpage>--<endpage>|p.~<startpage>|<eid>|] (<publisher>, <year>).
mastersthesis = <au>, \enquote{<title>,} M.S. dissertation (<school>, <year>).
phdthesis = <au>, \enquote{<title>,} Ph.D. dissertation (<school>, <year>).
SPECIAL-TEMPLATES:
authorlist = <author.to_namelist()>
editorlist = <editor.to_namelist()>
au = <authorlist.format_authorlist()>
ed = <editorlist.format_editorlist()>
OPTIONS:
allow_scripts = True ## whether to allow user scripts in BST files
VARIABLES:
citelabel = create_citelabel(entry, options)
DEFINITIONS:
def create_citelabel(entry, options):
numnames = len(entry['authorlist'])
if (numnames == 0): return(entry['citenum'])
foundit = False
for name in entry['authorlist']:
if (name['last'] == 'Broglie') and (name['prefix'] == 'de'):
foundit = True
break
if foundit:
return(r'\textbf{' + entry['citenum'] + '}')
else:
return(entry['citenum'])
主文本
\documentclass{article}
\usepackage{cite}
\begin{document}
Some text where I cite papers, where I want to highlight all publications
by de Broglie~\cite{refA, refB, refC, refBOLD, refD}. It would be nice for
the citations to to appear sorted like [1-3,{\textbf 4},5].
\bibliography{main}
\bibliographystyle{main}
\end{document}
我们可以得到格式化的结果:
此结果存在 @crixtox 提到的相同问题:粗体数字未正确排序或压缩。执行这些操作需要更改包cite
以适应格式。另一方面,压缩粗体引用也会删除 OP 正在寻找的一个功能:突出显示某些参考文献。让粗体引用始终出现在列表中的第一个当然是突出显示它的另一种方法,尽管这可能与许多出版商的要求相矛盾。