
Я пытаюсь создать аннотированную библиографию с кратким изложением для каждой записи, так чтобы приложение к каждой библиографической записи появлялось на новой строке на один уровень отступа глубже, чем сама запись.
Для каждой записи с
addendum = {Text.}
Следующий вариант, похоже, работает хорошо, создавая именно тот формат вывода, который я хочу видеть:
addendum = {\paragraph\indent{Text.}\\}
Я пытаюсь выполнить автоматическое преобразование следующим образом:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=addendum,
match=\regexp{(.*)},
fieldset=addendum,
replace={\\paragraph\{\\indent $1\} \\}
]
}
}
}
Однако мне не удаётся правильно экранировать символы в поле замены, и LaTeX выдаёт ошибку:
Undefined control sequence.
\\ ->\let \reserved@e
\relax \let \reserved@f \relax \@ifstar {\let \reserv...
l.68 }
Я не могу понять, что происходит. Может быть, я неправильно определяю выходное регулярное выражение?
EDIT: Минимальный рабочий пример:
тест.bib
@article{test,
author = {Luigi P. Cordella and
Pasquale Foggia and
Carlo Sansone and
Mario Vento},
title = {A (Sub)Graph Isomorphism Algorithm for Matching Large Graphs},
journal = {{IEEE} Trans. Pattern Anal. Mach. Intell.},
volume = {26},
number = {10},
pages = {1367--1372},
year = {2004},
doi = {10.1109/TPAMI.2004.75},
timestamp = {Sat, 12 Mar 2016 09:04:02 +0100},
addendum = {This is a test of simple annotations.}
}
@article{test2,
author = {Luigi P. Cordella and
Pasquale Foggia and
Carlo Sansone and
Mario Vento},
title = {A (Sub)Graph Isomorphism Algorithm for Matching Large Graphs},
journal = {{IEEE} Trans. Pattern Anal. Mach. Intell.},
volume = {26},
number = {10},
pages = {1367--1372},
year = {2004},
doi = {10.1109/TPAMI.2004.75},
timestamp = {Sat, 12 Mar 2016 09:04:02 +0100},
addendum = {\paragraph\indent{\textbf{Annotation:} This is a test of simple annotations using biblatex.}\\}
}
тест.текс
\documentclass[a4]{article}
\usepackage[backend=biber]{biblatex}
\bibliography{test}
% Sourcemap is placed here.
\begin{document}
Test 1 \cite{test}
Test 2 \cite{test2}
\printbibliography
\end{document}
где тест 1 — это цитата до преобразования, а тест 2 — желаемый результат.
решение1
Вам не нужно использовать \DeclareSourcemap
, простой
\DeclareFieldFormat{addendum}{\paragraph\indent{\textbf{Annotation:}\addspace#1}\\}
достаточно:
\documentclass{article} % [a4] is not a correct option
\usepackage[english]{babel}
\usepackage{filecontents}
\begin{filecontents}{test.bib}
@article{test,
author = {Luigi P. Cordella and
Pasquale Foggia and
Carlo Sansone and
Mario Vento},
title = {A (Sub)Graph Isomorphism Algorithm for Matching Large Graphs},
journal = {{IEEE} Trans. Pattern Anal. Mach. Intell.},
volume = {26},
number = {10},
pages = {1367--1372},
year = {2004},
doi = {10.1109/TPAMI.2004.75},
timestamp = {Sat, 12 Mar 2016 09:04:02 +0100},
addendum = {This is a test of simple annotations.}
}
@article{test2,
author = {Luigi P. Cordella and
Pasquale Foggia and
Carlo Sansone and
Mario Vento},
title = {A (Sub)Graph Isomorphism Algorithm for Matching Large Graphs},
journal = {{IEEE} Trans. Pattern Anal. Mach. Intell.},
volume = {26},
number = {10},
pages = {1367--1372},
year = {2004},
doi = {10.1109/TPAMI.2004.75},
timestamp = {Sat, 12 Mar 2016 09:04:02 +0100},
addendum = {This is a test of simple annotations using biblatex.}
}
\end{filecontents}
\usepackage[backend=biber]{biblatex}
\usepackage{csquotes} % added
% New format for addendum field
\DeclareFieldFormat{addendum}{\paragraph\indent{\textbf{Annotation:}\addspace#1}\\}
\addbibresource{test.bib} % Not \bibliography{test}
\begin{document}
Test 1 \cite{test}
Test 2 \cite{test2}
\printbibliography
\end{document}
PS = Я также изменил некоторые строки кода вашего mwe, см. комментарии.