BibLaTeX ソースマップを使用したインデントされた追加事項

BibLaTeX ソースマップを使用したインデントされた追加事項

私は、各エントリの要約段落を含む注釈付き参考文献を作成しようとしています。これにより、各文献の補遺が、エントリ自体よりも 1 レベル深いインデントの新しい行に表示されます。

各エントリについて

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 }

よく分かりません。出力正規表現の定義が間違っているのでしょうか?

編集: 最小限の動作例:

テスト.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.}\\}
}

テスト.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}

ここで、テスト 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 のコード行もいくつか変更しました。コメントを参照してください。

関連情報