BibTeX, biblatex and biberChange two lists of references

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
freshman7214
Posts: 1
Joined: Fri Mar 31, 2023 11:09 am

Change two lists of references

Post by freshman7214 »

I start to write a work with special requirements and structure, which I can't change. I have several files, which are connected to each other. The main files are: "synopsis" and the most important file for my problem is "biblatex". In "biblatex" we input biblatex + biber enviroment.

I get the following

Image

Image

But I need three lists of References, the first one begins with 1., 2., 3., ... and for the second one and the third one we have common numbering begins with A1., A2., A3., ...

And, of course, in the text, numbers for the second numbering must be [A1], [A2], ...

Image

Image


The main file `synopsis.tex`:

Code: Select all

%&preformat-synopsis
    \RequirePackage[l2tabu,orthodox]{nag} % Раскомментировав, можно в логе получать рекомендации относительно правильного использования пакетов и предупреждения об устаревших и нерекомендуемых пакетах
    \PassOptionsToPackage{bookmarks=false}{hyperref}
    \documentclass[a5paper,10pt,twoside,openany,article]{memoir} %,draft
    
    \input{common/setup}          % общие настройки шаблона
    \input{common/packages}       % Пакеты общие для диссертации и автореферата
    \synopsistrue                 % Этот документ --- автореферат
    \input{Synopsis/synpackages}  % Пакеты для автореферата
    \input{Synopsis/userpackages} % Пакеты для специфических пользовательских задач
    
    \input{common/newnames}       % Новые переменные, которые могут использоваться во всём проекте
    \input{Synopsis/setup}        % Упрощённые настройки шаблона 
    
    \input{common/data}           % Основные сведения
    \input{common/fonts}          % Определение шрифтов (частичное)
    \input{common/styles}         % Стили общие для диссертации и автореферата
    \input{Synopsis/synstyles}    % Стили для автореферата
    \input{Synopsis/userstyles}   % Стили для специфических пользовательских задач
    
    %%% Библиография. Выбор движка для реализации %%%
    \ifnumequal{\value{bibliosel}}{0}{%
        \input{biblio/predefined} % Встроенная реализация с загрузкой файла через движок bibtex8
    }{
        \input{biblio/biblatex}   % Реализация пакетом biblatex через движок biber
    }
    
    \begin{document}
    
    %\input{Synopsis/title}        % Титульный лист
    %\mainmatter                   % В том числе начинает нумерацию страниц арабскими цифрами с единицы
    \mainmatter*                  % Нумерация страниц не изменится, но начнётся с новой страницы
    \input{Synopsis/content}      % Содержание автореферата
    
    \end{document}
File `biblatex.tex`:

Code: Select all

    %%% Реализация библиографии пакетами biblatex и biblatex-gost с использованием движка biber %%%
    
    \usepackage{csquotes} % biblatex рекомендует его подключать. Пакет для оформления сложных блоков цитирования.
    %%% Загрузка пакета с основными настройками %%%
    \makeatletter
    \ifnumequal{\value{draft}}{0}{% Чистовик
    	\usepackage[%
    	backend=biber,% движок
    	bibencoding=utf8,% кодировка bib файла
    	sorting=none,% настройка сортировки списка литературы
    	style=gost-numeric,% стиль цитирования и библиографии (по ГОСТ)
    	language=autobib,% получение языка из babel/polyglossia, default: autobib % если ставить autocite или auto, то цитаты в тексте с указанием страницы, получат указание страницы на языке оригинала
    	autolang=other,% многоязычная библиография
    	clearlang=true,% внутренний сброс поля language, если он совпадает с языком из babel/polyglossia
    	defernumbers=false,% ИЗМЕНИЛ ЭТО С true НА false!!! нумерация проставляется после двух компиляций, зато позволяет выцеплять библиографию по ключевым словам и нумеровать не из большего списка
    	sortcites=true,% сортировать номера затекстовых ссылок при цитировании (если в квадратных скобках несколько ссылок, то отображаться будут отсортированно, а не абы как)
    	doi=false,% Показывать или нет ссылки на DOI
    	isbn=false,% Показывать или нет ISBN, ISSN, ISRN
    	]{biblatex}[2016/09/17]
    	%\ltx@iffilelater{biblatex-gost.def}{2017/05/03}%
    	%{\toggletrue{bbx:gostbibliography}%
    		%\renewcommand*{\revsdnamepunct}{\addcomma}}{}
    }{%Черновик
    	\usepackage[%
    	backend=biber,% движок
    	bibencoding=utf8,% кодировка bib файла
    	sorting=none,% настройка сортировки списка литературы
    	]{biblatex}[2016/09/17]%
    }
    \makeatother
    
    \ifnumgreater{\value{usefootcite}}{0}{
    	\ExecuteBibliographyOptions{autocite=footnote}
    	\newbibmacro*{cite:full}{%
    		\printtext[bibhypertarget]{%
    			\usedriver{%
    				\DeclareNameAlias{sortname}{default}%
    			}{%
    				\thefield{entrytype}%
    			}%
    		}%
    		\usebibmacro{shorthandintro}%
    	}
    	\DeclareCiteCommand{\smartcite}[\mkbibfootnote]{%
    		\usebibmacro{prenote}%
    	}{%
    		\usebibmacro{citeindex}%
    		\usebibmacro{cite:full}%
    	}{%
    		\multicitedelim%
    	}{%
    		\usebibmacro{postnote}%
    	}
    }{}
    
    %%% Подключение файлов bib %%%
    \addbibresource[label=other]{biblio/othercites.bib}
    \addbibresource[label=vak]{biblio/authorpapersVAK.bib}
    \addbibresource[label=papers]{biblio/authorpapers.bib}
    \addbibresource[label=conf]{biblio/authorconferences.bib}
    
    
    %http://tex.stackexchange.com/a/141831/79756
    %There is a way to automatically map the language field to the langid field. The following lines in the preamble should be enough to do that.
    %This command will copy the language field into the langid field and will then delete the contents of the language field. The language field will only be deleted if it was successfully copied into the langid field.
    \DeclareSourcemap{ %модификация bib файла перед тем, как им займётся biblatex 
    	\maps{
    		\map{% перекидываем значения полей language в поля langid, которыми пользуется biblatex
    			\step[fieldsource=language, fieldset=langid, origfieldval, final]
    			\step[fieldset=language, null]
    		}
    		\map[overwrite]{% перекидываем значения полей shortjournal, если они есть, в поля journal, которыми пользуется biblatex
    			\step[fieldsource=shortjournal, final]
    			\step[fieldset=journal, origfieldval]
    		}
    		\map[overwrite]{% перекидываем значения полей shortbooktitle, если они есть, в поля booktitle, которыми пользуется biblatex
    			\step[fieldsource=shortbooktitle, final]
    			\step[fieldset=booktitle, origfieldval]
    		}
    		\map[overwrite, refsection=0]{% стираем значения всех полей addendum
    			\perdatasource{biblio/authorpapersVAK.bib}
    			\perdatasource{biblio/authorpapers.bib}
    			\perdatasource{biblio/authorconferences.bib}
    			\step[fieldsource=addendum, final]
    			\step[fieldset=addendum, null] %чтобы избавиться от информации об объёме авторских статей, в отличие от автореферата
    		}
    		\map{% перекидываем значения полей numpages в поля pagetotal, которыми пользуется biblatex
    			\step[fieldsource=numpages, fieldset=pagetotal, origfieldval, final]
    			\step[fieldset=pagestotal, null]
    		}
    		\map{% если в поле medium написано "Электронный ресурс", то устанавливаем поле media, которым пользуется biblatex, в значение eresource.
    			\step[fieldsource=medium,
    			match=\regexp{Электронный\s+ресурс},
    			final]
    			\step[fieldset=media, fieldvalue=eresource]
    		}
    		\map[overwrite]{% стираем значения всех полей issn
    			\step[fieldset=issn, null]
    		}
    		\map[overwrite]{% стираем значения всех полей abstract, поскольку ими не пользуемся, а там бывают "неприятные" латеху символы
    			\step[fieldsource=abstract]
    			\step[fieldset=abstract,null]
    		}
    		\map[overwrite]{ % переделка формата записи даты
    			\step[fieldsource=urldate,
    			match=\regexp{([0-9]{2})\.([0-9]{2})\.([0-9]{4})},
    			replace={$3-$2-$1$4}, % $4 вставлен исключительно ради нормальной работы программ подсветки синтаксиса, которые некорректно обрабатывают $ в таких конструкциях
    			final]
    		}
    		\map[overwrite]{ % добавляем ключевые слова, чтобы различать источники
    			\perdatasource{biblio/othercites.bib}
    			\step[fieldset=keywords, fieldvalue={biblioother,bibliofull}]
    		}
    		\map[overwrite]{ % добавляем ключевые слова, чтобы различать источники
    			\perdatasource{biblio/authorpapersVAK.bib}
    			\step[fieldset=keywords, fieldvalue={biblioauthorvak,biblioauthor,bibliofull}]
    		}
    		\map[overwrite]{ % добавляем ключевые слова, чтобы различать источники
    			\perdatasource{biblio/authorpapers.bib}
    			\step[fieldset=keywords, fieldvalue={biblioauthornotvak,biblioauthor,bibliofull}]
    		}
    		\map[overwrite]{ % добавляем ключевые слова, чтобы различать источники
    			\perdatasource{biblio/authorconferences.bib}
    			\step[fieldset=keywords, fieldvalue={biblioauthorconf,biblioauthor,bibliofull}]
    		}
    		%        \map[overwrite]{% стираем значения всех полей series
    			%            \step[fieldset=series, null]
    			%        }
    		\map[overwrite]{% перекидываем значения полей howpublished в поля organization для типа online
    			\step[typesource=online, typetarget=online, final]
    			\step[fieldsource=howpublished, fieldset=organization, origfieldval]
    			\step[fieldset=howpublished, null]
    		}
    		% Так отключаем [Электронный ресурс]
    		%        \map[overwrite]{% стираем значения всех полей media=eresource
    			%            \step[fieldsource=media,
    			%            match={eresource},
    			%            final]
    			%            \step[fieldset=media, null]
    			%        }
    	}
    }
    
    %%% Убираем неразрывные пробелы перед двоеточием и точкой с запятой %%%
    %\makeatletter
    %\ifnumequal{\value{draft}}{0}{% Чистовик
    	%    \renewcommand*{\addcolondelim}{%
    		%      \begingroup%
    		%      \def\abx@colon{%
    			%        \ifdim\lastkern>\z@\unkern\fi%
    			%        \abx@puncthook{:}\space}%
    		%      \addcolon%
    		%      \endgroup}
    	%
    	%    \renewcommand*{\addsemicolondelim}{%
    		%      \begingroup%
    		%      \def\abx@semicolon{%
    			%        \ifdim\lastkern>\z@\unkern\fi%
    			%        \abx@puncthook{;}\space}%
    		%      \addsemicolon%
    		%      \endgroup}
    	%}{}
    %\makeatother
    
    %%% Правка записей типа thesis, чтобы дважды не писался автор
    %\ifnumequal{\value{draft}}{0}{% Чистовик
    	%\DeclareBibliographyDriver{thesis}{%
    		%  \usebibmacro{bibindex}%
    		%  \usebibmacro{begentry}%
    		%  \usebibmacro{heading}%
    		%  \newunit
    		%  \usebibmacro{author}%
    		%  \setunit*{\labelnamepunct}%
    		%  \usebibmacro{thesistitle}%
    		%  \setunit{\respdelim}%
    		%  %\printnames[last-first:full]{author}%Вот эту строчку нужно убрать, чтобы автор диссертации не дублировался
    		%  \newunit\newblock
    		%  \printlist[semicolondelim]{specdata}%
    		%  \newunit
    		%  \usebibmacro{institution+location+date}%
    		%  \newunit\newblock
    		%  \usebibmacro{chapter+pages}%
    		%  \newunit
    		%  \printfield{pagetotal}%
    		%  \newunit\newblock
    		%  \usebibmacro{doi+eprint+url+note}%
    		%  \newunit\newblock
    		%  \usebibmacro{addendum+pubstate}%
    		%  \setunit{\bibpagerefpunct}\newblock
    		%  \usebibmacro{pageref}%
    		%  \newunit\newblock
    		%  \usebibmacro{related:init}%
    		%  \usebibmacro{related}%
    		%  \usebibmacro{finentry}}
    	%}{}
    
    %\newbibmacro{string+doi}[1]{% новая макрокоманда на простановку ссылки на doi
    	%    \iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
    
    %\ifnumequal{\value{draft}}{0}{% Чистовик
    	%\renewcommand*{\mkgostheading}[1]{\usebibmacro{string+doi}{#1}} % ссылка на doi с авторов. стоящих впереди записи
    	%\renewcommand*{\mkgostheading}[1]{#1} % только лишь убираем курсив с авторов
    	%}{}
    %\DeclareFieldFormat{title}{\usebibmacro{string+doi}{#1}} % ссылка на doi с названия работы
    %\DeclareFieldFormat{journaltitle}{\usebibmacro{string+doi}{#1}} % ссылка на doi с названия журнала
    %%% Тире как разделитель в библиографии традиционной руской длины:
    \renewcommand*{\newblockpunct}{\addperiod\addnbspace\cyrdash\space\bibsentence}
    %%% Убрать тире из разделителей элементов в библиографии:
    %\renewcommand*{\newblockpunct}{%
    	%    \addperiod\space\bibsentence}%block punct.,\bibsentence is for vol,etc.
    
    %%% Возвращаем запись «Режим доступа» %%%
    %\DefineBibliographyStrings{english}{%
    	%    urlfrom = {Mode of access}
    	%}
    %\DeclareFieldFormat{url}{\bibstring{urlfrom}\addcolon\space\url{#1}}
    
    %%% В списке литературы обозначение одной буквой диапазона страниц англоязычного источника %%%
    \DefineBibliographyStrings{english}{%
    	pages = {p\adddot} %заглавность буквы затем по месту определяется работой самого biblatex
    }
    
    %%% В ссылке на источник в основном тексте с указанием конкретной страницы обозначение одной большой буквой %%%
    %\DefineBibliographyStrings{russian}{%
    	%    page = {C\adddot}
    	%}
    
    %%% Исправление длины тире в диапазонах %%%
    % \cyrdash --- тире «русской» длины, \textendash --- en-dash
    \DefineBibliographyExtras{russian}{%
    	\protected\def\bibrangedash{%
    		\cyrdash\penalty\value{abbrvpenalty}}% almost unbreakable dash
    	\protected\def\bibdaterangesep{\bibrangedash}%тире для дат
    }
    \DefineBibliographyExtras{english}{%
    	\protected\def\bibrangedash{%
    		\cyrdash\penalty\value{abbrvpenalty}}% almost unbreakable dash
    	\protected\def\bibdaterangesep{\bibrangedash}%тире для дат
    }
    
    %Set higher penalty for breaking in number, dates and pages ranges
    \setcounter{abbrvpenalty}{10000} % default is \hyphenpenalty which is 12
    
    %Set higher penalty for breaking in names
    \setcounter{highnamepenalty}{10000} % If you prefer the traditional BibTeX behavior (no linebreaks at highnamepenalty breakpoints), set it to ‘infinite’ (10 000 or higher).
    \setcounter{lownamepenalty}{10000}
    
    %%% Set low penalties for breaks at uppercase letters and lowercase letters
    %\setcounter{biburllcpenalty}{500} %управляет разрывами ссылок после маленьких букв RTFM biburllcpenalty
    %\setcounter{biburlucpenalty}{3000} %управляет разрывами ссылок после больших букв, RTFM biburlucpenalty
    
    %%% Список литературы с красной строки (без висячего отступа) %%%
    %\defbibenvironment{bibliography} % переопределяем окружение библиографии из gost-numeric.bbx пакета biblatex-gost
    %  {\list
    	%     {\printtext[labelnumberwidth]{%
    			%	\printfield{prefixnumber}%
    			%	\printfield{labelnumber}}}
    	%     {%
    		%      \setlength{\labelwidth}{\labelnumberwidth}%
    		%      \setlength{\leftmargin}{0pt}% default is \labelwidth
    		%      \setlength{\labelsep}{\widthof{\ }}% Управляет длиной отступа после точки % default is \biblabelsep
    		%      \setlength{\itemsep}{\bibitemsep}% Управление дополнительным вертикальным разрывом между записями. \bibitemsep по умолчанию соответствует \itemsep списков в документе.
    		%      \setlength{\itemindent}{\bibhang}% Пользуемся тем, что \bibhang по умолчанию принимает значение \parindent (абзацного отступа), который переназначен в styles.tex
    		%      \addtolength{\itemindent}{\labelwidth}% Сдвигаем правее на величину номера с точкой
    		%      \addtolength{\itemindent}{\labelsep}% Сдвигаем ещё правее на отступ после точки
    		%      \setlength{\parsep}{\bibparsep}%
    		%     }%
    	%      \renewcommand*{\makelabel}[1]{\hss##1}%
    	%  }
    %  {\endlist}
    %  {\item}
    
    %% Счётчик использованных ссылок на литературу, обрабатывающий с учётом неоднократных ссылок
    %http://tex.stackexchange.com/a/66851/79756
    %\newcounter{citenum}
    \newtotcounter{citenum}
    \makeatletter
    \defbibenvironment{counter} %Env of bibliography
    {\setcounter{citenum}{0}%
    	\renewcommand{\blx@driver}[1]{}%
    } %what is doing at the beginining of bibliography. In your case it's : a. Reset counter b. Say to print nothing when a entry is tested.
    {} %Здесь то, что будет выводиться командой \printbibliography. \thecitenum сюда писать не надо
    {\stepcounter{citenum}} %What is printing / executed at each entry.
    \makeatother
    \defbibheading{counter}{}
    
    \newtotcounter{citeauthorvak}
    \makeatletter
    \defbibenvironment{countauthorvak} %Env of bibliography
    {\setcounter{citeauthorvak}{0}%
    	\renewcommand{\blx@driver}[1]{}%
    } %what is doing at the beginining of bibliography. In your case it's : a. Reset counter b. Say to print nothing when a entry is tested.
    {} %Здесь то, что будет выводиться командой \printbibliography. Обойдёмся без \theciteauthorvak в нашей реализации
    {\stepcounter{citeauthorvak}} %What is printing / executed at each entry.
    \makeatother
    \defbibheading{countauthorvak}{}
    
    \newtotcounter{citeauthornotvak}
    \makeatletter
    \defbibenvironment{countauthornotvak} %Env of bibliography
    {\setcounter{citeauthornotvak}{0}%
    	\renewcommand{\blx@driver}[1]{}%
    } %what is doing at the beginining of bibliography. In your case it's : a. Reset counter b. Say to print nothing when a entry is tested.
    {} %Здесь то, что будет выводиться командой \printbibliography. Обойдёмся без \theciteauthornotvak в нашей реализации
    {\stepcounter{citeauthornotvak}} %What is printing / executed at each entry.
    \makeatother
    \defbibheading{countauthornotvak}{}
    
    \newtotcounter{citeauthorconf}
    \makeatletter
    \defbibenvironment{countauthorconf} %Env of bibliography
    {\setcounter{citeauthorconf}{0}%
    	\renewcommand{\blx@driver}[1]{}%
    } %what is doing at the beginining of bibliography. In your case it's : a. Reset counter b. Say to print nothing when a entry is tested.
    {} %Здесь то, что будет выводиться командой \printbibliography. Обойдёмся без \theciteauthorconf в нашей реализации
    {\stepcounter{citeauthorconf}} %What is printing / executed at each entry.
    \makeatother
    \defbibheading{countauthorconf}{}
    
    \newtotcounter{citeauthor}
    \makeatletter
    \defbibenvironment{countauthor} %Env of bibliography
    {\setcounter{citeauthor}{0}%
    	\renewcommand{\blx@driver}[1]{}%
    } %what is doing at the beginining of bibliography. In your case it's : a. Reset counter b. Say to print nothing when a entry is tested.
    {} %Здесь то, что будет выводиться командой \printbibliography. Обойдёмся без \theciteauthor в нашей реализации
    {\stepcounter{citeauthor}} %What is printing / executed at each entry.
    \makeatother
    \defbibheading{countauthor}{}
    
    \defbibheading{authorpublications}[\authorbibtitle]{\section*{#1}}
    \defbibheading{pubsubgroup}{\centering\textbf{#1}}
    \defbibheading{otherpublications}{\section*{#1}}
    
    
    %%% Создание команд для вывода списка литературы %%%
    \newcommand*{\insertbibliofull}{
    	\printbibliography[keyword=bibliofull,section=0,title=\fullbibtitle]
    	\printbibliography[heading=counter,env=counter,keyword=bibliofull,section=0]
    }
    
    \newcommand*{\insertbiblioauthorcited}{
    	\printbibliography[heading=authorpublications,keyword=biblioauthor,section=0,title=\authorbibtitle]
    }
    \newcommand*{\insertbiblioauthor}{
    	\printbibliography[heading=authorpublications,keyword=biblioauthor,section=1,title=\authorbibtitle]
    }
    \newcommand*{\insertbiblioauthorimportant}{
    	\printbibliography[heading=authorpublications,keyword=biblioauthor,section=2,title={Наиболее значимые \MakeLowercase{\protect\authorbibtitle{}}}]
    }
    \newcommand*{\insertbiblioauthorgrouped}{% Заготовка для вывода сгруппированных печатных работ автора. Порядок нумерации определяется в соответствующих счетчиках внутри окружения refsection в файле common/characteristic.tex
    	\section*{\authorbibtitle}
    	\printbibliography[heading=pubsubgroup, keyword=biblioauthorvak, section=1,title=\vakbibtitle]%
    	\printbibliography[heading=pubsubgroup, keyword=biblioauthorconf, section=1,title=\confbibtitle]%
    	%\printbibliography[heading=pubsubgroup, keyword=biblioauthornotvak, section=1,title=\notvakbibtitle]%
    }
    
    \newcommand*{\insertbiblioother}{
    	\printbibliography[heading=otherpublications,keyword=biblioother]
    }
Unfortunately, I can't change entirely the code of theese files, but I can add some options and small changes in the code to achieve the requirement.

I have found some solutions for my problem, for example, https://tex.stackexchange.com/questions ... -by-number and https://tex.stackexchange.com/questions ... n-the-text , but theese cases are for {thebibliography} enviroment. I use biber + biblatex and I can't switch to another representation.

Files `authorconferences.bib`, `authorpapersVAK.bib` and `othercites.bib` contain just bibliographies in the next form, for example:

@ARTICLE{PaperVAK1,
author = {I and Smith, J.},
title = {Some Paper},
journal = {Some Journal},
year = {1812},
volume = {17},
number = {2},
pages = {43--999},
language = {english}
}

I have no problems with these files.

If it is needed, I can upload another files from the project. Feel free to ask!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply