Bibtex reverse numbering

You can use the etaremune package; this requires redefining thebibliography to use it. I assume you are using the unsrt bibliography style.

\begin{filecontents*}{\jobname.bib}
@article{a,
 author={x y},
 title={a},
 journal={j},
 year=2000,
}
@article{b,
 author={x y},
 title={b},
 journal={j},
 year=2000,
}
@article{c,
 author={x y},
 title={c},
 journal={j},
 year=2000,
}
@article{d,
 author={x y},
 title={d},
 journal={j},
 year=2000,
}
\end{filecontents*}
\documentclass{article}
\usepackage{etaremune}
\makeatletter
\long\def\thebibliography#1{%
  \section*{\refname}%
  \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}
  \settowidth{\dimen0}{\@biblabel{#1}}%
  \setlength{\dimen2}{\dimen0}%
  \addtolength{\dimen2}{\labelsep}
  \sloppy
  \clubpenalty 4000 
  \@clubpenalty 
  \clubpenalty 
  \widowpenalty 4000
  \sfcode `\.\@m
  \renewcommand{\labelenumi}{\@biblabel{\theenumi}} % labels like [3], [2], [1]
  \begin{etaremune}[labelwidth=\dimen0,leftmargin=\dimen2]\@openbib@code
}
\def\endthebibliography{\end{etaremune}}
\def\@bibitem#1{%
  \item \if@filesw\immediate\write\@auxout{\string\bibcite{#1}{\the\value{enumi}}}\fi\ignorespaces
}
\makeatother

\begin{document}
\cite{a,b,c,d}

\bibliographystyle{unsrt}
\bibliography{\jobname}

\end{document}

The filecontents* environment is just to provide a mock bib file.


Here is a concise fix that does reverse numbering for "thebibliography" environment in my CV, using only plain latex without any external package.

EDITS:

  1. write the value of the counter to the aux-file, so you don't need to input the number of publications manually. It was surprisingly concise and straightforward actually.
  2. added commands to get the standard "[1]" (I realized my first answer was not actually doing it)

Original post:

I just input the total number of publications and defined a wrapper around \bibitem (redefining it is a bit more tricky). Because it just modifies the counter value of \bibitem, it has the standard "[1]" bracket style and it works with hyperref.

\begin{thebibliography}{99}
\makeatletter
\newcounter{num}
\newcommand{\MyNbOfPub}{24}%input your number of publications here
\newcommand{\mybibitem}[1]{\stepcounter{num}\setcounter{\@listctr}{\MyNbOfPub-\value{num}}\bibitem{#1}}
\makeatother

\mybibitem{Myfirstref}
...
\mybibitem{Mysecondref}
...
etc...

NB: counters start at 0 thus bibitem automatically labels ref as [N+1] so that a value of "0" in the counter gives ref [1] (and not [0]). Stepping the num counter first takes care of that +1

enter image description here

EDITS (continued):

here is a working example

\documentclass[11pt,letterpaper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{orange}
\usepackage[colorlinks=true,urlcolor=blue,citecolor=blue,unicode]{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[scale=0.9]{geometry}

% Macros
% if \NbOfPub is defined in aux file 
%     the value is automatically read from the aux file
% else (first run)
%     create counter which will be wrote to the aux file at the end of the document
%     (note that we just use this counter as a fixed variable)
\ifdefined\NbOfPub
\else
    \newcount\NbOfPub
    \NbOfPub 0\relax
\fi

\makeatletter
% make square brackets numerical labels 
\renewcommand*{\bibliographyitemlabel}{\@biblabel{\arabic{enumiv}}}
% bibitems margins formatting
\setlength\bibindent{2em}
\renewcommand\@openbib@code{%
    \leftmargin 2em %push bib to the right by that amount
    \itemindent 0em %push item  1st line to the right by that amount
    \listparindent \parindent
    \parsep \z@
    \labelsep 1em %push label to the left from 1st line by that amount
}
% bibliography counter
\newcounter{num}
% define "\metibib", a \bibitem wrapper that counts in reverse
\newcommand{\metibib}[1]{%
    \stepcounter{num}
    \setcounter{\@listctr}{\NbOfPub-\value{num}}
    \bibitem{#1}
}
\makeatother

% document
\setlength{\hintscolumnwidth}{2cm}
\firstname{John}
\familyname{Doe}
\namespacing{1cm}{1cm}
\begin{document}
\makecvtitle
\section{Career Summary}
Here are my publications on A\cite{refA} and B\cite{refB}.

% change bibliography standard name
\renewcommand{\refname}{List of Publications}
% the bibliography
\begin{thebibliography}{9}
\item[] You have \the\NbOfPub\ publications in the .aux file

\item[\textbf{2018}]

\metibib{refA}
\underline{\textbf{J.~Doe}} \textit{et al.}\\
\textit{On topic A}\\
\textbf{Great Journal A}, xx, yyy\\
\url{https://doi.org/xxyyy}

\item[\textbf{2017}]

\metibib{refB}
\underline{\textbf{J.~Doe}} \textit{et al.}\\
\textit{On topic B}\\
\textbf{Great Journal B}, xx, yyy\\
\url{https://doi.org/xxyyy}

\end{thebibliography}

%write number of publications to aux-file
\makeatletter
\write\@auxout{\noexpand\newcount\NbOfPub}
\write\@auxout{\global\NbOfPub \arabic{num}\relax}
\makeatother

\end{document}

and here is the result I get enter image description here

Tags:

Sorting

Bibtex