带下划线的 doi 和 rsc 软件包

带下划线的 doi 和 rsc 软件包

我希望使用 RSC 包为我的 DOI 加下划线,如果可能的话,只为 DOI 加下划线,例如调整 DOI 功能而不是超链接。这里建议的解决方案“使用 natbib 和 abbrvnat 样式为 doi 条目添加下划线“即使它加载了 natbib,它也适用于 RSC 包。有什么想法吗?

注意:我已经加载了与我正在使用的参考书目相关的每个包和选项,甚至那些多余的。

\documentclass[10pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{filecontents}

\usepackage[linktoc=all,hidelinks,bookmarksnumbered,pagebackref,xetex]{hyperref}
\PassOptionsToPackage{sort&compress,square,numbers}{natbib}
\usepackage[usedoi,linkdoi,super=false]{rsc}

% \usepackage[normalem]{ulem}% \uline
% \newcommand{\doi}[1]{doi: \uline{#1}}

\begin{filecontents}{biblio_test.bib}

@Article{hung2010practical,
  Title                    = {On the practical aspects of recording wideline QCPMG NMR spectra},
  Author                   = {Hung, Ivan and Gan, Zhehong},
  Journal                  = {J. Magn. Reson.},
  Year                     = {2010},
  Number                   = {2},
  Pages                    = {256--265},
  Volume                   = {204},

  Doi                      = {10.1016/j.jmr.2010.03.001},
  File                     = {:Publications\\1-s2.0-S1090780710000571-main.pdf:PDF},
  Owner                    = {Henri},
  Publisher                = {Elsevier},
  Timestamp                = {2015.09.03}
}

\end{filecontents}


\begin{document}
Some text.\cite{hung2010practical}

\bibliographystyle{rsc}
\bibliography{biblio_test}

    \end{document}

答案1

由于rsc.bst没有定义专用的 DOI 宏,我们需要自己添加。

rsc.bst其复制到 LaTeX 可以找到的位置,然后将其重命名为,例如,rsc-hcn.bst

打开rsc-hcn.bst并找到FUNCTION {format.doi} 替换为

FUNCTION {format.doi}
{ use.doi.all
    { doi empty$
        'skip$
        {
          link.doi
            {
              "\href{http://dx.doi.org/"
              doi *
              "}{" *
              bbl.doi * " \doiformat{" * doi * 
              "}}" *
            }
            { bbl.doi doi tie.or.space.connect }
          if$
          output
        }
      if$
    }
    'skip$
  if$
}

如果您希望“DOI:”前缀保留在 DOI 中,则可以使用bbl.doi * "~\doiformat{" * doi *

在您的文档中\doiformat按需要定义。

\newcommand*\doiformat[1]{\uline{#1}}

平均能量损失

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{filecontents}

\usepackage[linktoc=all,hidelinks,bookmarksnumbered,pagebackref]{hyperref}
\PassOptionsToPackage{sort&compress,square,numbers}{natbib}
\usepackage[usedoi,linkdoi,super=false]{rsc}

\usepackage[normalem]{ulem}% \uline
%\usepackage{soul}
\newcommand*\doiformat[1]{\uline{#1}}% or \ul from soul
\begin{filecontents}{\jobname.bib}

@Article{hung2010practical,
  Title                    = {On the practical aspects of recording wideline QCPMG NMR spectra},
  Author                   = {Hung, Ivan and Gan, Zhehong},
  Journal                  = {J. Magn. Reson.},
  Year                     = {2010},
  Number                   = {2},
  Pages                    = {256--265},
  Volume                   = {204},
  Doi                      = {10.1016/j.jmr.2010.03.001},
}
\end{filecontents}

\begin{document}
Some text.\cite{hung2010practical}

\bibliographystyle{rsc-hcn}
\bibliography{\jobname}
\end{document}

在此处输入图片描述


您也可以使用biblatex

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{filecontents}
\usepackage[style=chem-rsc,doi=true]{biblatex}
\usepackage{hyperref}
\usepackage{soul}
\newcommand*\doiformat[1]{\ul{#1}}
\DeclareFieldFormat{doi}{%
  \mkbibacro{DOI}\addcolon\space
  \ifhyperref
    {\href{http://dx.doi.org/#1}{\doiformat{#1}}}
    {\doiformat{#1}}}

\begin{filecontents}{\jobname.bib}

@Article{hung2010practical,
  Title                    = {On the practical aspects of recording wideline QCPMG NMR spectra},
  Author                   = {Hung, Ivan and Gan, Zhehong},
  Journal                  = {J. Magn. Reson.},
  Year                     = {2010},
  Number                   = {2},
  Pages                    = {256--265},
  Volume                   = {204},
  Doi                      = {10.1016/j.jmr.2010.03.001},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
Some text.\cite{hung2010practical}

\printbibliography
\end{document}

相关内容