我偶然发现了这个,看一下:
\documentclass{beamer}
\begin{filecontents}{references.bib}
@article{myart,
author={Author, A.},
title={My Title},
journal={A Journal},
volume={123},
pages={1},
year={2018},
}
\end{filecontents}
\usetheme{Madrid}
\usepackage[
style=authoryear,% whithout this style the theme is working
]{biblatex}
\addbibresource{references.bib}
\begin{document}
\begin{frame}
\nocite{myart}
\printbibliography
\end{frame}
\end{document}
通过注释掉authoryear
样式,一切都按预期工作,但使用样式时authoryear
,参考书目第一行的缩进会向左移动。这似乎是马德里主题特有的。
是我的问题还是这是一个 bug?我想使用这种引用样式的马德里主题,如果这是一个 bug,我可以帮忙解决吗?
答案1
使用madrid
主题infolines
,设置非常窄的边距。如果增加这些边距,将有空间显示参考书目图标:
\documentclass{beamer}
\begin{filecontents}{ref.bib}
@article{myart,
author={Author, A.},
title={My Title},
journal={A Journal},
volume={123},
pages={1},
year={2018},
}
\end{filecontents}
\usetheme{madrid}
\setbeamersize{text margin left=1cm,text margin right=1cm}
\usepackage[
style=authoryear,% whithout this style the theme is working
]{biblatex}
\addbibresource{ref.bib}
\begin{document}
\begin{frame}
\cite{myart}
\printbibliography
\end{frame}
\end{document}
答案2
感谢 @samcarter 指出 biblatex 中的标签问题,我设法将numeric
style 中的 bib 环境与authoryear
style 结合使用。结果看起来和我预期的一样,authoryear
开箱即用:
\documentclass{beamer}
\begin{filecontents}{ref.bib}
@article{myart,
author={Author, A. and Another, B.},
title={My Long Title},
journal={A Very Long Journal Name},
volume={123},
pages={1},
year={2018},
}
\end{filecontents}
\usetheme{madrid}
%\setbeamersize{text margin left=1cm,text margin right=1cm}
\usepackage[style=authoryear]{biblatex}
% authoryear bibenvironment/original
%\defbibenvironment{bibliography}
%{\list
% {}
% {\setlength{\leftmargin}{\bibhang}%
% \setlength{\itemindent}{-\leftmargin}%
% \setlength{\itemsep}{\bibitemsep}%
% \setlength{\parsep}{\bibparsep}}}
%{\endlist}
%{\item}
% numeric bibenvironment
\defbibenvironment{bibliography}
{\list
{\printfield[labelnumberwidth]{labelnumber}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist}
{\item}
\addbibresource{ref.bib}
\begin{document}
\begin{frame}
\cite{myart}
\printbibliography
\end{frame}
\end{document}