1

A while ago I copy-pasted the following code from the internet so that I had categorized publications.

Now I realize that publication order is not corresponding to the order I define in the bibliography. Which command do I have to add to the \renewenvironment{thebibliography} block so that my order is unsorted. Simply setting the bibliographystyle does not work with this customized code.

I tried \renewcommand{\bibliographystyle}{\unsrt} but I suck at LaTeX and don't know what I'm actually doing.

I am using multibib, moderncv and Overleaf.

Here's my code:

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

\makeatletter
\renewenvironment{thebibliography}[1]%
  {%
    \subsection{\refname}%
    \small%
    \begin{list}{\bibliographyitemlabel}%
      {%
        \setlength{\topsep}{0pt}%
        \setlength{\labelwidth}{\hintscolumnwidth}%
        \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
\usepackage{multibib}
\newcites{journal,preprint,bthesis}{{Journals},{Technical Reports \& Pre-prints},{Bachelor Thesis}}
1

You did not show us a compilable MWE so I simply used a shorter template example you can find with class moderncv, version 2.0.0, the current one. If you are using an older one I suggest to update! Or tell us the version you are using in your question. You also did not show us how and which bib entrys you cited in which order and you did not show us the used bib files. Next time please make your question as complete as possible.

For the following I simply used the datas comming with moderncv, version 2.0.0.

The relevant part to cite and build the bibliographys you can see in the following part of code:

%in your preamble:
\newcites{book,misc}{{Books},{Others}} % <==============================

% in your code:
% Publications from a BibTeX file using the multibib package
\section{Publications}
\nocitebook{book1,book2}
\bibliographystylebook{unsrt} % unsrt plain <=================================
\bibliographybook{publications}                   % 'publications' is the name of a BibTeX file
\nocitemisc{misc1,misc2,misc3}
\bibliographystylemisc{unsrt} % unsrt plain <=================================
\bibliographymisc{publications}                   % 'publications' is the name of a BibTeX file

Command \nocitebook{book1,book2} cites first book1, then book2. With command \bibliographystylebook{unsrt} you choose the bibliography style, in this case unsrt, that means show the bib entrys in the bibliography in the order used for citing. Same for the second multibib, you have to do this a third time for your third multibib.

Using multibib changed the usual compiling chain. With the two multibibs shows above you need to compile with:

  1. pdflatex mwe.tex, supposed your cv is stored in file mwe.tex. After compiling the cv you will find two files book.aux and misc.aux in the same directory you have mwe.tex. In your case you should find three files journal.aux, preprint.aux and bthesis.aux.
  2. bibtex book to build the first multibib-bibliography.
  3. bibtex misc to build the second bibliography.
  4. pdflatex mwe.tex twice to get propper page numbers, TOC etc. as usual.

With current version of moderncv (2.0.0) you need not to copy the \renewenvironment{thebibliography}[1]% block into your code. Of course you have to define your used multibibs with \newcites{journal,preprint,bthesis}{{Journals},{Technical Reports \& Pre-prints},{Bachelor Thesis}} in the preamble (as I did for the two bib files in this example).

With the following compilabe MWE (using the bib file publication.bib from moderncv template):

% pdflatex mwe.tex
% bibtex book
% bibtex misc
% pdflatex mwe.tex
% pdflatex mwe.tex
\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{casual}
\moderncvcolor{blue}

\usepackage[scale=0.75]{geometry}

\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-golden-upright}
\quote{Some quote}

\setlength{\footskip}{70pt}

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

\usepackage{multibib}
\newcites{book,misc}{{Books},{Others}} % <==============================


\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}  % arguments 3 to 6 can be left empty
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\section{Extra 2}
\cvlistdoubleitem{Item 1}{Item 4}
\cvlistdoubleitem{Item 2}{Item 5\cite{book1}}
\cvlistdoubleitem{Item 3}{Item 6. Like item 3 in the single column list before, this item is particularly long to wrap over several lines.}

\section{References}
\begin{cvcolumns}
  \cvcolumn{Category 1}{\begin{itemize}\item Person 1\item Person 2\item Person 3\end{itemize}}
  \cvcolumn{Category 2}{Amongst others:\begin{itemize}\item Person 1, and\item Person 2\end{itemize}(more upon request)}
  \cvcolumn[0.5]{All the rest \& some more}{\textit{That} person, and \textbf{those} also (all available upon request).}
\end{cvcolumns}

% Publications from a BibTeX file using the multibib package
\section{Publications}
\nocitebook{book1,book2}
\bibliographystylebook{unsrt} % unsrt plain <=================================
\bibliographybook{publications}                   % 'publications' is the name of a BibTeX file
\nocitemisc{misc1,misc2,misc3}
\bibliographystylemisc{unsrt} % unsrt plain <=================================
\bibliographymisc{publications}                   % 'publications' is the name of a BibTeX file

\end{document}

you get the result:

resulting bibliography

To be sure you can test my given MWE here the sample bib file publication.bib:

%% start of file `publications.bib'.
%% Copyright 2006-2012 Xavier Danaux (xdanaux at gmail.com).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.


@BOOK{book1,
  author = {John Doe and Author 1},
  title = {Title},
  publisher = {Publisher},
  edition = {edition},
  year = {year},
}

@BOOK{book2,
  author = {John Doe and Author 2},
  title = {Title},
  publisher = {Publisher},
  edition = {edition},
  year = {year},
}

@MISC{misc1,
  author = {John Doe},
  title = {Title},
  year = {year},
}

@MISC{misc2,
  author = {John Doe and Author 3},
  title = {Title},
  year = {year},
}

@MISC{misc3,
  author = {John Doe},
  title = {Title},
  year = {year},
}


%% end of file `publications.bib'.

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.