[Tex/LaTex] How to remove the vertical distance between references in lyx

bibliographiesbibtexlyxspacing

Using LyX, a BibTeX file and the unsrt bibliography style. The program automatically leaves an empty line between each reference, wasting lots of space in the process!

Is there any way to force LyX to leave no vertical gaps between references?

Here is a LaTeX MWE (more or less generated by LyX) showing the problem:

\documentclass{article}
\begin{document}
\bibliographystyle{unsrt}
\nocite{*}
\bibliography{testlyx}
\end{document}

enter image description here

And here is the sample file "testlyx.bib":

@ARTICLE{authorA,
  author = {AuthorA},
  title = {This is the title A},
  journal = {journal A},
  year = {1993},
  volume = {47},
  pages = {58--61},
  month = {Feb}
}

@ARTICLE{authorB,
  author = {AuthorB},
  title = {That is the title B},
  journal = {journal A},
  year = {1994},
  volume = {50},
  pages = {53--79},
  month = {May}
}

Best Answer

The distance between items is defined by the article class to be 4pt; you can change it by patching the \thebibliography command:

\begin{filecontents*}{\jobname.bib}
@ARTICLE{authorA,
  author = {AuthorA},
  title = {This is the title A},
  journal = {journal A},
  year = {1993},
  volume = {47},
  pages = {58--61},
  month = {Feb}
}

@ARTICLE{authorB,
  author = {AuthorB},
  title = {That is the title B},
  journal = {journal A},
  year = {1994},
  volume = {50},
  pages = {53--79},
  month = {May}
}
\end{filecontents*}
\documentclass{article}

%%% Start of code to add %%%
\usepackage{etoolbox}
\patchcmd\thebibliography
 {\labelsep}
 {\labelsep\itemsep=0pt\relax}
 {}
 {\typeout{Couldn't patch the command}}
 %%% End of code to add %%%

\begin{document}
\bibliographystyle{unsrt}
\nocite{*}
\bibliography{\jobname}
\end{document}

Notice that the filecontents environment is just for convenience in making a self contained example. The code you should add is marked in the example. How you can do it in LyX is beyond my knowledge.

enter image description here

If the normal spacing between lines is wanted, then a slight change will do:

%%% Start of code to add %%%
\usepackage{etoolbox}
\patchcmd\thebibliography
 {\labelsep}
 {\labelsep\itemsep=0pt\parsep=0pt\relax}
 {}
 {\typeout{Couldn't patch the command}}
 %%% End of code to add %%%

Here's the result:

enter image description here

Related Question