.png)
Я хотел бы вставить вертикальный пробел после конкретной ссылки в разделе ссылок с помощью BibTeX, в идеале с помощью последовательности команд, например:
\cite{ABC-2001}
\refvspace{1cm}
\cite{XYZ-2002}
Ссылки импортируются с помощью \bibliography{references.bib}
. Порядок соответствует порядку цитирования. Стиль библиографии пользовательский, но скажем так, \bibliographystyle{unsrt}
для определенности.
Как это сделать, не изменяя bib-файл?
Возможная отправная точка:
\documentclass{article}
\begin{filecontents}{refs.bib}
@misc{P, author = {P}, year = {2001}}
@misc{Q, author = {Q}, year = {2002}}
@misc{A, author = {A}, year = {2001}}
@misc{B, author = {B}, year = {2002}}
\end{filecontents}
\begin{document}
This is a survey on different topics.
\section*{Topic 1}
Text \cite{P}. Text \cite{Q}.
\section*{Topic 2}
% TODO: Visually separate the two topics in the bibliography here
Text \cite{A}. Text \cite{B}.
\bibliographystyle{unsrt}
\bibliography{refs}
\end{document}
решение1
Давайте рассмотрим ваш вклад:
\cite{ABC-2001}
\refvspace{1cm}
\cite{XYZ-2002}
Мы можем назначить какой-то \vspace
макрос, который будет связан с цитированием для XYZ-2002
. То есть, вызывать, \vspace{1cm}
как только он найдет \bibitem{XYZ-2002}
в библиографии.
Следующий минимальный пример позволяет достичь этого:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{refs.bib}
@misc{P, author = {P}, year = {2001}}
@misc{Q, author = {Q}, year = {2002}}
@misc{A, author = {A}, year = {2001}}
@misc{B, author = {B}, year = {2002}}
\end{filecontents}
\makeatletter
\let\@refvspace\relax
\providecommand{\refvspace}[1]{%
\gdef\@refvspace{#1}% Store \refvspace
}
\let\old@cite\cite% Store \cite in \old@cite
\renewcommand{\cite}[1]{%
\ifx\@refvspace\relax
% No \refvspace was used
\else
\begingroup
% Create vspace macro
\edef\x{\endgroup
\noexpand\global\noexpand\@namedef{#1@vspace}{\noexpand\vspace{\@refvspace}}}\x
\global\let\@refvspace\relax
\fi
\old@cite{#1}}% Process regular \cite
\let\old@bibitem\bibitem% Store \bibitem in \old@bibitem
\renewcommand{\bibitem}[1]{%
\csname #1@vspace\endcsname% Insert \vspace macro
\old@bibitem{#1}}% Process regular \bibitem
\makeatother
\begin{document}
This is a survey on different topics.
\section*{Topic 1}
Text \cite{P}. \refvspace{\baselineskip}Text \cite{Q}.
\section*{Topic 2}
\refvspace{1cm}
Text \cite{A}. Text \cite{B}.
\bibliographystyle{unsrt}
\bibliography{refs}
\end{document}
Предостережения:
Приведенный выше пример довольно тривиален и удаляет необязательные аргументы из
\cite
и\bibitem
. Однако при необходимости их можно восстановить.Контент не написан ни для
.bib
ни.bbl
и поэтому будет работать только если\bibliography
произойдетпослевсе ваши\refvspace
макросы.