我正在使用带有 biblatex 的 beamer 创建参考书目,并重新定义了模板中的“块”。为了在块内添加一些填充,我使用了 adjustwidth 命令。当我将参考书目放入未添加填充(即未使用 adjustwidth)的块中时,每个 bib 条目的第一行从最左边开始,并且该条目的后续行将缩进。
但是,当添加 adjustwidth 命令时,此行为会被破坏,并且第一个元素之后的每个元素都会完全缩进(包括第一行),这使得参考书目难以阅读并且看起来不一致。
如果有人能帮助我保持缩进正确,同时仍在块中进行填充,我将不胜感激。
这是一个展示该行为的最小工作示例:
Tex 文件:
\documentclass[final]{beamer}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[orientation=portrait,size=a0,scale=1.0]{beamerposter}
\RequirePackage{exscale}
\RequirePackage{ragged2e}
\RequirePackage{changepage}
\RequirePackage{calc}
\usepackage[backend=bibtex, style=authoryear]{biblatex}
\setcounter{biburllcpenalty}{7000}
\setbeamertemplate{bibliography item}{}
\bibliography{bibliography.bib}
% Block
\setbeamertemplate{block begin}
{
\begin{beamercolorbox}[colsep*=0ex,dp=2ex,center]{block title}
\vskip0pt
\begin{adjustwidth}{1ex}{1ex}
\centering
\usebeamerfont{block title}\insertblocktitle
\end{adjustwidth}
\vskip-1.25ex
\begin{beamercolorbox}[colsep=0.025ex]{block separator}\end{beamercolorbox}
\end{beamercolorbox}
{\parskip0pt\par}
\usebeamerfont{block body}
\vskip-0.5ex
\begin{beamercolorbox}[colsep*=0ex]{block body}
\justifying
\begin{adjustwidth}{1ex}{1ex}
\setlength{\parskip}{1ex}
\vskip-2ex
}
\setbeamertemplate{block end}
{
\end{adjustwidth}
\vskip1ex
\end{beamercolorbox}
\vskip0pt
\vspace*{2ex}
}
\title{Some title}
\begin{document}
\begin{frame}
\begin{columns}
\begin{column}{0.5\paperwidth}
This is a test \autocite{AndersonStrongMixedintegerProgramming2020} and \autocite{AndersonStrongMixedintegerProgramming2021}
\end{column}
\begin{column}{0.5\paperwidth}
\begin{block}
\printbibliography
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}
和 bib 文件:
@article{AndersonStrongMixedintegerProgramming2020,
title = {Strong Mixed-Integer Programming Formulations for Trained Neural Networks},
author = {Anderson, Ross and Huchette, Joey and Ma, Will and Tjandraatmadja, Christian and Vielma, Juan Pablo},
date = {2020-09-01},
journaltitle = {Mathematical Programming},
shortjournal = {Math. Program.},
volume = {183},
number = {1},
pages = {3--39},
issn = {1436-4646},
doi = {10/gnbscf},
url = {https://doi.org/10.1007/s10107-020-01474-5},
urldate = {2021-11-04},
langid = {english}
}
@article{AndersonStrongMixedintegerProgramming2021,
title = {Strong Mixed-Integer Programming Formulations for Trained Neural Networks 2},
author = {Andersons, Ross and Huchette, Joey and Ma, Will and Tjandraatmadja, Christian and Vielma, Juan Pablo},
date = {2020-09-01},
journaltitle = {Mathematical Programming},
shortjournal = {Math. Program.},
volume = {183},
number = {1},
pages = {3--39},
issn = {1436-4646},
doi = {10/gnbscf},
url = {https://doi.org/10.1007/s10107-020-01474-5},
urldate = {2021-11-04},
langid = {english}
}
答案1
要更改块内的边距,我可以使用left-/rightskip
或sep
选项beamercolorbox
:
\documentclass[final]{beamer}
\usecolortheme{orchid}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[orientation=portrait,size=a0,scale=1.0]{beamerposter}
\RequirePackage{exscale}
\RequirePackage{ragged2e}
%\RequirePackage{changepage}
\RequirePackage{calc}
\usepackage[backend=bibtex, style=authoryear]{biblatex}
\setbeamertemplate{bibliography item}{}
\addbibresource{biblatex-examples.bib}
\usepackage{lipsum}
\setbeamertemplate{block begin}
{
\par\vskip\medskipamount%
\begin{beamercolorbox}[colsep*=.75ex,center]{block title}
\usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title}
{}
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[colsep*=.75ex,vmode,leftskip=1cm,rightskip=1cm]{block body}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block end}
{\end{beamercolorbox}\vskip\smallskipamount}
\title{Some title}
\begin{document}
\begin{frame}
\begin{block}{title}
\lipsum
\end{block}
\begin{columns}
\begin{column}{0.4\paperwidth}
This is a test \autocite{knuth:ct} and \autocite{westfahl:space}
\end{column}
\begin{column}{0.4\paperwidth}
\begin{block}{}
\begin{minipage}{\linewidth-2cm}
\printbibliography
\end{minipage}
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}