Adendos recuados usando mapas de origem BibLaTeX

Adendos recuados usando mapas de origem BibLaTeX

Estou tentando produzir uma bibliografia anotada, com um parágrafo de resumo para cada entrada, de forma que o adendo para cada bibentry apareça em uma nova linha, um nível de recuo mais profundo que a própria entrada.

Para cada entrada com

addendum = {Text.}

o seguinte parece funcionar bem, produzindo exatamente o formato de saída que desejo ver:

addendum = {\paragraph\indent{Text.}\\}

Estou tentando realizar a conversão automática com o seguinte:

\DeclareSourcemap{
    \maps[datatype=bibtex]{
        \map{
            \step[fieldsource=addendum, 
                match=\regexp{(.*)},
                fieldset=addendum,
                replace={\\paragraph\{\\indent $1\} \\}
            ]
        }
    }
}

No entanto, não consigo fazer com que os caracteres escapem corretamente no campo de substituição, e o LaTeX produz o erro:

Undefined control sequence.
\\  ->\let \reserved@e 
                       \relax \let \reserved@f \relax \@ifstar {\let \reserv...
l.68 }

Não consigo entender isso - estou definindo o regex de saída incorretamente?

EDIT: Exemplo mínimo de trabalho:

teste.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.}\\}
}

teste.tex

\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}

onde o teste 1 é a citação pré-transformação e o teste 2 é a saída desejada.

Responder1

Você não precisa usar \DeclareSourcemap, um simples

\DeclareFieldFormat{addendum}{\paragraph\indent{\textbf{Annotation:}\addspace#1}\\}

é suficiente:

\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}

insira a descrição da imagem aqui

PS = Também alterei algumas linhas de código do seu mwe, veja comentários.

informação relacionada