.png)
이전 질문은 여기아직 DOI가 포함되어 있지 않은 경우에만 Biblatex가 항목의 ISBN을 인쇄할 수 있는지 묻습니다. 허용된 답변~에 의해앤드루 스완Biblatex의 소스 재매핑 기능을 사용하여 doi
필드가 null이 아닌지 확인하고, 그렇다면 해당 isbn
필드를 지워서 인쇄되지 않도록 하는 것입니다.
이 솔루션의 문제점은 상호 참조 항목에 대해 작동하지 않는다는 것입니다. 예를 들어, 필드가 있는 @proceedings
항목 isbn
, 필드와 항목을 참조하는 필드 @inproceedings
가 있는 항목이 있다고 가정해 보겠습니다 . 이 경우 해당 항목이 참고문헌 목록에 인쇄되면 DOI와 ISBN이 모두 표시됩니다.doi
crossref
@proceedings
@inproceedings
다음은 최소한의 예와 출력입니다.
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=doi,final]
\step[fieldset=isbn,null]
}
}
}
\begin{filecontents}{\jobname.bib}
@proceedings{book1,
editor = {Adam Author},
title = {Book One},
year = 2020,
doi = {10.1000/1010},
note = {DOI only},
}
@proceedings{book2,
editor = {Betty Bookwriter},
title = {Book Two},
year = 2020,
doi = {10.1000/2020},
isbn = {123-456-789},
note = {DOI and ISBN; ISBN should not be displayed},
}
@proceedings{book3,
editor = {Edward Editor},
title = {Book Three},
year = 2020,
isbn = {123-456-789},
note = {ISBN only},
}
@inproceedings{article4,
author = {Sally Scribe},
title = {Article Four},
doi = {10:1000/4040},
crossref = {book3},
note = {DOI from article, ISBN from crossref should not be displayed},
}
@inproceedings{article5,
author = {Walter Writer},
title = {Article Five},
crossref = {book3},
note = {ISBN from crossref should be displayed},
}
\end{filecontents}
\begin{document}
\nocite{book1,book2,book3,article4,article5}
\printbibliography
\end{document}
상호 참조 항목을 설명하고 필드에 isbn
포함 하도록 Andrew의 답변을 어떻게 조정할 수 있습니까 ? doi
아니면 이것이 실패할 경우, 이를 달성할 수 있는 다른 솔루션(참고문헌 항목을 수동으로 편집하지 않고)이 있습니까?
답변1
.bib
소스맵은 필드 앨리어싱 및 데이터 상속이 적용되기 전 구문 분석 프로세스 초기에 실행됩니다 . 이는 소스맵이 항목이 특정 필드를 상속할지 여부를 알 수 없음을 의미합니다.
biblatex
모든 데이터를 사용할 수 있는 경우 에만 필드를 억제하는 것이 가장 좋습니다 . 개념적으로 가장 좋은 방법은 아마도 를 거치 \AtDataInput
겠지만 새로운 도우미 매크로가 필요합니다.
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\makeatletter
\newcommand*{\ClearFieldAtDataInput}[1]{%
\csxappto\blx@bbl@data{%
\undef\expandafter\noexpand\csname abx@field@#1\endcsname}}
\makeatother
\AtDataInput{%
\iffieldundef{doi}
{}
{\ClearFieldAtDataInput{isbn}}}
\begin{filecontents}{\jobname.bib}
@proceedings{book1,
editor = {Adam Author},
title = {Book One},
year = 2020,
doi = {10.1000/1010},
note = {DOI only},
}
@proceedings{book2,
editor = {Betty Bookwriter},
title = {Book Two},
year = 2020,
doi = {10.1000/2020},
isbn = {123-456-789},
note = {DOI and ISBN; ISBN should not be displayed},
}
@proceedings{book3,
editor = {Edward Editor},
title = {Book Three},
year = 2020,
isbn = {123-456-789},
note = {ISBN only},
}
@inproceedings{article4,
author = {Sally Scribe},
title = {Article Four},
doi = {10:1000/4040},
crossref = {book3},
note = {DOI from article, ISBN from crossref should not be displayed},
}
@inproceedings{article5,
author = {Walter Writer},
title = {Article Five},
crossref = {book3},
note = {ISBN from crossref should be displayed},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{book1,book2,book3,article4,article5}
\printbibliography
\end{document}
또는 표준 \AtEveryBibitem
/ \AtEveryCitekey
후크를 사용할 수 있습니다.
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\newcommand*{\clearisbn}{%
\iffieldundef{doi}
{}
{\clearfield{isbn}}}
\AtEveryBibitem{\clearisbn}
\AtEveryCitekey{\clearisbn}
\begin{filecontents}{\jobname.bib}
@proceedings{book1,
editor = {Adam Author},
title = {Book One},
year = 2020,
doi = {10.1000/1010},
note = {DOI only},
}
@proceedings{book2,
editor = {Betty Bookwriter},
title = {Book Two},
year = 2020,
doi = {10.1000/2020},
isbn = {123-456-789},
note = {DOI and ISBN; ISBN should not be displayed},
}
@proceedings{book3,
editor = {Edward Editor},
title = {Book Three},
year = 2020,
isbn = {123-456-789},
note = {ISBN only},
}
@inproceedings{article4,
author = {Sally Scribe},
title = {Article Four},
doi = {10:1000/4040},
crossref = {book3},
note = {DOI from article, ISBN from crossref should not be displayed},
}
@inproceedings{article5,
author = {Walter Writer},
title = {Article Five},
crossref = {book3},
note = {ISBN from crossref should be displayed},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{book1,book2,book3,article4,article5}
\printbibliography
\end{document}