LaTeX forum ⇒ Document ClassesEnvironment thebibliography undefined when using letter Topic is solved

Information and discussion about specific document classes and how to create your own document classes.
hany.azzam
Posts: 1
Joined: Mon Dec 08, 2008 1:52 am

Environment thebibliography undefined when using letter

Postby hany.azzam » Mon Dec 08, 2008 2:06 am

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:

  1. \documentclass{letter}
  2.  
  3. \signature{}
  4. \begin{document}
  5. \begin{letter}{}
  6.  
  7. \begin{center}{}
  8. \end{center} \vfill
  9.  
  10. \opening{Dear}
  11.  
  12. \closing{Sincerely yours,}
  13.  
  14. \encl{}
  15. \end{letter}
  16. \bibliographystyle{plain}
  17. \bibliography{bibdb}
  18. \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.

Link:
BBcode:
HTML:
Hide post links
Show post links

lwaldron
Posts: 2
Joined: Thu Feb 11, 2010 7:26 am

Postby lwaldron » Thu Feb 11, 2010 7:35 am

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:

  1. \setlength \labelsep {.5em}
  2. \newcommand\newblock{\hskip
  3. .11em\@plus.33em\@minus.07em} \let\@openbib@code\@empty
  4. \newcommand\refname{References}
  5. \newcommand\section{\@startsection
  6. {section}{1}{\z@}%
  7. {-3.5ex \@plus -1ex \@minus -.2ex}%
  8. {2.3ex \@plus.2ex}%
  9. {\normalfont\Large\bfseries}}
  10. \newenvironment{thebibliography}[1]
  11. {\section*{\refname}%
  12. \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
  13. \list{\@biblabel{\@arabic\c@enumiv}}%
  14. {\settowidth\labelwidth{\@biblabel{#1}}%
  15. \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code
  16. \usecounter{enumiv}%
  17. \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}%
  18. \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty
  19. \widowpenalty4000%
  20. \sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty
  21. `thebibliography' environment}}%
  22. \endlist}

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

mikeg
Posts: 2
Joined: Wed Mar 17, 2010 11:08 pm

Postby mikeg » Wed Mar 17, 2010 11:15 pm

Hi lwaldron,

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

Best,

Mike

Link:
BBcode:
HTML:
Hide post links
Show post links

lwaldron
Posts: 2
Joined: Thu Feb 11, 2010 7:26 am

Postby lwaldron » Wed Mar 17, 2010 11:41 pm

You're welcome Mike, it's nice to hear that posting it was worthwhile.
-Levi

Link:
BBcode:
HTML:
Hide post links
Show post links

acfrery
Posts: 1
Joined: Tue Jan 29, 2013 3:32 pm

Postby acfrery » Tue Jan 29, 2013 3:37 pm

Thank you very much for the solution of an issue that has been bothering me for years!
Alejandro

Link:
BBcode:
HTML:
Hide post links
Show post links

Benjamin B
Posts: 1
Joined: Fri May 31, 2013 9:19 pm

Postby Benjamin B » Fri May 31, 2013 9:20 pm

Yeah, thanks lwaldron. Very helpful!

Link:
BBcode:
HTML:
Hide post links
Show post links

geomorphdog
Posts: 1
Joined: Thu Aug 29, 2013 8:39 pm

Postby geomorphdog » Thu Aug 29, 2013 10:38 pm

This worked beautifully. Thanks so much! Maybe it's obvious, but I also had to load the natbib package:

  1. \usepackage{letterbib}
  2. \usepackage{natbib}
Last edited by cgnieder on Fri Aug 30, 2013 10:35 am, edited 1 time in total.
Reason: code markup

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 2 guests