
我正在嘗試產生一個帶註釋的參考書目,其中每個條目都有一個摘要段落,以便每個參考文獻的附錄出現在比條目本身深一級縮排的新行上。
對於每個條目
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 }
我無法弄清楚這一點 - 我是否錯誤地定義了輸出正規表示式?
編輯:最小工作範例:
測試圍脖
@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的一些程式碼行,請參閱評論。