1

I am using a custom class from here. There is an issue with how they set double-spacing and for tables and figures @Mico provided a nice solution here. However, I cannot seem to be able to solve the spacing within the reference section created by \bibliography. I tried issuing \renewcommand{\baselinestretch}{1} just before either \bibliographystyle{apalike} or \bibliography{thesis} or tried to add in the preamble:

\AtBeginEnvironment{thebibliography}{\renewcommand{\baselinestretch}{1}}
\AtEndEnvironment{thebibliography}{\renewcommand{\baselinestretch}{2}}

just as suggested for tables. But it had no effect.

I actually have three questions:

  1. How to get the single spacing for the bibliography entries in the case of this class (using natbib)?

  2. How to achieve an appropriate name of the bibliography section (LIST OF REFERENCES) and add it to TOC in an appropriate way (just as the class seems to do)?

  3. Who's responsibility is thebibliography command?


The last question relates to the fact that from Lamport's book as well as from the LaTeX companion, I understand that this environment creates actually the entries from the bbl file. As such, I would expect this environment to be generated by either natbib or more likely by the bibliography style, in this case by apalike. But it seems incorrect since if I comment out lines 549--561 in the ucfthes.cls, the tex file will not compile, complaining:

(/usr/local/texlive/2019/texmf-dist/tex/latex/base/ifthen.sty) (./ucfthma.clo)
(./ucfth12.clo) (./ucfthti.clo))
(/usr/local/texlive/2019/texmf-dist/tex/latex/natbib/natbib.sty

! LaTeX Error: Environment thebibliography undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.1063 \renewenvironment{thebibliography}
                                         [1]{%
? 

So it seems that it is the responsibility of a class is to define thebibliography command?

When it is defined (by uncommenting the appropriate lines 549--561 in the ucfthes.cls), it is not used anyway, since the chapter title should be "LIST OF REFERENCES" and not "Bibliography" which seems to be produced by some other definition of thebibliography.

The minimum example with the problem is below. It only requires the files ucfth12.clo, ucfthma.clo, ucfthti.clo, ucfthes.cls from the gitbub link above and contents of thesis.tex and thesis.bib which are below.


Content of thesis.tex

\documentclass{ucfthes} 
\usepackage{natbib}
\usepackage{apalike}
\usepackage{lipsum}

\usepackage{graphicx}
\usepackage{longtable}
\usepackage{afterpage}
\usepackage{color}
\usepackage{multicol}
\usepackage{pdflscape}
\usepackage{float}
\makeatletter
\setlength\@fptop{5pt}
\makeatother
\usepackage{hyperref}
\usepackage{etoolbox}

\begin {document}
\lipsum[1]

\cite{Bethe1930}

\bibliographystyle{apalike}
\bibliography{thesis}
\end {document} \bye

The content of thesis.bib:

@Electronic{ETD_Format,
  author       = {University of Central Florida Graduate Studies},
  title        = {Formatting the ETD},
  year         = {2016},
  url          = {http://www.students.graduate.ucf.edu/ETD_formatting/},
  howpublished = {Webpage},
}

@Electronic{TemplateGit,
  Title                    = {UCF Thesis LaTeX Template},
  Author                   = {Daniel Gallagher},
  HowPublished             = {Git Repository},
  Organization             = {University of Central Florida},
  Url                      = {https://bitbucket.org/dgallagher/ucf-thesis-latex-template},
  Year                     = {2007},

  Abstract                 = {This template was originally developed in 2007 in compliance with the UCF ETD masters thesis guidelines. It has since been used by various colleges in their PhD dissertation submissions. At this time there was no official LaTeX template available from the university. There is now a basic template supplied by the editor in Graduate studies located on the . However, some may prefer to use this template for there needs.

By publishing my template in a public git repository, I hope that the template may be used by others and will continue to evolve with the revised ETD format guidelines through user contributed updates.}
}

@Article{Bethe1930,
  author       = {Bethe, H.},
  title        = {Zur Theorie des Durchgangs schneller Korpuskularstrahlen durch Materie},
  journal      = {Annalen der Physik},
  journaltitle = {Annalen der Physik},
  year         = {1930},
  volume       = {397},
  number       = {3},
  pages        = {325--400},
  issn         = {1521-3889},
  doi          = {10.1002/andp.19303970303},
  url          = {http://dx.doi.org/10.1002/andp.19303970303},
  file         = {:D\:\\Data\\Personnal\\ucf\\Project - Shielding\\articles\\StoppingPower\\Bethe, H.\; Zur Theorie des Durchgangs schneller Korpuskularstrahlen durch Materie\; Ann. Phys., Vol. 397, Issue 3, (1930).pdf:PDF},
  owner        = {Leoš Pohl},
  publisher    = {WILEY-VCH Verlag},
  timestamp    = {2015.12.17},
}
2
  • Note that it is preferred to ask only one question per question: tex.meta.stackexchange.com/q/7425/35864. That makes your question easier to answer and more relevant for other people.
    – moewe
    Mar 5, 2020 at 20:26
  • 1
    Re 3) Traditionally it was the job of the document class to define thebibliography and I would argue that a good document class for "normal documents" should define thebibliography. natbib assumes control over thebibliography by redefining the environment (with \renewenvironment, which assumes that it is defined in the first place) with its own definition. natbib makes some attempts to recreate the headings used by the standard and AMS classes, but it will overwrite the definitions of other classes (with a potentially different definition).
    – moewe
    Mar 5, 2020 at 20:33

1 Answer 1

1

Do

\AtBeginEnvironment{thebibliography}{\linespread{1}\selectfont}

Without \selectfont the setting is not enforced.

In general, \linespread{<factor>} is to be preferred to \renewcommand{\baselinestretch}{<factor>} even though they essentially do the same thing. In any case, the setting is not enforced until the first (explicit or implicit) \selectfont command.

\documentclass{ucfthes} 
\usepackage{natbib}
\usepackage{apalike}
\usepackage{lipsum}

\usepackage{graphicx}
\usepackage{longtable}
\usepackage{afterpage}
\usepackage{color}
\usepackage{multicol}
\usepackage{pdflscape}
\usepackage{float}
\makeatletter
\setlength\@fptop{5pt}
\makeatother
\usepackage{hyperref}
\usepackage{etoolbox}

\AtBeginEnvironment{thebibliography}{\linespread{1}\selectfont}

\begin {document}
\lipsum[1]

\cite{Bethe1930}

\bibliographystyle{apalike}
\bibliography{thesis}

\end{document}

enter image description here

6
  • That does work but when I have \afterpage{ \clearpage \newgeometry{margin=0.8cm,marginparwidth=0cm,marginparsep=0mm,footskip=0.5cm,headheight=0cm,headsep=0cm,includefoot} \lipsum[1] \clearpage \aftergroup \restoregeometry } within the document, it breaks down. Funny for me, if I comment out new geometry, that not even the lipsum is double spaced. (I don't really know what the code does, I took it from somewhere to be able to place large floats that need different margins. Why does it not work with the afterpage?
    – atapaka
    Mar 5, 2020 at 21:28
  • @leosenko What has this to do with bibliographies and your question? There is no change in leading in your code, by the way.
    – egreg
    Mar 5, 2020 at 21:35
  • I don't know, just that if I add this part of code to the sample, the spacing is back to double in references. But if I comment out either \aftergroup or \restoregeometry it works correctly.
    – atapaka
    Mar 5, 2020 at 21:47
  • @leosenko Are you really sure you need such machinery just to accommodate a wider figure? You don't.
    – egreg
    Mar 5, 2020 at 22:00
  • I cannot answer that question, since I have no idea what the commands do. While I know (from the perspective of the user not internals of TeX) what \newgeometry, \lipsum` and \afterpage{\clearpage} do on their own, i have no idea what they do in the code above as a group internally. From my perspective, all that is done is that all the floats are flushed by the first \clearpage, the margins are increased, then there is the content which is immediatelly flushed by another \clearpage, I have no idea what \aftergroup is for and at the end, margins are put back to normal.
    – atapaka
    Mar 6, 2020 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .