[Tex/LaTex] Need help getting natbib and custom bibtex style sheet to cooperate with custom thesis class

bibtexnatbib

I'm typing a linguistics Master's Thesis and have to use a custom class that our thesis office gives us. Then, I have to use the style that is set by the Linguistic Society of America for citations and references. The only problem is that I don't know the code well enough to see what I have to tweak to make everything work well with each other.

The custom thesis class code that I have to use for my thesis is here: https://copy.com/qgo0XqdfrGOryQp2

The custom bibtex style sheet (which is based off the Linguistic Society of America's style guide) code is the language.bst file on artstein dot org's website (sorry I don't have enough reputation to post more than two links, it's an easy search in google).

Basically I need to remove the comma after the Author name in the citation so it doesn't look like APA style and looks like LSA style (which I think the author of the language.bst) based his code off the APAcite code and so it still retains the comma. How can I remove it based on the code?

enter image description here

The biggest problem is the page that should have "References" as the header appears like this (the actual reference here is correct, I just need to get rid of Appendix C, the asterisk, and Bibliography and should have "References" centered at the top of the page):

enter image description here

In case you need to know, I get this error the first time after running BibTeX:

enter image description here

This is my .bbl file code:

\begin{thebibliography}{1}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}{\relax}
\providecommand{\urlprefix}{Online: }

\bibitem[{Levon(2007)}]{Levon07}
\textsc{Levon, Erez}. 2007.
\newblock {Sexuality in context}.
\newblock \emph{Language in Society} 36.533--554.

\end{thebibliography}

I'm at my wit's end. My department isn't LaTeX heavy and I can't find anyone to help me with this. The thesis office can't help as the code was given to them by some guy who made it back in 1994 and has retired since. I'm the first to attempt to type my thesis in LaTeX. I do NOT want to have to resort to having to use Word. Anyone out there who enjoys a challenge willing to help me?

Thank you so much in advance!

Here is a link to an MWE: https://copy.com/AdfVqGIIWqR6ed1u You will need to download all the files or it won't work. Just open up the MyThesis.tex file. I put the citation in the abstract.tex file.

Best Answer

The class has a definition for thebibliography which really can't be recommended (add a \usepackage{showframe} to see what I mean), and for some reason it is not getting used. However, if you add the following:

\def\thebibliography#1{%
 \ifrawbibliography
 \else
  \newpage
  \thispagestyle{empty}%
  \addcontentsline{toc}{chapter}{REFERENCES}%
% Switch singlespace to after the heading gets printed.
  \mainheading{REFERENCES}%
  \par\removelastskip\singlespace\par\removelastskip% GBG Oct 1993
  \fixmainheadingSKIP
 \fi
  \list{[\arabic{enumi}]}%
  {\settowidth\labelwidth{[#1]}\leftmargin%
     \labelwidth\advance\leftmargin\labelsep\usecounter{enumi}}%
  \def\newblock{\hskip .11em plus .33em minus -.07em}%
  \sloppy\clubpenalty4000\widowpenalty4000%
  \sfcode`\.=1000\relax
}

to your document, the error about \newblock not being defined will go away. You can add it to the main file as in the example below, or put the above definition into your own .sty (called, say, languagebstfix.sty) and load it with \usepackage.

\documentclass[11pt,Chicago]{uuthesis}

% to make a self-contained example, we can use this package, which
% lets us create a bibliography file with the same name (except for
% the '.bib' extension) as the main file.
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Levon07,
author = {Levon, Erez},
title = {{Sexuality in context}},
journal = {Language in Society},
year = {2007},
volume = {36},
pages = {533--554},
}
\end{filecontents}

\usepackage{thesis}% required by .cls
\usepackage{natbib}

%%% TAKEN FROM uuthesis2e.cls
\def\thebibliography#1{%
 \ifrawbibliography
 \else
  \newpage
  \thispagestyle{empty}%
  \addcontentsline{toc}{chapter}{REFERENCES}%
% Switch singlespace to after the heading gets printed.
  \mainheading{REFERENCES}%
  \par\removelastskip\singlespace\par\removelastskip% GBG Oct 1993
  \fixmainheadingSKIP
 \fi
  \list{[\arabic{enumi}]}%
  {\settowidth\labelwidth{[#1]}\leftmargin%
     \labelwidth\advance\leftmargin\labelsep\usecounter{enumi}}%
  \def\newblock{\hskip .11em plus .33em minus -.07em}%
  \sloppy\clubpenalty4000\widowpenalty4000%
  \sfcode`\.=1000\relax
}

\begin{document}

A citation: \citep{Levon07}


\bibliographystyle{language}
\bibliography{\jobname}

\end{document}

Note also that there is a similar .cls called uuthesis2e.cls. The differences seem superficial, but maybe it represents the 'preferred' version..?

As for this: ---

Basically I need to remove the apostrophe comma after the Author name in the citation so it doesn't look like APA style and looks like LSA style (which I think the author of the language.bst) based his code off the APAcite code and so it still retains the apostrophe. How can I remove it based on the code?

--- with recent versions of natbib, and as in the updated answer below, you can simply write:

\setcitestyle{aysep={}} 
% with older versions (< version 8), you need to leave 
% the 5th argument of `\bibpunct` empty; e.g.,
% \bibpunct{(}{)}{;}{a}{}{;}

Updated answer

Given the very custom spacing the class uses for its environments (all essentially localized versions of \list with different settings), I think it is better to forgo the class' \def of \thebibliography and use one based off of the report class, but tweaked for use with uuthesis.cls (still not sure why there is also a uuthesis2e.cls -- they seem at least mostly the same). So, here's how'd I do it:

\documentclass[11pt,Chicago,twoside]{uuthesis2e}
\usepackage{showframe}
% to make a self-contained example, we can use this package, which
% lets us create a bibliography file with the same name (except for
% the '.bib' extension) as the main file.
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Levon07,
author = {Levon, Erez},
title = {{Sexuality in context context context context context context context context context context context context context context context}},
journal = {Language in Society},
year = {2007},
volume = {36},
pages = {533--554},
}
\end{filecontents}

\usepackage{thesis}% required by .cls
\newenvironment{thebibliography}{}{}% <-- keep natbib happy
\usepackage{natbib}
\setcitestyle{aysep={}}

%%% The following can be put into a .sty file and then loaded normally:
%%% FROM HERE:
% Set the 'hang' for the bibliography; length can be changed...
\newdimen\bibindent
\setlength\bibindent{1.5em}

% Set name for the 'thebibliography' environment
\renewcommand*{\bibname}{References}

\makeatletter % for the '@' in command names (not needed in a .sty file)

\newcommand\uuthesis@bibindent{% = \@openbib@code from natbib.sty
    \advance\leftmargin\bibindent
    \itemindent -\bibindent
    \listparindent \itemindent
    \parsep \z@
    }%
\def\newblock{\hskip .11em\@plus.33em\@minus.07em}

\renewenvironment{thebibliography}[1]
     {%
       \thispagestyle{empty}%
       \addcontentsline{toc}{chapter}{\bibname}% <-- prefix \MakeUpppercase for 'REFERENCES'
       \mainheading{\MakeUppercase\bibname}%   <-- uuthesis method
       \par\removelastskip\singlespace\par\removelastskip% GBG Oct 1993
       \fixmainheadingSKIP
       \list{}%
       {%
         \advance\leftmargin-\leftmargin
         \advance\leftmargin\bibindent
       }%
       \leftmargin\labelwidth
       \uuthesis@bibindent
       \sloppy
       \clubpenalty4000
       \@clubpenalty \clubpenalty
       \widowpenalty4000%
       \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
       \endlist}

\makeatother % make '@' inaccessible again (not needed in a .sty)
%%% TO HERE:

\begin{document}

\noindent
A citation: \citep{Levon07}


\bibliographystyle{language}
\bibliography{\jobname}

\end{document}

One thing you might want to consider, depending on how 'into' the TeX world you become, is creating your own thesis that adheres to your university's regulations. You don't need to make a whole .cls by any means, and by doing so, you will learn much more about how things fit together. Thesis requirements may often be draconian and typographically questionable, but they are usually quite easy to follow. (The difficulty is often managing to make the thing look nice despite the requirements for double-spacing, and so forth. And the danger is that it can become a sometimes-fun, sometimes-frustrating way to 'waste' time...)