我想要的是: 参考书目中我自己的作品的风格不同
我做了什么:创建参考书目条目,mywork
并且myworkimp
:更新时已删除:请查看下文。
我没能做到的是:这些条目将以不同的样式(粗体或棕色等)打印。
更新
在阅读了 Tex.SE 中的其他几条评论(@samcarter 除外)后,我决定改用biblatex
。这是新的 MWE:
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
%%%%%% This was my pre-PhD work. I will only cite it, but not put in to contribution part.
%%%%%% This will be printed in Bibliography in Brown
@mywork{myfirst,
author = "Myself Me",
title = "Very good name",
year = "2016",
publisher = "N/A",
address = "Earth"
}
%%%%%% This is my current work and will be in contribution part.
%%%%%% This will be printed in Bibliography in Bold font
@myworkimp{mysecond,
author = "Myself Me",
title = "No Name yet!",
year = "2018",
publisher = "N/A",
address = "Earth",
}
\end{filecontents}
%%\usepackage[square, numbers, comma, sort&compress, ]{natbib} %sectionbib
\usepackage[firstinits=true,bibencoding=inputenc,hyperref=auto,refsection=chapter,backref=true,backend=biber, defernumbers=true,style=alphabetic,sorting=ynt]{biblatex}
\bibliography{\jobname}
\usepackage[colorlinks]{hyperref}
\begin{document}
Dolor sit amet \autocite{myfirst}
Lor waht \autocite{mysecond}
\printbibliography[heading=bibnumbered]
\end{document}
感谢您的帮助!
答案1
感谢 moewe 提供的有用评论,以改进这个答案!
如果您想保持语法@mywork
不变,可以快速破解一下,\DeclareBibliographyDriver
为这些类型声明特殊。缺点:您失去了区分自己作品中不同类型文档的能力,在下面的例子中,我简单地book
为它们两者选择了一种(请更改为适合您作品的类型)。如果您需要区分不同类型的能力,例如,可以为自己的文档添加一个特殊关键字,请参阅下面的第二种解决方案。
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
%%%%%% This was my pre-PhD work. I will only cite it, but not put in to contribution part.
%%%%%% This will be printed in Bibliography in Brown
@mywork{myfirst,
author = "Myself Me",
title = "Very good name",
year = "2016",
publisher = "N/A",
address = "Earth"
}
%%%%%% This is my current work and will be in contribution part.
%%%%%% This will be printed in Bibliography in Bold font
@myworkimp{mysecond,
author = "Myself Me",
title = "No Name yet!",
year = "2018",
publisher = "N/A",
address = "Earth",
}
\end{filecontents}
%%\usepackage[square, numbers, comma, sort&compress, ]{natbib} %sectionbib
\usepackage[giveninits=true,bibencoding=inputenc,hyperref=auto,refsection=chapter,backref=true,backend=biber, defernumbers=true,style=alphabetic,sorting=ynt]{biblatex}
\usepackage[colorlinks]{hyperref}
\usepackage{xcolor}
\DeclareBibliographyAlias{mywork}{customa}
\DeclareBibliographyDriver{customa}{%
\usedriver{\color{brown}}{book}%
}
\DeclareBibliographyAlias{myworkimp}{customb}
\DeclareBibliographyDriver{customb}{%
\usedriver{\bfseries}{book}%
}
\bibliography{\jobname}
\begin{document}
Dolor sit amet \autocite{myfirst}
Lor waht \autocite{mysecond}
\printbibliography[heading=bibnumbered]
\end{document}
使用关键字的第二种解决方案
优点:你可以将自己的作品分为不同类型,例如mywork
文章、论文集和myworkimp
书籍。
\documentclass{book}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
%%%%%% This was my pre-PhD work. I will only cite it, but not put in to contribution part.
%%%%%% This will be printed in Bibliography in Brown
@book{myfirst,
author = "Myself Me",
title = "Very good name",
year = "2016",
publisher = "N/A",
address = "Earth",
keywords = "mywork"
}
%%%%%% This is my current work and will be in contribution part.
%%%%%% This will be printed in Bibliography in Bold font
@article{mysecond,
author = "Myself Me",
title = "No Name yet!",
year = "2018",
publisher = "N/A",
address = "Earth",
keywords = "myworkimp"
}
\end{filecontents*}
%%\usepackage[square, numbers, comma, sort&compress, ]{natbib} %sectionbib
\usepackage[giveninits=true,bibencoding=inputenc,hyperref=auto,refsection=chapter,backref=true,backend=biber, defernumbers=true,style=alphabetic,sorting=ynt]{biblatex}
\usepackage[colorlinks]{hyperref}
\usepackage{xcolor}
\renewbibmacro*{begentry}{%
\iffieldequalstr{keywords}{mywork}{\color{brown}}{}%
\iffieldequalstr{keywords}{myworkimp}{\bfseries}{}%
}
\bibliography{\jobname}
\begin{document}
Dolor sit amet \autocite{myfirst}
Lor waht \autocite{mysecond}
\printbibliography[heading=bibnumbered]
\end{document}