11

I know how to include a .bib bibliography in an article (using \cite etc.). Now I want to include a bibliography in a moderncv document, which is different since you are not citing but just want a list of your publications. It should be in the following form:

BIBLIOGRAPHY

Theses

[2] My second thesis

[1] My first thesis

Papers

[1] My first paper

I have a functional moderncv .tex document

\documentclass[11pt,a4paper]{moderncv}
\usepackage{cite}
...
\begin{document}
...
\subsection{Papers}
\cite{paperX}
...
\bibliographystyle{plain}
\bibliography{monbib}
\end{document}

and a .bib file. But when I compile it, citation numbers (e.g. [1]) show at the places where I cited something, and the total bibliography is given at the end. This corresponds to my code. What should I change in order to obtain the desired form as introduced above?

UPDATE - I have following updated MWE

\documentclass[11pt,a4paper]{moderncv}
\usepackage{cite}
\familyname{Doe}
\firstname{John}
\begin{document}
\subsection{Thesis}
    \nocite{*}
    \bibliographystyle{unsrtdin}

    \makeatletter
    \def\@biblabel#1\hfill{[#1]}
    \makeatother
    \bibliography{tempbib}
\subsection{Papers}

    \makeatletter
    \def\@biblabel#1\hfill{[#1]}
    \makeatother
    \bibliography{tempbib}

\end{document}

and .bib file

@MastersThesis{key,
    author     =     {Doe, John},
    title     =     {My nice thesis},
    school     =     {Department of chocolate},
    address     =     {Switserland},
    year     =     {2013},
    note = {promotor: Francesca}
    }

with following result: enter image description here

I still have some issues:

  1. How can I get rid of the Publications titles?
  2. How can I use only some of the entries of my .bib file? Alternatively, one could make different files for each subsection, but it seems that it is not possible to include multiple .bib files using \bibliography{name}.
  3. The numbers [1], ... seem to work with \bibliographystyle{unsrtdin}. But what if I want to use an other style such as plain? In the latter case, the numbers disappear.
  4. How can I put the items in reverse order? So if my .bib file consists of entries

A

B

C

the cv should contain

[3] C

[2] B

[1] A

  • 1
    never heard of a bibliography in a CV before. I'd put these things in a new section – naphaneal Mar 20 '16 at 1:00
  • 1
    See for example question tex.stackexchange.com/questions/99521/… – Mensch Mar 20 '16 at 16:20
  • Why do you need numbers for your entries? Using biblatex, you can create different bibliographies based on your entrytypes and can sort them by year (ascending or descending order, your choice). – Johannes_B Mar 27 '16 at 15:16
  • 1
    @Naphaneal Ah, see what you're saying. In fact, here's a nice example) of a cv (see "So You Like My Vita") that does just that. – Dɑvïd Mar 28 '16 at 9:13
  • 1
    @MWc Yes, I see that. And I can appreciate what might be in mind with wanting to use a .bib file instead of manual data. The latter ought to give you more flexibility, though, and once a CV is set up, that data wouldn't be hard to maintain ... whereas I do see plenty of questions here from those struggling with tweaking bibliography styles! FWIW. – Dɑvïd Mar 28 '16 at 12:13
8

Well, in my comment I wrote "for example". That ment that there are several questions related to the tags bibliographies and moderncv on this page.

At last combining some of them can lead you to the following solution. That's what I did. You asked:

  1. How can I get rid of the Publications titles?
  2. How can I use only some of the entries of my .bib file? Alternatively, one could make different files for each subsection, but it seems that it is not possible to include multiple .bib files using \bibliography{name}.
  3. The numbers 1, ... seem to work with \bibliographystyle{unsrtdin}. But what if I want to use an other style such as plain? In the latter case, the numbers disappear.
  4. How can I put the items in reverse order? So if my .bib file consists of entries

Answers to the list above:

  1. That depends on the method you use for creating the bibliography. I used biblatex. Then you can use command \printbibliography[type=thesis,title={Theses}]. Option title gives the wanted heading.
  2. Please create an own bib file for your cv. That has seceral advantages: it keeps the file small, you can locate errors inside it better and you have only the entries inside you really need for your cv. Otherwise it is easier to check if all entries are added.
  3. At last this depends on the used style and used package biblatex or not. Decide what you want and your that layout. I realy think there is no reason to change the labels, if you do not want to use no labels (see my linked answer in my comment).
  4. Reverse order does mean the latest thesis or paper first, the latest document last? That means you have to do two things: sorting the entries by year descending to get the wanted order and a method to change the numbering to be reverse (at last command citesinthissection).

Now please check the following MWE:

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@thesis{key2,
  author  = {Doe, John},
  title   = {My nice thesis 2},
  school  = {Department of cheese},
  address = {Switzerland},
  year    = {2015},
}
@thesis{key1,
  author  = {Doe, John},
  title   = {My nice thesis},
  school  = {Department of chocolate},
  address = {Switserland},
  year    = {2013},
  note    = {promotor: Francesca},
}
@article{paper3,
  author    = {Doe, John}, 
  title     = {My third paper title}, 
  journal   = {Journal Name},
  year      = {2016}, 
  publisher = {Publisher},
  address   = {City},
  number    = {6}, 
  pages     = {32--46}, 
  issn      = {1234-5678},
}
@article{paper2,
  author    = {Doe, John}, 
  title     = {My second paper title}, 
  journal   = {Journal Name},
  year      = {2015}, 
  publisher = {Publisher},
  address   = {City},
  number    = {5}, 
  pages     = {32--46}, 
  issn      = {1234-5678},
}
@article{paper1,
  author    = {Doe, John}, 
  title     = {My first paper title}, 
  journal   = {Journal Name},
  year      = {2014}, 
  publisher = {Publisher},
  address   = {City},
  number    = {4}, 
  pages     = {32--46}, 
  issn      = {1234-5678},
}
\end{filecontents*}


\documentclass[11pt,sans]{moderncv}

\usepackage[%
  backend=biber,
  defernumbers=true,
  sorting=ydnt,         % Sort by year (descending), name, title
% sorting=none,         % Do not sort at all. All entries are processed in citation order.
]{biblatex}
\addbibresource{\jobname.bib} % to use bib file created with filecontents

\makeatletter
\newcommand{\citesinthissection}[1]{\xdef\@totalcites{#1}}
% http://tex.stackexchange.com/q/66829/5764
\newcounter{numbibentries}
\renewbibmacro*{finentry}{\stepcounter{numbibentries}\finentry}
% http://tex.stackexchange.com/q/123805/5764
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{% label format from numeric.bbx
        \printfield{labelprefix}%
        \number\numexpr\@totalcites-\abx@field@labelnumber+1\relax}}
     {\setlength{\topsep}{0pt}% layout parameters from moderncvstyleclassic.sty
      \setlength{\labelwidth}{\hintscolumnwidth}%
      \setlength{\labelsep}{\separatorcolumnwidth}%
      \leftmargin\labelwidth%
      \advance\leftmargin\labelsep}%
      \sloppy\clubpenalty4000\widowpenalty4000}
  {\endlist}
  {\item}
\makeatother

\usepackage[utf8]{inputenc}
\usepackage[scale=0.75]{geometry}

\moderncvstyle{classic}
\moderncvcolor{blue}

% personal data
\name{John}{Doe}
\title{Resumé title}
\address{street and number}{postcode city}{country}
\phone[mobile]{+1~(234)~567~890}
\phone[fixed]{+2~(345)~678~901}
\phone[fax]{+3~(456)~789~012}
\email{john@doe.org}
\homepage{www.johndoe.com}
\social[linkedin]{john.doe}
\social[twitter]{jdoe}
\social[github]{jdoe}
\extrainfo{additional information}
\photo[64pt][0.4pt]{example-image-a}
\quote{Some quote}


\begin{document}

\makecvtitle

\nocite{key1,key2}
\citesinthissection{2}% There are 2 cites in this section
\printbibliography[type=thesis,title={Theses}]

\citesinthissection{5}% There are 3 cites in this section + 2 above
\nocite{paper1,paper2,paper3}
\printbibliography[type=article,title={Papers}]

\end{document}

and the result:

result of mwe

At last a remark:

because we use \nocite{} we have a little problem counting the entries for each section ("Theses" and "Papers"). It seems that nocite did only see all "nocited" bib entries.

\nocite{key1,key2}
\citesinthissection{2}% There are 2 cites in this section
\printbibliography[type=thesis,title={Theses}]

That's the reason we write the code above to have two thesis numbered in the way we want.

The following \nocite command adds more entries to the total sum of "nocited" entries. In my example total 5. So we need to write:

\citesinthissection{5}% There are 3 cites in this section + 2 above
\nocite{paper1,paper2,paper3}
\printbibliography[type=article,title={Papers}]

We have total 5 nocited entries, but in the section "papers" we will print only 3. To get the right numbers we have to tell \citesinthissection the total number of nocited entries.

  • for some reason, there is no references in the pdf generated on my machine – sunxd Aug 27 at 14:41
  • @sunxd Well, then please ask a new question, add what OS and TeX distribution you use, add your used tex code and add error messages you got in the log file too. Give as mutch informations you can to describe your issue ... – Mensch Aug 28 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.