Biblatex:(齐平)右边距中的 pagebackref 引用:请后续帮助

Biblatex:(齐平)右边距中的 pagebackref 引用:请后续帮助

在我开始之前,如果这不是如何跟进问题的话,我深表歉意。

首先,请阅读此帖子的答案,其中详细说明了我想要完成的操作,即刷新右侧的 backref(使用 biblatex 和 backref 选项),以及此处边距之外的内容:

Biblatex:(齐平)右边距中的 pagebackref 引用

现在我真的很喜欢这段代码,因为我认为它看起来很漂亮,很干净,并且可以很好地链接反向引用。但是,当引用一直到末尾时,就会出现问题。反向引用链接会移动到新行,这显然是我不希望的。有没有乳胶专家知道如何解决这个问题?

参见下图。

在此处输入图片描述

这是我粘贴到论文中的代码:

\renewbibmacro*{pageref}{%
   \iflistundef{pageref}
     {\renewcommand{\finentrypunct}{\addperiod}}
     {\renewcommand{\finentrypunct}{\addspace}%
      \printtext{\addperiod\hfill\rlap{\hskip15pt\colorbox{blue!5}{\scriptsize\printlist[pageref][-\value{listtotal}]{pageref}}}}}}

任何帮助都将不胜感激!

编辑:这是 MWE 显示的错误

\documentclass{article}
\usepackage{times}
\usepackage{csquotes}
\usepackage{xcolor}
\pagecolor{white} %renders latex PDF in white background
\usepackage[style=numeric-comp,backref=true,backend=biber]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{RN283,
   author = {Sparkes, R. S. and Simon, M. and Cohn, V. H. and Fournier, R. E. and Lem, J. and Klisak, I. and Heinzmann, C. and Blatt, C. and Lucero, M. and Mohandas, T.},
   title = {Assignment of the human and mouse prion protein genes to homologous chromosomes},
   journal = {Proceedings of the National Academy of Sciences},
   volume = {83},
   number = {19},
   pages = {7358},
   DOI = {10.1073/pnas.83.19.7358},
   url = {http://www.pnas.org/content/83/19/7358.abstract},
   year = {1986},
   type = {Journal Article}
}

@article{RN210,
   author = {Stahl, Neil and Borchelt, David R. and Hsiao, Karen and Prusiner, Stanley B.},
   title = {Scrapie prion protein contains a phosphatidylinositol glycolipid},
   journal = {Cell},
   volume = {51},
   number = {2},
   pages = {229-240},
   ISSN = {0092-8674},
   DOI = {https://doi.org/10.1016/0092-8674(87)90150-4},
   url = {http://www.sciencedirect.com/science/article/pii/0092867487901504},
   year = {1987},
   type = {Journal Article}
}
\end{filecontents}

\addbibresource{\jobname.bib}

% pagereference in the right margin
\renewbibmacro*{pageref}{%
   \iflistundef{pageref}
     {\renewcommand{\finentrypunct}{\addperiod}}
     {\renewcommand{\finentrypunct}{\addspace}%
      \printtext{\addperiod\hfill\rlap{\hskip15pt\colorbox{blue!5}{\scriptsize\printlist[pageref][-\value{listtotal}]{pageref}}}}}}

\begin{document}
Example citation \cite{RN283, RN210}
\printbibliography
\end{document}

在此处输入图片描述

答案1

我喜欢用以下方法在空白处书写埃格尔回答在文本左侧添加标记

在这里,我认为将 backref 放在条目的第一行而不是最后一行会更令人满意,所以我们将其挂入begentry。无论如何,我们需要小心标点符号跟踪器,以避免在某些地方出现不必要的标点符号。

\documentclass{article}
\usepackage{times}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage[backend=biber, style=numeric-comp, backref=true,]{biblatex}
\usepackage[colorlinks]{hyperref}

\newlength{\marginwritesep}
\setlength{\marginwritesep}{1em}

% based on egreg's (https://tex.stackexchange.com/users/4427/egreg)
% answer to https://tex.stackexchange.com/a/123451/35864
% originally CC BY-SA 3.0, but dual-licensed under LPPL
% see https://tex.meta.stackexchange.com/a/3333/35864
\newcommand{\marginwrite}[1]{%
  \strut\vadjust{%
    \vbox to 0pt{%
      \kern-\the\dimexpr\ht\strutbox+\dp\strutbox\relax
        \hfill\rlap{\kern\marginwritesep
          #1}%
      \vss
    }%
  }%
}

\renewbibmacro*{pageref}{}

\makeatletter
\renewbibmacro*{begentry}{%
  \iflistundef{pageref}
    {}
    {\marginwrite{%
       \colorbox{blue!5}{%
         \scriptsize\raggedright
         \printlist[pageref][-\value{listtotal}]{pageref}}}%
     \blx@initunit}}
\makeatother

\begin{filecontents}{\jobname.bib}
@article{RN283,
  author  = {Sparkes, R. S. and Simon, M. and Cohn, V. H.
             and Fournier, R. E. and Lem, J. and Klisak, I.
             and Heinzmann, C. and Blatt, C. and Lucero, M. and Mohandas, T.},
  title   = {Assignment of the human and mouse prion protein genes to homologous chromosomes},
  journal = {Proceedings of the National Academy of Sciences},
  volume  = {83},
  number  = {19},
  pages   = {7358},
  DOI     = {10.1073/pnas.83.19.7358},
  url     = {http://www.pnas.org/content/83/19/7358.abstract},
  year    = {1986},
  type    = {Journal Article}
}
@article{RN210,
  author  = {Stahl, Neil and Borchelt, David R. and Hsiao, Karen and Prusiner, Stanley B.},
  title   = {Scrapie prion protein contains a phosphatidylinositol glycolipid},
  journal = {Cell},
  volume  = {51},
  number  = {2},
  pages   = {229-240},
  ISSN    = {0092-8674},
  DOI     = {https://doi.org/10.1016/0092-8674(87)90150-4},
  url     = {http://www.sciencedirect.com/science/article/pii/0092867487901504},
  year    = {1987},
  type    = {Journal Article}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Example citation \cite{RN283, RN210}
\printbibliography
\end{document}

第一行条目上的 Backref 框。

也可以看看Biblatex:页边距中的页后引用之间的换行符

请注意,该doi字段应仅包含 DOI 本身,而不包含链接位https://doi.org/http://dx.doi.org/。因此DOI = {https://doi.org/10.1016/0092-8674(87)90150-4},应更改为

DOI = {10.1016/0092-8674(87)90150-4},

但是我在 MWE 中没有这样做,因为我们需要像以前一样排列线路。

相关内容