1

I would like to change the numbering of the reference in the text, as it is solved in this question: How to customize bibtex numbering in a document? without altering the order in which references are shown.

For example:

\begin{filecontents}{\jobname.bib}

@book{Knuth1984texbook,
    Author = {Knuth, D.E.},
    Title = {The TEXbook, volume A of Computers and typesetting},
    Year = {1984}}

@book{Chomsky1957,
    Address = {The Hague},
    Author = {Noam Chomsky},
    Publisher = {Mouton},
    Title = {Syntactic Structures},
    Year = {1957}}

@book{Chomsky1965,
    Address = {Cambridge Mass.},
    Author = {Noam Chomsky},
    Publisher = {{MIT} Press},
    Title = {Aspects of the Theory of Syntax},
    Year = {1965}}
\end{filecontents}
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{bibentry}
\usepackage{enumitem}
\SetLabelAlign{bibright}{\hss\llap{[#1]}}
\newcounter{mynum}
\newcommand\mycite[2]{[#1]\setcounter{mynum}{0}\addtocounter{mynum}{#1-1}\refstepcounter{mynum}\label{#2}}
\newcommand\mybib[1]{\item[\ref{#1}]\bibentry{#1}}

\begin{document}
\section{First section}

This document is an example of \texttt{thebibliography} environment using 
 bibliography management. Three items are cited: \emph{Syntactic Structures} 
book \mycite{6}{Chomsky1957}, \emph{Aspects} \mycite{4}{Chomsky1965}, and  
Donald Knuth's TeXBook \mycite{10}{Knuth1984texbook}. The Linguistics related items are
[\ref{Chomsky1965},\ref{Chomsky1957}].
\medskip
\bibliographystyle{unsrtnat}
\nobibliography{\jobname}
\begin{itemize}[labelwidth=!,labelsep=1em,align=bibright]
\mybib{Chomsky1957}
\mybib{Chomsky1965}
\mybib{Knuth1984texbook}
\end{itemize}
\end{document}

would create this:

enter image description here

Meaning that the order is altered, I would like that the references are shown in their normal ordering, that is: [4] [6] [10]

Thank you for your help!


edit:

I would like to use this kind of behaviour for my compendium thesis. There are 6 publications that I want with the specific numbering 1 to 6 because they are the main papers composing the thesis. Even if they do not appear in that order in the text I would need that they are cited as 1,2,3,4,5,6. After that, the rest of citations (around 150) can have any ordering and of course I would not like to input them manually.

  • 1
    You could change the order in the itemize environment: \begin{itemize}[labelwidth=!,labelsep=1em,align=bibright] \mybib{Chomsky1965} \mybib{Chomsky1957} \mybib{Knuth1984texbook} \end{itemize} Should gve you the desired result. – leandriis May 17 at 17:31
1

In this solution to the problem, the bibliography is manually created, in that each item is simply in the order listed in the itemize environment. So you can simply reorder the elements in the list environment and to match the numeric order.

\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{bibentry}
\usepackage{enumitem}
\SetLabelAlign{bibright}{\hss\llap{[#1]}}
\newcounter{mynum}
\newcommand\mycite[2]{[#1]\setcounter{mynum}{0}\addtocounter{mynum}{#1-1}\refstepcounter{mynum}\label{#2}}
\newcommand\mybib[1]{\item[\ref{#1}]\bibentry{#1}}

\begin{document}
\section{First section}

This document is an example of \texttt{thebibliography} environment using 
 bibliography management. Three items are cited: \emph{Syntactic Structures} 
book \mycite{6}{Chomsky1957}, \emph{Aspects} \mycite{4}{Chomsky1965}, and  
Donald Knuth's TeXBook \mycite{10}{Knuth1984texbook}. The Linguistics related items are
[\ref{Chomsky1965},\ref{Chomsky1957}].
\medskip
\bibliographystyle{unsrtnat}
\nobibliography{\jobname}
\begin{itemize}[labelwidth=!,labelsep=1em,align=bibright]
\mybib{Chomsky1965}
\mybib{Chomsky1957}
\mybib{Knuth1984texbook}
\end{itemize}
\end{document}

output of code

  • Hello. Thank you very much for your answer. Does it mean that I have to add manually all my bibliography? I mean, there are like 8 entries that I want to have with a fixed number and then, around 150 that I do not care – Aurora González Vidal May 20 at 10:07
  • @AuroraGonzálezVidal The solution is meant for a very specific purpose: to allow references to specific entries in one document in another document, so yes, it is designed to be manual. If you have a larger bibliography, it's very unclear why you want some to be fixed. Maybe you could explain a bit more in your question what your specific problem is, because it sounds like this solution isn't appropriate for what you want to do. – Alan Munn May 20 at 12:58
  • Thanks @Alan, I think I have clarified it. Sorry for the confusion. – Aurora González Vidal May 21 at 10:45
1

Based on https://tex.stackexchange.com/a/355331/189125

As already said in my previous answer to How to customize bibtex numbering in a document?, you can use the xcite package to import the citation from another file:

\documentclass{article}

\usepackage{xcite}
\externalcitedocument{document2}

\let\oldbibitem\bibitem
\renewcommand{\bibitem}[1]{\oldbibitem[\cite{#1}]{#1}}
\makeatletter
\renewcommand\@biblabel[1]{#1}
\makeatother

\begin{document}

\cite{bertram}
\cite{angenendt}

\bibliographystyle{plain}
\bibliography{biblatex-examples} 

\end{document}

enter image description here

  • Hello. Thank you for your answer but I think I cannot reproduce the example you have given since I do not have document2 available – Aurora González Vidal May 20 at 10:06
  • @AuroraGonzálezVidal The idea is that you have two documents: one with its own bibliography (call this document2) which has its own bibliography, and the document you want to use selected references in. So document2 in this example is the other document that has the references you want to copy into the new document. – Alan Munn May 20 at 13:00

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.