Featured Book

LaTeX Beginners Guide

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 424 on Sat May 04, 2013 4:33 pm

Users browsing this forum: No registered users and 3 guests

Partner Sites

goLaTeX
TeXblog
TeXnicCenter
TeXample

Environment thebibliography undefined when using letter Topic is solved

Add tags Information and discussion about specific document classes and how to create your own document classes.

Environment thebibliography undefined when using letter

Postby hany.azzam on Mon Dec 8th, 2008

Greetings,
I am using the letter document class, and I want to include some citations. From what I have gathered the letter document class doesn't allow having bibliography items in the letter body. If that's the case, is there a workaround?
Here is the code that I am trying to run:

Code: Select all  •  Open in writeLaTeX
\documentclass{letter}

\signature{}
\begin{document}
\begin{letter}{}

\begin{center}{}
\end{center} \vfill

\opening{Dear}
 
\closing{Sincerely yours,}
 
\encl{}                
\end{letter}
\bibliographystyle{plain}
\bibliography{bibdb}
\end{document
}


I receive the following error:
Latex Error: Environment thebibliography undefined.

The purpose of using a letter class and citations is because I want to write a cover letter and I need to refer to some citations inside of the letter's body.

Thank you,
h.
hany.azzam
 
Posts: 1
Joined: Mon Dec 8th, 2008

Re: Environment thebibliography undefined when using letter

Postby localghost on Mon Dec 8th, 2008

This environment is simply not defined in the used class because it's very unusual to write a letter with references to a bibliography. But you could borrow the code from the article class. Open a shell (command prompt) to find out where this class file is located.
Code: Select all  •  Open in writeLaTeX
kpsewhich article.cls

The code for the thebibliography environment and all other necessary stuff can be found very easily.


Best regards and welcome to the board
Thorsten¹
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 12.3, TeX Live 2012, TeXworks 0.5 (r1288)
² Learning TeX (and trying to understand it).
User avatar
localghost
Site Moderator
 
Posts: 8739
Joined: Fri Feb 2nd, 2007
Location: Braunschweig, Germany

Re: Environment thebibliography undefined when using letter  Topic is solved

Postby lwaldron on Thu Feb 11th, 2010

It's not quite so simple, as there are a number of things that must be defined to get the bibliography to work. I got it working with the following code copied from article.cls into a file "letterbib.sty" then the command \usepackage{letterbib} in the preamble:

Code: Select all  •  Open in writeLaTeX
\setlength \labelsep {.5em}
\newcommand\newblock{\hskip
  .11em\@plus.33em\@minus.07em} \let\@openbib@code\@empty
\newcommand\refname{References}
\newcommand\section{\@startsection
  {section}{1}{\z@
}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\Large\bfseries}}
\newenvironment{thebibliography}[1]
{\section*{\refname
}%
  \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
  \list{\@biblabel{\@arabic\c@enumiv}}%
  {\settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code
    \usecounter{enumiv}%
    \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}%
  \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty
  \widowpenalty4000%
  \sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty
      `thebibliography' environment}
}%
      \endlist}
lwaldron
 
Posts: 2
Joined: Thu Feb 11th, 2010

Re: Environment thebibliography undefined when using letter

Postby mikeg on Wed Mar 17th, 2010

Hi lwaldron,

Just wanted to thank you for posting your solution to the problem. It came in very handy.

Best,

Mike
mikeg
 
Posts: 2
Joined: Wed Mar 17th, 2010

Re: Environment thebibliography undefined when using letter

Postby lwaldron on Wed Mar 17th, 2010

You're welcome Mike, it's nice to hear that posting it was worthwhile.
-Levi
lwaldron
 
Posts: 2
Joined: Thu Feb 11th, 2010

Re: Environment thebibliography undefined when using letter

Postby acfrery on Tue Jan 29th, 2013

Thank you very much for the solution of an issue that has been bothering me for years!
Alejandro
acfrery
 
Posts: 1
Joined: Tue Jan 29th, 2013


Return to Document Classes

Who is online

Users browsing this forum: No registered users and 3 guests