使用带有 bibtex 后端的 biblatex 删除数字并在参考书目中添加缩进

使用带有 bibtex 后端的 biblatex 删除数字并在参考书目中添加缩进

我想从参考书目中删除数字标签,因为我在文档中使用了(作者、年份)。我设法删除了数字,但现在我想缩进第二行(可能还有更多行),以使参考书目更易于阅读。

我尝试了以下代码片段这个帖子,但不起作用。我认为这些是针对不同包的设置,而不是我特定使用的 biblatex/natbib/bibtex。

\makeatletter
\let\old@biblabel\@biblabel
\def\@biblabel#1{\old@biblabel{#1}\kern\bibindent}
\let\old@bibitem\bibitem
\def\bibitem#1{\old@bibitem{#1}\leavevmode\kern-\bibindent}
\makeatother

麦格维:

\documentclass[journal, a4paper, 10pt]{IEEEtran}

\usepackage[
  backend=bibtex,
  style=nature,   
  citestyle=authoryear-comp, %authoryear, 
  natbib=true,
  doi=false,
  isbn=false,
  url=false,
]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{MyLibrary.bib}
  @article{greenwade93,
      author  = "George D. Greenwade",
      title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
      year    = "1993",
      journal = "TUGBoat",
      volume  = "14",
      number  = "3",
      pages   = "342--351"
  }
  @book{goossens93,
      author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
      title     = "The LaTeX Companion",
      year      = "1993",
      publisher = "Addison-Wesley",
      address   = "Reading, Massachusetts"
  }
\end{filecontents}

% add bib resource
\addbibresource{IEEEabrv}
\addbibresource{MyLibrary}

% remove numbers
\DeclareFieldFormat{labelnumberwidth}{}
\setlength{\biblabelsep}{0pt}

\begin{document}

\section{Test}
This is some test text. \citet{greenwade93} wrote a very interesting paper. Some other sentence with a different reference \citep{goossens93}. 

\printbibliography

\end{document}

在此处输入图片描述

答案1

如果您正在使用,citestyle=authoryear-comp,您应该选择匹配的authoryear-family 书目样式,但目前您已经拥有了style=nature,为您提供numeric书目样式的样式。

从...来

  style=nature,
  citestyle=authoryear-comp,

  style=authoryear-comp,

平均能量损失

\documentclass[journal, a4paper, 10pt]{IEEEtran}

\usepackage[
  backend=biber,
  style=authoryear-comp,
  natbib=true,
  doi=false,
  isbn=false,
  url=false,
]{biblatex}

\addbibresource{biblatex-examples.bib}


\begin{document}
This is some test text. \citet{sigfridsson} wrote a very interesting paper.
Some other sentence with a different reference \citep{worman}. 

\printbibliography
\end{document}

未编号的参考书目

您还应该考虑从 切换backend=bibtex,backend=biber,。只有使用 Biber,您才能使用 的所有biblatex功能。只需更改backend选项值并运行 Biber 而不是 BibTeX(请参阅Biblatex 与 Biber:配置我的编辑器以避免未定义的引用寻求帮助)。


如果你一定要坚持

  style=nature,
  citestyle=authoryear-comp,

通过参考书目环境删除编号。

\documentclass[journal, a4paper, 10pt]{IEEEtran}

\usepackage[
  backend=biber,
  style=numeric,
  citestyle=authoryear-comp,
  natbib=true,
  doi=false,
  isbn=false,
  url=false,
]{biblatex}

\defbibenvironment{bibliography}
  {\list
     {}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item}

\addbibresource{biblatex-examples.bib}


\begin{document}
This is some test text. \citet{sigfridsson} wrote a very interesting paper.
Some other sentence with a different reference \citep{worman}. 

\printbibliography
\end{document}

但请引用\cite{knuth:ct:b,knuth:ct:c}来看看为什么这是一个坏主意。

答案2

\appto使用包中的宏etoolbox,我在文本开头添加了一些负水平空间,之后\item用于设置参考书目条目。为了不影响文档中的其他列表,我将其包装在 中\AtBeginBibliography

完整示例:

\documentclass[journal, a4paper, 10pt]{IEEEtran}

\usepackage[
  backend=bibtex,
  style=nature,   
  citestyle=authoryear-comp, %authoryear, 
  natbib=true,
  doi=false,
  isbn=false,
  url=false,
]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{MyLibrary.bib}
  @article{greenwade93,
      author  = "George D. Greenwade",
      title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
      year    = "1993",
      journal = "TUGBoat",
      volume  = "14",
      number  = "3",
      pages   = "342--351"
  }
  @book{goossens93,
      author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
      title     = "The LaTeX Companion",
      year      = "1993",
      publisher = "Addison-Wesley",
      address   = "Reading, Massachusetts"
  }
\end{filecontents}

% add bib resource
\addbibresource{IEEEabrv}
\addbibresource{MyLibrary}

% remove numbers
\DeclareFieldFormat{labelnumberwidth}{}
\setlength{\biblabelsep}{0.5cm}

% add hanging indent
\usepackage{etoolbox}
\AtBeginBibliography{\appto\item{\hspace*{-\biblabelsep}}}

\begin{document}

\section{Test}
This is some test text. \citet{greenwade93} wrote a very interesting paper. Some other sentence with a different reference \citep{goossens93}.

\printbibliography

\end{document}

在此处输入图片描述

相关内容