
저는 biblatex를 사용하여 두 개의 서로 다른 참고문헌을 생성하려고 합니다. 첫 번째 항목에는 텍스트에 나타나는 순서대로 정렬되고 특별한 접두사가 붙은 내 논문만 포함되어야 합니다. 두 번째 참고문헌에는 특별한 접두어 없이 다른 순서(예: 이름-제목-연도)로 정렬된 일반 참고문헌이 포함되어야 합니다.
두 참고문헌은 서로 교차하지 않습니다(즉, 공통 항목이 없음).
나는 이 MTW를 사용합니다:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{ref.bib}
@ARTICLE{Pub1,
author = {A. R},
title = {My best paper},
year = {2013},
journal = C,
keywords = {publication}
}
@ARTICLE{Pub2,
author = {A. R},
title = {My second best paper},
year = {2013},
journal = C,
keywords = {publication}
}
@ARTICLE{Nopub1,
author = {A. R},
title = {Not my paper 1},
year = {2012},
journal = I,
keywords = {general}
}
@ARTICLE{Nopub2,
author = {A. R},
title = {Not my paper 2},
year = {2012},
journal = I,
keywords = {general}
}
\end{filecontents}
\usepackage[style=numeric, sorting=none, defernumbers=true, backend=biber]{biblatex}
\addbibresource{ref.bib}
\pagestyle{empty}
\begin{document}
This is my first publication : \cite{Pub1}
These are not my publications: \cite{Nopub1,Nopub2}
This is my second publication: \cite{Pub2}
\printbibliography[keyword=publication, prefixnumbers=R, title=My papers]
\begin{refcontext}[sorting=nty]
\printbibliography[notkeyword=publication, prefixnumbers=, title=Not my papers]
\end{refcontext}
\end{document}
출력(pdflatex + biber + pdflatex + pdflatex 이후):
두 참고문헌 모두 정확하고 순서가 잘 인쇄되어 있지만 두 번째 참고문헌을 참조하는 텍스트 인용이 잘못되었습니다(모두 [0]). 다른 관련 게시물도 확인해 보았는데, 이 구체적인 문제에 대해서는 아무도 언급하지 않았습니다.
감사해요!
답변1
현재로서는 좋은 해결책이 없다고 생각합니다. 그러나 나는 몇 가지 배경을 설명하려고 노력할 것입니다. 귀하의 예에서는 두 참고 문헌이 겹치지 않기 때문에 원하는 출력이 분명해 보입니다. 그러나 반드시 그럴 필요는 없습니다. 다른 참조 컨텍스트에서는 항목이 반복될 수 있습니다. 이제 필터를 제거하면 어떤 일이 발생하는지 살펴보겠습니다.
\documentclass{article}
\usepackage[style=numeric, sorting=none, backend=biber]{biblatex}
\addbibresource{ref.bib}
\pagestyle{empty}
\begin{document}
This is my first publication : \cite{Pub1}
These are not my publications: \cite{Nopub1,Nopub2}
This is my second publication: \cite{Pub2}
\printbibliography[title=Not my papers]
\newrefcontext[sorting=nty]
This is my first publication: \cite{Pub1}
These are not my publications: \cite{Nopub1,Nopub2}
This is my second publication: \cite{Pub2}
\printbibliography[prefixnumbers=R,title=My papers]
\end{document}
보시다시피 모든 bibentry에는 두 개의 라벨이 있으며 biblatex는 사용할 라벨을 선택해야 합니다. 현명하게도 인용의 첫 번째 블록에는 첫 번째(기본) 참조 컨텍스트의 레이블을 사용하고, 두 번째 블록에는 두 번째 블록의 레이블을 사용합니다.
이것은 왜 0을 얻는지 설명합니다. 첫 번째 블록에서 인용에는 레이블이 없으며 biblatex는 대체 항목으로 다른 참조 컨텍스트의 레이블을 원한다고 추측할 기회가 없습니다. 결국 적합한 레이블이 두 개 이상 있을 수 있습니다.
인용에 사용할 레이블 biblatex는 의 현재 값에 따라 달라집니다 \blx@refcontext@sorting
. 따라서 다음을 수행하여 biblatex가 다른 refcontext의 레이블을 사용하도록 로컬로 강제할 수 있습니다.
{
\makeatletter\def\blx@refcontext@sorting{nty}
These are not my publications: \cite{Nopub1,Nopub2}
}
그러면 다음과 같은 것을 얻을 수 있습니다:
하지만 이 솔루션은 다음과 같은 혼합 인용에는 작동하지 않습니다 \cite{Nopub1,pub1}
. 그리고 "논리적" 솔루션
\AtEveryCitekey{\ifkeyword{puplication}{}{\def\blx@refcontext@sorting{nty}}}
\AtEveryCitekey가 시작되기 전에 refcontext에 대한 코드가 실행되기 때문에 작동하지 않습니다. 따라서 아마도 기능 요청을 해야 할 것입니다...
편집하다
이것을 시도해 볼 수 있습니다. 하지만 주의하세요. 이는 해킹이므로 biblatex를 혼동시킬 가능성이 높습니다. 따라서 더 많은 데이터를 가지고 신중하게 테스트하고 확인하십시오.
\documentclass{article}
\usepackage[style=numeric, sorting=none, defernumbers, backend=biber]{biblatex}
\addbibresource{ref.bib}
\pagestyle{empty}
\makeatletter
\AtEveryCitekey{\ifkeyword{publication}{}{\def\blx@refcontext@sorting{nty}%
\csname blx@data@\the \c@refsection @\blx@refcontext@sorting @\abx@field@entrykey\endcsname}}
\makeatother
\begin{document}
This is my first publication : \cite{Pub1}
These are not my publications: \cite{Nopub1,Nopub2}
This is my second publication: \cite{Pub2}
\printbibliography[keyword=publication, prefixnumbers=R, title=My papers]
\begin{refcontext}[sorting=nty]
\printbibliography[notkeyword=publication, prefixnumbers=, title=Not my papers]
\end{refcontext}
\end{document}
답변2
refcontexts는 이런 종류의 일을 위해 도입되었습니다. refcontexts 내의 인용 명령은 컨텍스트를 공유하므로 동일한 refcontext 내에 "This are not myPublishs:" 인용을 넣습니다.
\assignrefcontextentries[sorting=nty]{Nopub1,Nopub2}
\begin{document}
This is my first publication: \cite{Pub1}
These are not my publications: \cite{Nopub1,Nopub2}
This is my second publication: \cite{Pub2}
\printbibliography[keyword=publication, prefixnumbers=R, title=My papers]
\begin{refcontext}[sorting=nty]
\printbibliography[notkeyword=publication, title=Not my papers]
\end{refcontext}
\end{document}
이를 위해서는 biblatex 3.3이 필요합니다.
답변3
문제는 다른 refcontext
. refcontext
두 번째 주변의 환경 을 제거하면 printbibliography
원하는 출력을 얻을 수 있습니다.