Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
}
share|improve this question
    
Do you use a citation management package, such as cite, natbib, or harvard, as well? Depending on which package is used, different commands are available to reduce the spacing between entries in the bibliography. –  Mico Mar 26 '13 at 14:54
    
In Document Settings->Bibliography, my citation style is set to Default(numerical). If that answers the question... –  user1696811 Mar 26 '13 at 15:13
    
I'm afraid I'm not a lyx specialist, and thus don't know how to translate lyx's information (Default(numerical)) into a series of LaTeX commands that underlie this information. :-( Hopefully, someone else can jump in and help you out. –  Mico Mar 26 '13 at 16:12
    
I doubt if Lyx is to be blamed. Lyx has no unique reference management utilities and it uses standard LaTeX packages for dealing with references (bibtex, natbib, biblatex). You should prob. tweak the Bibtex options to solve that (unfortunately I use biblatex so I can't help). –  Roey Angel Mar 26 '13 at 17:15

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
Good, spacing is reduced. If the "usual" one line spacing is required it seems that changing \itemsep=0pt to \itemsep=-4pt does the further reduction... Anyway, for LyX, just copy and paste the code between %%% Start... and %%% End... into the LaTeX Preamble under "Document > Settings...". –  e-birk Mar 29 '13 at 0:47
    
@e-birk I've added also how to remove the additional spacing (it's due to \parsep). –  egreg Mar 29 '13 at 9:12
    
Easy, worked great! –  user1696811 Apr 3 '13 at 16:56
    
Why it is not working in my report? –  Deepesh Patel Jun 7 at 19:38
    
@DeepeshPatel It's difficult to say. Please, open a new question referring to this one, with a minimal example showing failure. –  egreg Jun 7 at 19:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.