如何将文内 DOI 引用放在框中以减少 beamer 文档类中的空间?

如何将文内 DOI 引用放在框中以减少 beamer 文档类中的空间?

\citedoi{}我已经基于 的命令创建了一个自定义命令biblatex,该\citeurl{}命令运行良好。然后,我可以将 放在\citedoi{}框内,靠近图像或其他需要引用但不在文本中的内容。我尝试创建一个parbox包含doi文本的框,以便它占用最少的空间(字体大小为\tiny,并且它在一行中占用了太多空间,如图像中所示)。我想将 放在doi框内,覆盖两\tiny行,这样可以减少前后单词之间的空间。

这样做的动机是,我的博士生导师喜欢doi在演示幻灯片末尾的参考书目之外,在最接近的位置加上 。我创建了一个用于注释目的的命令,但在文本中使用时\scitedoi{}失败了:\itcitedoi{}

\newcommand\scitedoi[1]{{\color{blue}\tiny\citedoi{#1}}}
\newcommand\itcitedoi[1]{\parbox{1.5cm}{\color{blue}\tiny\citedoi{#1}}}

仅使用框架时\scitedoi{}如下beamer所示:

doi 当前的样子

当使用该\itcitedoi{}命令时,它会进入边缘:

parbox 尝试

理想情况下,我希望将\itcitedoi{}命令视为文本(如果这样说有道理的话?),并让文本围绕命令,就像通常的单词一样。我知道文本,即使是\tiny,也会增加使用的行之间的间隙,但这没问题。

有人知道我怎样才能将其放入一个跨越并包裹超过两行\citedoi{}的框内,或者使用任何类似的东西吗?doi\tinyparbox

梅威瑟:

\begin{filecontents}[overwrite]{ref.bib}
@Article{M2020,
  author = {Mehandia, Seema and Sharma, S. C. and Arya, Shailendra Kumar},
  journal = {Biotechnol. Rep. (Amst)},
  title = {Isolation and characterization of an alkali and thermostable laccase},
  doi = {10.1016/j.btre.2019.e00413},
}
@Article{Mn2009,
  author = {Murugesan, Kumarasamy and Kim, Young-Mo and Jeon, Jong-Rok and Chang, Yoon-Seok},
  journal = {J Hazard Mater.},
  title = {Effect of metal ions on reactive dye decolorization by laccase from Ganoderma lucidum.},
  doi = {10.1016/j.jhazmat.2009.02.075},
}
\end{filecontents}

\documentclass[hyperref={colorlinks=false}]{beamer}

\usepackage[backend=biber, style=numeric]{biblatex}
\usepackage{xurl}

\addbibresource{ref.bib}

% Custom \citedoi command adapted from \citeurl
\DeclareFieldFormat{citedoi}{\href{https://doi.org/#1}{#1}}

\DeclareCiteCommand{\citedoi}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield[citedoi]{doi}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\newcommand\scitedoi[1]{{\color{blue}\tiny\citedoi{#1}}}

\newcommand\itcitedoi[1]{\parbox{1.5cm}{\color{blue}\tiny\citedoi{#1}}}

\begin{document}

\begin{frame}
\frametitle{Unreproducible}
This text is just text and nothing more as I just need filler text \scitedoi{M2020} that spans a few lines on 
this beamer presentation. This text is just text and nothing more \itcitedoi{Mn2009} as I just need filler text 
that spans a few lines on this beamer presentation. This text is just text and nothing more as I just need filler 
text that spans a few lines on this beamer presentation. 
\end{frame}

\begin{frame}
\printbibliography
\end{frame}

\end{document}

我正在编译:

% arara: pdflatex: {options: [-halt-on-error]}
% arara: biber
% arara: pdflatex: {options: [-halt-on-error]}

答案1

不确定您在 MWE 中获得的效果是否正是您想要实现的效果,但您需要\nolinkurl在字段格式中使用citedoi。否则 LaTeX 无法在 DOI 内提供换行符,因为它不能像普通单词一样用连字符连接。

\documentclass[hyperref={colorlinks=false}]{beamer}

\usepackage[backend=biber, style=numeric]{biblatex}
\usepackage{xurl}

\DeclareFieldFormat{citedoi}{\href{https://doi.org/#1}{\nolinkurl{#1}}}

\DeclareCiteCommand{\citedoi}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield[citedoi]{doi}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\newcommand\scitedoi[1]{{\color{blue}\tiny\citedoi{#1}}}
\newcommand\itcitedoi[1]{\parbox{1.5cm}{\color{blue}\tiny\citedoi{#1}}}


\begin{filecontents}{\jobname.bib}
@article{M2020,
  author  = {Mehandia, Seema and Sharma, S. C.
             and Arya, Shailendra Kumar},
  journal = {Biotechnol. Rep. (Amst)},
  title   = {Isolation and characterization of an alkali
             and thermostable laccase},
  doi     = {10.1016/j.btre.2019.e00413},
}
@article{Mn2009,
  author  = {Murugesan, Kumarasamy and Kim, Young-Mo
             and Jeon, Jong-Rok and Chang, Yoon-Seok},
  journal = {J Hazard Mater.},
  title   = {Effect of metal ions on reactive dye decolorization
             by laccase from Ganoderma lucidum.},
  doi     = {10.1016/j.jhazmat.2009.02.075},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}

\begin{frame}
\frametitle{Unreproducible}
This text is just text and nothing more as I just need filler text \scitedoi{M2020} that spans a few lines on 
this beamer presentation. This text is just text and nothing more \itcitedoi{Mn2009} as I just need filler text 
that spans a few lines on this beamer presentation. This text is just text and nothing more as I just need filler 
text that spans a few lines on this beamer presentation. 
\end{frame}

\begin{frame}
\printbibliography
\end{frame}

\end{document}

三行 DOI。

答案2

@moewe 的回答回答了我的问题,但我还想添加一个答案,其中显示了 @Oleg Lobachev 的建议,即在qrcode包中使用二维码。调整Martin H 的回答计算文本高度(以便制作具有适当高度的二维码)的输出如下:

在此处输入图片描述

带有超链接二维码的文本高度设置。感谢您的建议,感谢您接受的答案,两者都对我的需求有用。

% arara: pdflatex: {options: [-halt-on-error]}
% arara: biber
% arara: pdflatex: {options: [-halt-on-error]}

\begin{filecontents}[overwrite]{ref.bib}
@Article{M2020,
  author = {Mehandia, Seema and Sharma, S. C. and Arya, Shailendra Kumar},
  journal = {Biotechnol. Rep. (Amst)},
  title = {Isolation and characterization of an alkali and thermostable laccase},
  doi = {10.1016/j.btre.2019.e00413},
}
@Article{Mn2009,
  author = {Murugesan, Kumarasamy and Kim, Young-Mo and Jeon, Jong-Rok and Chang, Yoon-Seok},
  journal = {J Hazard Mater.},
  title = {Effect of metal ions on reactive dye decolorization by laccase from Ganoderma lucidum.},
  doi = {10.1016/j.jhazmat.2009.02.075},
}
\end{filecontents}

\documentclass[hyperref={colorlinks=false}]{beamer}

\usepackage[backend=biber, style=numeric]{biblatex}
\usepackage{qrcode}

\addbibresource{ref.bib}

% Custom \qrdoi command adapted from \citeurl following the suggestion by Oleg Lobachev

\DeclareFieldFormat{qrdoi}{\qrcode{https://doi.org/#1}}

\DeclareCiteCommand{\qrdoi}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield[qrdoi]{doi}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\newcommand\scitedoi[1]{{\color{blue}\tiny\citedoi{#1}}}

\newcommand\itcitedoi[1]{(\parbox{1.5cm}{\color{blue}\tiny\citedoi{#1}})}

\begin{document}

\begin{frame}
\frametitle{Unreproducible}

\newlength{\myl}
\settoheight{\myl}{test text}
\qrset{link, height=1.5\myl}

This text is just text and nothing more as I just need filler text that spans a few lines on (\qrdoi{M2020})
this beamer presentation. This text is just text and nothing more as I just need filler text 
that spans a few lines on this beamer presentation. This text is just text and nothing more as I just need filler 
text that spans a few lines on this beamer presentation. 
\end{frame}

\begin{frame}
\printbibliography
\end{frame}

\end{document}

可能有更好或更新的方法来计算文本高度,但这种方法有效。

相关内容