ge-ne / bibtool

BibTool is a tool for manipulating BibTeX data bases. BibTeX provides a mean to integrate citations into LaTeX documents. BibTool allows the manipulation of BibTeX files which goes beyond the possibilities -- and intentions -- of BibTeX.
GNU General Public License v2.0
209 stars 32 forks source link

Problems with sorting by year #68

Closed egarpor closed 4 years ago

egarpor commented 4 years ago

I have been running

bibtool -S -sort.format='{%s($year)}' -i example.bib -o example_sorted.bib

with version 2.67 on the next example.bib file:

@article{Wang2002,
    title       = {Exponential bounds of mean error for the kernel regression estimates with directional data},
    author      = {Wang, X. M.},
    year        = {2002},
    journal     = {Chinese Ann. Math. Ser. A},
    fjournal    = {Chinese Annals of Mathematics. Series A. Shuxue Niankan. A Ji},
    volume      = {23},
    number      = {1},
    pages       = {55--62}
}
@article{Wang2000b,
    title       = {Nearest neighbor estimator for density function of directional data},
    author      = {Wang, X. M. and Ma, L.},
    year        = {2000},
    journal     = {J. Biomath.},
    fjournal    = {Journal of Biomathematics. Shengwu Shuxue Xuebao},
    volume      = {15},
    number      = {3},
    pages       = {332--338}
}
@article{Wang2001,
    title       = {Laws of the iterated logarithm for kernel estimator of density function of spherical data},
    author      = {Wang, X. and Zhao, L.},
    year        = {2001},
    journal     = {J. Syst. Sci. Math. Sci.},
    fjournal    = {Journal of Systems Science and Mathematical Sciences},
    volume      = {21},
    number      = {3},
    pages       = {264--273}
}
@article{Zhao2005,
    title       = {Kernel stereographic projection density estimator and its pointwise convergence rate},
    author      = {Zhao, Y. and Yang, Z. H.},
    year        = {2005},
    journal     = {Chinese Ann. Math. Ser. A},
    fjournal    = {Chinese Annals of Mathematics. Series A. Shuxue Niankan. A Ji},
    volume      = {26},
    number      = {1},
    pages       = {19--30}
}
@article{Scealy2019,
    title       = {Scaled von {M}ises--{F}isher distributions and regression models for paleomagnetic directional data},
    author      = {Scealy, J. L. and Wood, A. T. A.},
    year        = {2019},
    journal     = {J. Am. Stat. Assoc.},
    fjournal    = {Journal of the American Statistical Association},
    volume      = {114},
    number      = {528},
    pages       = {1547--1560},
    doi         = {10.1080/01621459.2019.1585249}
}
@article{Kim2019,
    title       = {Small-sphere distributions for directional data with application to medical imaging},
    author      = {Kim, B. and Huckemann, S. and Schulz, J. and Jung, S.},
    year        = {2019},
    journal     = {Scand. J. Stat.},
    fjournal    = {Scandinavian Journal of Statistics},
    volume      = {46},
    number      = {4},
    pages       = {1047--1071},
    doi         = {10.1111/sjos.12381}
}
@article{Ghosh2003,
    title       = {Semiparametric {B}ayesian techniques for problems in circular data},
    author      = {Ghosh, K. and Jammalamadaka, S. R. and Tiwari, R.},
    year        = {2003},
    journal     = {J. Appl. Stat.},
    fjournal    = {Journal of Applied Statistics},
    volume      = {30},
    number      = {2},
    pages       = {145--161},
    doi         = {10.1080/0266476022000023712}
}

But the output that I get is not sorted by year:

@Article{     wang2002,
  title     = {Exponential bounds of mean error for the kernel regression
          estimates with directional data},
  author    = {Wang, X. M.},
  year      = {2002},
  journal   = {Chinese Ann. Math. Ser. A},
  fjournal  = {Chinese Annals of Mathematics. Series A. Shuxue Niankan. A
          Ji},
  volume    = {23},
  number    = {1},
  pages     = {55--62}
}

@Article{     wang2000b,
  title     = {Nearest neighbor estimator for density function of
          directional data},
  author    = {Wang, X. M. and Ma, L.},
  year      = {2000},
  journal   = {J. Biomath.},
  fjournal  = {Journal of Biomathematics. Shengwu Shuxue Xuebao},
  volume    = {15},
  number    = {3},
  pages     = {332--338}
}

@Article{     wang2001,
  title     = {Laws of the iterated logarithm for kernel estimator of
          density function of spherical data},
  author    = {Wang, X. and Zhao, L.},
  year      = {2001},
  journal   = {J. Syst. Sci. Math. Sci.},
  fjournal  = {Journal of Systems Science and Mathematical Sciences},
  volume    = {21},
  number    = {3},
  pages     = {264--273}
}

@Article{     zhao2005,
  title     = {Kernel stereographic projection density estimator and its
          pointwise convergence rate},
  author    = {Zhao, Y. and Yang, Z. H.},
  year      = {2005},
  journal   = {Chinese Ann. Math. Ser. A},
  fjournal  = {Chinese Annals of Mathematics. Series A. Shuxue Niankan. A
          Ji},
  volume    = {26},
  number    = {1},
  pages     = {19--30}
}

@Article{     scealy2019,
  title     = {Scaled von {M}ises--{F}isher distributions and regression
          models for paleomagnetic directional data},
  author    = {Scealy, J. L. and Wood, A. T. A.},
  year      = {2019},
  journal   = {J. Am. Stat. Assoc.},
  fjournal  = {Journal of the American Statistical Association},
  volume    = {114},
  number    = {528},
  pages     = {1547--1560},
  doi       = {10.1080/01621459.2019.1585249}
}

@Article{     kim2019,
  title     = {Small-sphere distributions for directional data with
          application to medical imaging},
  author    = {Kim, B. and Huckemann, S. and Schulz, J. and Jung, S.},
  year      = {2019},
  journal   = {Scand. J. Stat.},
  fjournal  = {Scandinavian Journal of Statistics},
  volume    = {46},
  number    = {4},
  pages     = {1047--1071},
  doi       = {10.1111/sjos.12381}
}

@Article{     ghosh2003,
  title     = {Semiparametric {B}ayesian techniques for problems in
          circular data},
  author    = {Ghosh, K. and Jammalamadaka, S. R. and Tiwari, R.},
  year      = {2003},
  journal   = {J. Appl. Stat.},
  fjournal  = {Journal of Applied Statistics},
  volume    = {30},
  number    = {2},
  pages     = {145--161},
  doi       = {10.1080/0266476022000023712}
}

Tried also with -s, and -sort.format='{%4d($year)} and -sort.format='%d($year), but no luck. Help is much appreciated!

ge-ne commented 4 years ago

I have been running


bibtool -S -sort.format='{%s($year)}' -i example.bib -o example_sorted.bib

You want to use

bibtool -S --'sort.format{%d(year)}' -i example.bib -o example_sorted.bib

Note: sort.format is no command line option but a resource statement.

Also note: the order within a year is undefined...

egarpor commented 4 years ago

Many thanks! That did work :)