xurl 在 fullcite beamer 中不换行

xurl 在 fullcite beamer 中不换行

我正在做一个带有 metropolis 主题的 beamer 演示。我使用 biblatex 和一些自定义条目以及 ieee 样式,但fullcite在框架中使用时,我无法让 DOI 或 URL 换行。(我使用的是 xurl)

在此处输入图片描述

这是要复制的代码:

\documentclass[10pt]{beamer}

%%% MY METROPOLIS SETTINGS %%%
\usetheme{metropolis}
\metroset{titleformat=smallcaps, progressbar=foot, numbering=fraction}
\definecolor{LightGray}{HTML}{808080}
\setbeamercolor{bibliography entry location}{fg=LightGray} 
\setbeamercolor{bibliography entry note}{fg=LightGray}
\usefonttheme{serif}
\linespread{1}\selectfont

%%% BIBLIOGRAPHY %%%

\usepackage[sorting=none, style=ieee]{biblatex}
\usepackage{xurl}
\usepackage{graphicx}

\stdpunctuation

\DeclareFieldFormat[online]{url}{{\scriptsize\textsc{URL}}\footnotesize\addcolon\addspace\url{#1}}
\DeclareFieldFormat[online]{title}{\textbf{\mkbibquote{#1}}}

\DeclareFieldFormat[book]{title}{\textbf{\mkbibquote{#1}\addcomma}}
\DeclareFieldFormat[book]{publisher}{#1}
\DeclareFieldFormat[book]{doi}{\footnotesize\color{LightGray}{\scriptsize\textsc{DOI}}\addcolon\addspace\href{https://doi.org/#1}{\texttt{#1}}}

\DeclareFieldFormat[article]{number}{\addnbspace#1}
\DeclareFieldFormat[article]{date}{#1\adddot}
\DeclareFieldFormat[article]{doi}{\footnotesize\color{LightGray}{\scriptsize\textsc{DOI}}\addcolon\addspace\href{https://doi.org/#1}{\nolinkurl{#1}}\adddot}

\DeclareBibliographyDriver{online}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others/translator+others}%
    \setunit{\adddot\addspace}%
    \usebibmacro{title}%
    \setunit{\adddot\addspace}%
    \newunit\newblock
    \iffieldundef{year}
        {}
        {\printfield{year}}
    \setunit{\adddot\addspace}%
    \printfield{url}\adddot%
}

\DeclareBibliographyDriver{book}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others/translator+others}%
    \setunit{\addcomma\addspace}%
    \usebibmacro{maintitle+title}%
    \setunit{\addcomma\addspace}%
    {\color{LightGray}\small%
    \mkbibemph{\printlist{publisher}}\addcomma\addspace%
    \printfield{year}\adddot\addspace%
    \printfield{doi}\adddot}%
}

\begin{filecontents}{resources.bib}
@article{2013perseguers,
    author = {S. Perseguers and G. J. Lapeyre and D. Cavalcanti and M. Lewenstein and A. Acín},
    title = {Distribution of entanglement in large-scale quantum networks},
    journal = {Reports on Progress in Physics},
    volume = {76},
    number = {9},
    pages = {096001},
    year = {2013},
    DOI = {10.1088/0034-4885/76/9/096001}
}

@online{opte,
    author = {{The Opte Project}},
    title = {{The Internet}},
    year = {},
    url = {https://www.opte.org/the-internet}
}
\end{filecontents}
\addbibresource{resources.bib}

\begin{document}

\begin{frame}{Testing}
\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{example-image-a}
\end{figure}
\fullcite{2013perseguers}

\fullcite{opte}
\end{frame}

\end{document}

答案1

您可以使用\justifying\RaggedRightragged2e包中启用连字符:

\documentclass[10pt]{beamer}

\usetheme[progressbar=foot]{moloch}% modern fork of the metropolis theme
\setbeamertemplate{page number in head/foot}[totalframenumber]
\definecolor{LightGray}{HTML}{808080}
\setbeamercolor{bibliography entry location}{fg=LightGray} 
\setbeamercolor{bibliography entry note}{fg=LightGray}
\usefonttheme{serif}
\linespread{1}\selectfont

%%% BIBLIOGRAPHY %%%

\usepackage[sorting=none, style=ieee]{biblatex}
\usepackage{xurl}
\usepackage{graphicx}

\stdpunctuation

\DeclareFieldFormat[online]{url}{{\scriptsize\textsc{URL}}\footnotesize\addcolon\addspace\url{#1}}
\DeclareFieldFormat[online]{title}{\textbf{\mkbibquote{#1}}}

\DeclareFieldFormat[book]{title}{\textbf{\mkbibquote{#1}\addcomma}}
\DeclareFieldFormat[book]{publisher}{#1}
\DeclareFieldFormat[book]{doi}{\footnotesize\color{LightGray}{\scriptsize\textsc{DOI}}\addcolon\addspace\href{https://doi.org/#1}{\texttt{#1}}}

\DeclareFieldFormat[article]{number}{\addnbspace#1}
\DeclareFieldFormat[article]{date}{#1\adddot}
\DeclareFieldFormat[article]{doi}{\footnotesize\color{LightGray}{\scriptsize\textsc{DOI}}\addcolon\addspace\href{https://doi.org/#1}{\nolinkurl{#1}}\adddot}

\DeclareBibliographyDriver{online}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others/translator+others}%
    \setunit{\adddot\addspace}%
    \usebibmacro{title}%
    \setunit{\adddot\addspace}%
    \newunit\newblock
    \iffieldundef{year}
        {}
        {\printfield{year}}
    \setunit{\adddot\addspace}%
    \printfield{url}\adddot%
}

\DeclareBibliographyDriver{book}{%
    \usebibmacro{bibindex}%
    \usebibmacro{begentry}%
    \usebibmacro{author/editor+others/translator+others}%
    \setunit{\addcomma\addspace}%
    \usebibmacro{maintitle+title}%
    \setunit{\addcomma\addspace}%
    {\color{LightGray}\small%
    \mkbibemph{\printlist{publisher}}\addcomma\addspace%
    \printfield{year}\adddot\addspace%
    \printfield{doi}\adddot}%
}

\begin{filecontents}{resources.bib}
@article{2013perseguers,
    author = {S. Perseguers and G. J. Lapeyre and D. Cavalcanti and M. Lewenstein and A. Acín},
    title = {Distribution of entanglement in large-scale quantum networks},
    journal = {Reports on Progress in Physics},
    volume = {76},
    number = {9},
    pages = {096001},
    year = {2013},
    DOI = {10.1088/0034-4885/76/9/096001}
}

@online{opte,
    author = {{The Opte Project}},
    title = {{The Internet}},
    year = {},
    url = {https://www.opte.org/the-internet}
}
\end{filecontents}
\addbibresource{resources.bib}

\usepackage{ragged2e}

\begin{document}

\begin{frame}{Testing}
\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{example-image-a}
\end{figure}
\justifying
\fullcite{2013perseguers}

\fullcite{opte}
\end{frame}

\begin{frame}{Testing}
\begin{figure}
    \centering
    \includegraphics[width=0.5\textwidth]{example-image-a}
\end{figure}
\RaggedRight
\fullcite{2013perseguers}

\fullcite{opte}
\end{frame}

\end{document}

在此处输入图片描述

相关内容