
모자를 쓴 고양이에 관한 기사에서 사용하고 싶은 cats.bib
및 가 있다고 가정해 보겠습니다 . hats.bib
이미그것에 관한 기존 논문(글쎄, 일종의) 두 파일 모두에 있습니다.
지금은 그렇습니다~ 아니다이 파일들을 병합하고 싶습니다(다음과 달리이 질문그리고이 하나). 나~이다항목 간의 차이점 가능성을 무시하고 원하는 항목을 선택하기 위해 사용하는 도구가 무엇이든 허용할 의향이 있습니다(일관적이지도 않습니다. 내 말은, 항목이 실제로 동일한 항목의 복사본임을 보장할 의향이 있음을 의미합니다). 이러한 상황에서 LaTeX 문서에서 오류 없이 두 참고문헌을 모두 사용하려면 어떻게 해야 합니까?
문서를 컴파일할 목적으로 일시적으로 병합하는 작업을 제안하는 경우 에 통합할 수 있는 작업을 제안해 주십시오. latexmk
그러면 수동으로 반복적으로 수행할 필요가 없으며 어떤 도구에서든 이 작업을 수행할 수 있기를 바랍니다. .tex
apriori가 아닌 파일 자체 의 참고문헌 이름입니다 .
답변1
.bib
원하는 만큼 많은 파일을 사용할 수 있습니다 . 항목이 중복되면 결과가 없으며 처음 발견된 항목만 유지하는 BibTeX 오류가 발생합니다.
\begin{filecontents*}{\jobname-cats.bib}
@article{unique-cats,
author={A. Uthor},
title={Title},
journal={Journal},
year=2016,
}
@article{duplicate,
author={W. Riter},
title={Title},
journal={Journal},
year=2016,
}
\end{filecontents*}
\begin{filecontents*}{\jobname-hats.bib}
@article{unique-hats,
author={P. Laywright},
title={Title},
journal={Journal},
year=2016,
}
@article{duplicate,
author={W. Riter},
title={Title},
journal={Journal},
year=2016,
}
\end{filecontents*}
\documentclass{article}
\begin{document}
\title{Cats in hats}
\author{Einpoklum}
\maketitle
We want to cite \cite{unique-cats}, but also \cite{unique-hats}.
There is a duplicate \cite{duplicate}.
\bibliographystyle{plain}
\bibliography{\jobname-cats,\jobname-hats}
\end{document}
BibTeX의 경고는 다음과 같습니다.
This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: einmulti.aux
The style file: plain.bst
Database file #1: einmulti-cats.bib
Database file #2: einmulti-hats.bib
Repeated entry---line 7 of file einmulti-hats.bib
: @article{duplicate
: ,
I'm skipping whatever remains of this entry
(There was 1 error message)
답변2
Bib 파일은 일반 텍스트일 뿐이며 이에 상응하는 파일이 없으므로 \end{document}
연결만 하면 됩니다(중복 항목에 대한 책임을 수락하므로).
리눅스에서는 --shell-escape
다음과 같은 일을 할 수 있습니다
\documentclass{article}
\immediate\write18 {cat nice_papers*.bib > \jobname.bib}
\addbibresource{\jobname.bib}
\begin{document}
cat...
Windows에서는 비슷 합니다. 대신에 copy /y nice_papers*.bib \jobname.bib
. 이는 biblatex를 가정하지만 bibtex에 대한 변경은 사소한 것입니다( \bibliography{\jobname}
).
latexmk
외부 도구를 사용하지 않으므로 호환되어야 합니다 .
주의해야 할 점은 소스 bib 파일이 하나 이상의 개행 문자로 끝나야 병합 지점에서 가비지 라인으로 끝나지 않는다는 것입니다.Bibfile의 댓글)