如何使参考书目(bibtex)和枚举缩进相同?

如何使参考书目(bibtex)和枚举缩进相同?

在以下 MWE 中,有没有办法让参考书目中的缩进与枚举中的缩进相同?

\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage[british]{babel}
\usepackage{natbib}


\makeatletter \renewcommand\@biblabel[1]{#1.} \makeatother


\begin{document}

\begin{enumerate}
\item Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.

\item Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae.


\end{enumerate}

\nocite{tstItem1,tstItem2}


\bibliographystyle{plain}
\bibliography{tst}

\end{document}

目录

@Misc{tstItem1,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem2,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}

答案1

好吧,我希望你能解释一下为什么你希望参考书目中的缩进与枚举中的缩进相同。

最后,我发现问题在于缩进是可变的,并且取决于文档中的 bib 条目数量。

我只有一个快速而肮脏的解决方案。请看以下四行:

% \renewcommand\@biblabel[1]{~~~~#1.} %  1-9  bib entrys, file \jobname
  \renewcommand\@biblabel[1]{~~~#1.}  % 10-99 bib entrys, file \jobname-2

%\bibliography{\jobname}   % <================== bib file with  2 entrys
 \bibliography{\jobname-2} % <================== bib file with 10 entrys

我根据您的 bib 文件中 bib 条目的数量~在您更改的命令中添加了一些(固定空间)\@biblabel以获得您想要的效果。

根据 bib 条目的数量,您必须使用不同的命令。因此,我展示了 10 个 bib 条目的效果(由 创建的第二个文件filecontents)。如果您想查看两个 bib 条目的效果,请将两行的两个部分移动%到第二行...

拥有完整的 MWE

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Misc{tstItem1,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem2,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}
\end{filecontents*}
\begin{filecontents*}{\jobname-2.bib}
@Misc{tstItem1,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem2,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}
@Misc{tstItem3,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem4,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}
@Misc{tstItem5,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem6,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}
@Misc{tstItem7,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem8,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}
@Misc{tstItem9,
  Title                    = {Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.}
}
@Misc{tstItem10,
  Title                    = {Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae}
}
\end{filecontents*}


\documentclass{article}
\usepackage[latin9]{inputenc}
\usepackage[british]{babel}
\usepackage{natbib}

\makeatletter 
% \renewcommand\@biblabel[1]{~~~~#1.} %  1-9  bib entrys, file \jobname
  \renewcommand\@biblabel[1]{~~~#1.}  % 10-99 bib entrys, file \jobname-2
\makeatother


\begin{document}

\begin{enumerate}
  \item Aenean massa. Aenean leo ligula, porttitor eu, consequat vitae, 
    eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, 
    feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. 
    Quisque rutrum.
  \item Nulla consequat massa quis enim. Donec pede justo, fringilla vel, 
    aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, 
    imperdiet a, venenatis vitae.
\end{enumerate}

\nocite{*}
\bibliographystyle{plain}
%\bibliography{\jobname}   % <================== bib file with  2 entrys
 \bibliography{\jobname-2} % <================== bib file with 10 entrys

\end{document}

你将获得快速而粗略的结果:

十个参赛作品

以下是两个 bib 条目的完整结果:

两个参赛作品

相关内容