
Я использую расширение BibLaTex под названием "publist" для публикации нумерованного списка моих публикаций. Оно нумерует элементы в порядке возрастания (см. рисунок ниже).
А что, если я хочу, чтобы они были пронумерованы в обратном порядке? Поэтому, начиная с номера [4], присвоенного Смиту 2020, до [1], присвоенного Смиту 2017.
Это сразу же покажет общее количество моих работ на сегодняшний день.
В документации к пакету такой возможности не описано. Однако интересно, можно ли это сделать легко, изменив исходный кодиздательупаковка.
EDIT По вашей просьбе я добавляю исходный код моих TeX-файлов.
\documentclass[11pt]{article}
\usepackage[bibstyle=publist,marginyear=true]{biblatex}
\omitname[John][]{Smith}
\plauthorname[John][]{Smyth}
\addbibresource{publist.bib}
\begin{document}
\title{List of publications}
\author{John Smith}
\date{\today}
\maketitle
\nocite{*}
\printbibliography[heading=none]
\end{document}
Файл publist.bib:
@phdthesis{Smith:2017,
Author = {John Smith},
Publisher = {TheGruiter},
School = {Hogwarts school of magic},
Title = {Investigation on interesting topics},
Year = {2017}}
@book{Smith:2019b,
Address = {Blondon},
Author = {John Smith},
Pages = {23--45},
Publisher = {TheGruiter},
Title = {Funny book},
Year = {2019}}
@article{Smith:2019a,
Author = {John Smith},
Journal = {Journal of interesting papers},
Number = {1},
Pages = {23--45},
Title = {More or less interesting paper},
Volume = {18},
Year = {2019}}
@article{Smith:2020,
Author = {John Smith},
Journal = {Journal of interesting papers},
Number = {3},
Pages = {23--45},
Title = {Very interesting new paper},
Volume = {19},
Year = {2020}}
решение1
Для большинства целей и задач код изbiblatex: Обратная нумерация (т.е. обратный отсчет)Здесь тоже должно сработать.
Так как biblatex
у вас есть своя версия, \mkbibdesc
вам просто нужно изменить \newrobustcmd
ее на \renewrobustcmd
.
Обратите внимание, что этот код, вероятно, не будет работать так, как хотелось бы, если вы активно используете фильтрацию и множественные библиографии (см. также предостережения, упомянутые в ответе на вопросbiblatex: Обратная нумерация (т.е. обратный отсчет)).
\documentclass[11pt]{article}
\usepackage[bibstyle=publist,marginyear=true]{biblatex}
\omitname[John][]{Smith}
\plauthorname[John][]{Smyth}
% Count total number of entries in each refsection
\AtDataInput{%
\csnumgdef{entrycount:\therefsection}{%
\csuse{entrycount:\therefsection}+1}}
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\DeclareFieldFormat{labelnumber}{\mkbibdesc{#1}}
\renewrobustcmd*{\mkbibdesc}[1]{%
\number\numexpr\csuse{entrycount:\therefsection}+1-#1\relax}
\begin{filecontents}{\jobname.bib}
@phdthesis{Smith:2017,
Author = {John Smith},
Publisher = {TheGruiter},
School = {Hogwarts school of magic},
Title = {Investigation on interesting topics},
Year = {2017}}
@book{Smith:2019b,
Address = {Blondon},
Author = {John Smith},
Pages = {23--45},
Publisher = {TheGruiter},
Title = {Funny book},
Year = {2019}}
@article{Smith:2019a,
Author = {John Smith},
Journal = {Journal of interesting papers},
Number = {1},
Pages = {23--45},
Title = {More or less interesting paper},
Volume = {18},
Year = {2019}}
@article{Smith:2020,
Author = {John Smith},
Journal = {Journal of interesting papers},
Number = {3},
Pages = {23--45},
Title = {Very interesting new paper},
Volume = {19},
Year = {2020}}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\title{List of publications}
\author{John Smith}
\date{\today}
\maketitle
\nocite{*}
\printbibliography[heading=none]
\end{document}
Поскольку это, по-видимому, популярная функция для списков публикаций, вы можете предложить ее разработчику напрямую по адресуhttps://github.com/jspitz/biblatex-publist/issues.