Copy
---
title: BibTeX
---
>[BibTeX](https://www.ctan.org/pkg/bibtex)는 `LaTeX` 조판 시스템과 함께 일반적으로 사용되는 파일 형식 및 참고 문헌 관리 시스템입니다. 학술 및 연구 문서의 서지 정보를 구성하고 저장하는 방법으로 사용됩니다.
`BibTeX` 파일은 `.bib` 확장자를 가지며, 책, 논문, 학회 논문, 학위 논문 등 다양한 출판물에 대한 참조를 나타내는 일반 텍스트 항목으로 구성됩니다. 각 `BibTeX` 항목은 특정 구조를 따르며 저자 이름, 출판물 제목, 저널 또는 책 제목, 출판 연도, 페이지 번호 등과 같은 다양한 서지 세부 정보에 대한 필드를 포함합니다.
BibTeX 파일은 검색할 수 있는 `.pdf` 파일과 같은 문서 경로도 저장할 수 있습니다.
## Installation
먼저 `bibtexparser`와 `PyMuPDF`를 설치해야 합니다.
```python
pip install -qU bibtexparser pymupdf
Examples
BibtexLoader는 다음과 같은 인자를 가집니다:
file_path:.bibbibtex 파일의 경로- optional
max_docs: 기본값=None, 즉 제한 없음. 검색된 문서 수를 제한하는 데 사용합니다. - optional
max_content_chars: 기본값=4000. 단일 문서의 문자 수를 제한하는 데 사용합니다. - optional
load_extra_meta: 기본값=False. 기본적으로 bibtex 항목에서 가장 중요한 필드만 가져옵니다:Published(출판 연도),Title,Authors,Summary,Journal,Keywords,URL. True로 설정하면entry_id,note,doi,links필드도 로드하려고 시도합니다. - optional
file_pattern: 기본값=r'[^:]+\.pdf'.file항목에서 파일을 찾기 위한 정규식 패턴입니다. 기본 패턴은Zotero스타일 bibtex 형식과 단순 파일 경로를 지원합니다.
Copy
from langchain_community.document_loaders import BibtexLoader
Copy
# Create a dummy bibtex file and download a pdf.
import urllib.request
urllib.request.urlretrieve(
"https://www.fourmilab.ch/etexts/einstein/specrel/specrel.pdf", "einstein1905.pdf"
)
bibtex_text = """
@article{einstein1915,
title={Die Feldgleichungen der Gravitation},
abstract={Die Grundgleichungen der Gravitation, die ich hier entwickeln werde, wurden von mir in einer Abhandlung: ,,Die formale Grundlage der allgemeinen Relativit{\"a}tstheorie`` in den Sitzungsberichten der Preu{\ss}ischen Akademie der Wissenschaften 1915 ver{\"o}ffentlicht.},
author={Einstein, Albert},
journal={Sitzungsberichte der K{\"o}niglich Preu{\ss}ischen Akademie der Wissenschaften},
volume={1915},
number={1},
pages={844--847},
year={1915},
doi={10.1002/andp.19163540702},
link={https://onlinelibrary.wiley.com/doi/abs/10.1002/andp.19163540702},
file={einstein1905.pdf}
}
"""
# save bibtex_text to biblio.bib file
with open("./biblio.bib", "w") as file:
file.write(bibtex_text)
Copy
docs = BibtexLoader("./biblio.bib").load()
Copy
docs[0].metadata
Copy
{'id': 'einstein1915',
'published_year': '1915',
'title': 'Die Feldgleichungen der Gravitation',
'publication': 'Sitzungsberichte der K{"o}niglich Preu{\\ss}ischen Akademie der Wissenschaften',
'authors': 'Einstein, Albert',
'abstract': 'Die Grundgleichungen der Gravitation, die ich hier entwickeln werde, wurden von mir in einer Abhandlung: ,,Die formale Grundlage der allgemeinen Relativit{"a}tstheorie`` in den Sitzungsberichten der Preu{\\ss}ischen Akademie der Wissenschaften 1915 ver{"o}ffentlicht.',
'url': 'https://doi.org/10.1002/andp.19163540702'}
Copy
print(docs[0].page_content[:400]) # all pages of the pdf content
Copy
ON THE ELECTRODYNAMICS OF MOVING
BODIES
By A. EINSTEIN
June 30, 1905
It is known that Maxwell’s electrodynamics—as usually understood at the
present time—when applied to moving bodies, leads to asymmetries which do
not appear to be inherent in the phenomena. Take, for example, the recipro-
cal electrodynamic action of a magnet and a conductor. The observable phe-
nomenon here depends only on the r
Copy
---
<Callout icon="pen-to-square" iconType="regular">
[Edit the source of this page on GitHub.](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/document_loaders/bibtex.mdx)
</Callout>
<Tip icon="terminal" iconType="regular">
[Connect these docs programmatically](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Tip>