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.

I currently write my CV and I want to include a Bibliography. The following is my header:

\documentclass[11pt,a4paper,sans]{moderncv}

\usepackage[latin1]{inputenc}

\usepackage[ngerman]{babel}

\usepackage[T1]{fontenc}

\usepackage{lmodern}

\usepackage{amsmath, amssymb}

\usepackage{enumerate}

\usepackage{dsfont}

\usepackage{multibib,chapterbib, babelbib}

\moderncvtheme[red]{classic}

\usepackage[left=25mm,right=25mm, top=30mm, bottom=30mm]{geometry}

\renewcommand{\baselinestretch}{1.25}

\AtBeginDocument{\recomputelengths}

So now I want to include a Bibliography, but I have the following problems with it:

  1. The bibliography itself is indented nearly half the page. How to force Latex to start at a "normal" left margin?

  2. The numbers for the different sources are not shown in the bibliography, even though in the CV the numbers appear if I \cite{} them, and if you want to look the source up, you have to count through. What to do to make the numbers appear in the bibliography too? Maybe something is missing in my header.\

Thank you.

share|improve this question
    
Those end of lines commands \\ will produce errors; remove them from the preamble. Please modify your example code: turn it into a complete and minimal document illustrating the problem. –  Gonzalo Medina Aug 16 '12 at 16:09
    
As i side note, I just noticed that you haven't accepted or up-voted any of the answers to your questions. Please consider up-voting good answers and accepting the ones that best solved your problems (up-voting and accepting are two different actions); in case of doubt on how/why to accept answers,please see How do you accept an answer?. –  Gonzalo Medina Aug 16 '12 at 16:26
    
Will do as soon as I registered! –  maad Aug 16 '12 at 19:59

1 Answer 1

up vote 3 down vote accepted

By default moderncv doesn't show labels in the bibliography; to show them, add the following lines to the preamble:

\makeatletter
\renewcommand*\bibliographyitemlabel{\@biblabel{\arabic{enumiv}}}
\makeatother

The other issue requires a redefinition of the thebibliography environment (filecontents* is not essential in the solution; it's just to get a complete example):

\begin{filecontents*}{xxyyy.bib}
@book{testa,
    author = "The AuthorA",
    title = "The TitleA",
    year = "2012",
    publisher = "The PublisherA"
}
@book{testb,
    author = "The AuthorB",
    title = "The TitleB",
    year = "2012",
    publisher = "The PublisherB"
}
\end{filecontents*}

\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvtheme[red]{classic}
\usepackage[ngerman]{babel}
\usepackage{multibib,chapterbib, babelbib}

\firstname{John}
\familyname{Doe}

\makeatletter
\renewcommand*\bibliographyitemlabel{\@biblabel{\arabic{enumiv}}}
\renewenvironment{thebibliography}[1]%
  {%
     \setlength\hintscolumnwidth{0pt}
     \setlength\separatorcolumnwidth{0pt}
     \bibliographyhead{\refname}%
%    \small%
    \begin{list}{\bibliographyitemlabel}%
      {%
        \setlength{\separatorcolumnwidth}{0.025\textwidth}
        \setlength{\topsep}{0pt}%
        \settowidth\labelwidth{\@biblabel{#1}}
        \setlength{\labelsep}{\separatorcolumnwidth}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep
        \@openbib@code%
        \usecounter{enumiv}%
        \let\p@enumiv\@empty%
        \renewcommand\theenumiv{\@arabic\c@enumiv}}%
        \sloppy\clubpenalty4000\widowpenalty4000%
  }%
  {%
    \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
    \end{list}%
  }
\makeatother

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\nocite{*}

\bibliographystyle{plain}
\bibliography{xxyyy}

\end{document}

enter image description here

share|improve this answer
    
Thank you for the answer, the numbering works alright. But still it is indented and I want to put the bibliography a bit more to the left side. And if possible, I want a title "Bibliography" in bold and bigger letters. How to do this? –  maad Aug 16 '12 at 19:59
    
@maad I've updated my answer with a solution. –  Gonzalo Medina Aug 16 '12 at 22:28
    
Works super perfect and is doing exactly what I was looking for. Thanks Gonzalo. –  maad Aug 17 '12 at 8:49
    
There is actually no need to redefine the thebibliography environment. All you need is to put \setlength\hintscolumnwidth{0pt} and \setlength\separatorcolumnwidth{0pt} before \bibliography{xxyyy}. –  Xavier Aug 17 '12 at 22:10
    
@Xavier I thought about it too, but then the labels and the references are too close; that's why I decided to redefine the environment. –  Gonzalo Medina Aug 17 '12 at 22:12

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.