> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Zotero 集成

> 关联你的 Zotero 账户，将文献库导入 .bib 文件，从中引用、刷新文件并取消关联。

将 Zotero 文献库以 `.bib` 文件的形式导入项目，然后像平常一样从中引用。该文件是一份副本：只有在你点击 **Refresh** 时才会变化。

> [!NOTE]
>
> 如果你在 **Account settings** 中看不到 Zotero 选项，请让管理员开启 [Zotero 集成](https://ayakaleaf-pro.mintlify.site/zh-CN/on-premises/configuration/overleaf-toolkit/integrations/zotero-integration.md)。

## 关联你的 Zotero 账户

此操作只需做一次。

**1. 打开账户设置**

点击 **Account**，然后点击 **Account settings**。在 **Reference managers** 下找到 **Zotero**，点击 **Link to Zotero**。

![账户设置中的 Zotero 部分，带有 Link to Zotero 按钮](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-link.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=bd8103eadfb8c79e5d2f58a83a5ac33e)

账户设置中的 Zotero

编辑器 **Integrations** 面板中的 **Zotero** 卡片会在同一标签页中带你到同一位置。

![带有 Zotero 卡片的 Integrations 面板](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-integrations.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=ee6c0da4ffd26db23956a92eebf60765)

Integrations 面板

**2. 在 Zotero 上授权**

Zotero 页面会打开。如有提示请先登录，然后授权该应用。它只请求读取你的文献库和群组，因此无法更改 Zotero 中的任何内容。

**3. 检查关联**

你会回到账户设置。一条绿色消息显示 **Reference manager linked**，按钮变为 **Unlink**。

![账户设置中的 Zotero 部分，带有绿色消息和 Unlink 按钮](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-linked.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=185a0e5c172d3a5f6a9e50a325f32cf3)

你的 Zotero 账户已关联

如果你没有在 Zotero 上允许访问，同一部分会显示 **Sorry, something went wrong**。点击 **Link to Zotero** 重试。

## 从文献库创建文件

**1. 打开 Add files 对话框**

打开一个项目。在文件树中点击 **New file**，然后点击 **From Zotero**。只有在账户关联后才会出现此项。

**2. 选择文件名和文献库**

**File Name** 默认为 `zotero.bib`。请保留 `.bib` 扩展名：否则你将看不到预览，`\cite` 和 `\bibliography` 也都找不到其中的条目。

**Library** 默认为 **My Library**，同时还会列出你的群组文献库。一个文件对应一个文献库。

![Add files 对话框的 From Zotero 标签页，显示 zotero.bib 和 My Library](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-new-file.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=707728eb955b49101ab3977d1b19baa6)

来自个人文献库的文件

**3. 点击 Create**

对话框关闭，文件出现在文件树中。点击它：会显示导入时间及其条目。你无法在编辑器中编辑它。

![在编辑器中打开的已导入 zotero.bib，带有 Refresh 按钮](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-file.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=b2d3560f942619fcc479ea875e7f7957)

导入的文件

如果点击 **Create** 似乎没有反应，说明已存在同名文件。请换一个名称。

### 导入群组文献库

再操作一次，使用单独的文件名，并在 **Library** 下选择该群组。一个项目可以有多个这样的文件。

![From Zotero 标签页，文件名为 reading-group.bib，文献库为 Reading group](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-group.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=a5cb43fdf5d97546eb1609160147aeee)

来自群组文献库的文件

## 从文件中引用

**1. 开始引用**

在 `.tex` 文件中输入 `\cite{`。列表会显示项目中所有 `.bib` 文件的条目。点击某一条即可插入。

![编辑器在引用下方列出引用键](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-cite.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=394bda9a2a326e5d878fc16932ec0322)

已导入文件的条目

**2. 或按标题或作者搜索**

点击列表下方的 **Search**，或在花括号内按 Ctrl+Space。输入内容进行筛选，点击一个或多个条目，然后点击 **Insert**。

![Search the .bib files in this project 对话框，已选中一个条目](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-search.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=027a2212a2b3cb83b7017014fe40ce22)

文献搜索

**3. 添加参考文献列表**

在 `\end{document}` 之前添加以下几行，使用不带 `.bib` 的文件名，并用逗号分隔：

```latex theme={null}
\bibliographystyle{plain}
\bibliography{reading-group,zotero}
```

点击 **Recompile**。参考文献会出现在 PDF 中。

![带有引用和参考文献列表的编辑器，以及包含一条参考文献的已编译 PDF](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-compiled.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=9c593d72f5d12495dc4ec2863dd0546d)

编译后的参考文献

导入的文件不会出现在 **Settings** 的 **References**、**Main bibliography file for this project** 中，因此如果项目没有其他 `.bib` 文件，该列表会保持为空。你仍然可以从中引用。

![项目设置的 References 标签页，列表为空且已禁用](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-settings-references.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=48dad4818c2dac63afc46decea21790f)

列表为空是正常的

## 刷新文件

Zotero 文献库中的更改不会自动同步到项目，编译也不会获取它们。

**1. 打开文件**

在文件树中点击已导入的文件。

**2. 点击 Refresh**

整个文件会从你创建时选择的文献库重新导入：新条目出现，已删除的条目消失。顶部的时间会随之改变。

![刷新后的 zotero.bib，带有一个新条目和新的导入时间](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-refresh.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=aa095ac91264ef0e4517a860fb94b5c9)

刷新后的文件

**3. 重新编译**

新条目会立即出现在 `\cite{` 列表中。点击 **Recompile** 更新 PDF。

每个文件单独刷新：请另行刷新群组的文件。关于在共享项目中谁可以刷新文件，请参阅[管理员说明](https://ayakaleaf-pro.mintlify.site/on-premises/configuration/overleaf-toolkit/integrations/zotero-integration.md#notes)。

## 取消关联 Zotero 账户

在 **Account settings** 的 **Zotero** 下点击 **Unlink**，然后在对话框中再次点击 **Unlink**。按钮会重新显示 **Link to Zotero**。

![Unlink Zotero Account 对话框](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-unlink.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=3783d8622dee66277c2420154294220e)

取消关联账户

你导入的文件会保留在项目中，并且仍可编译。**From Zotero** 会从 **Add files** 对话框中消失，在你重新关联账户之前，**Refresh** 会显示错误。

![已导入的文件显示错误 Could not load references from Zotero, please re-link your account and try again](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-relink-error.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=d0c678b299fa6604d857398aad9bca18)

未关联账户时刷新

重新关联后，**Refresh** 可以在相同的文件上正常使用。

## 如果出现问题

在 **Add files** 对话框中出现 **Could not load references from Zotero, please re-link your account and try again** 或 **There was an error accessing your Zotero data**：Overleaf 无法再读取你的文献库，例如你在 Zotero 上撤销了它的访问权限。在 **Account settings** 中点击 **Unlink**，然后点击 **Link to Zotero**。在此之前，**Create** 也会失败，并显示 **The project that contains this file is not shared with you**，即使是在你自己的项目中。

![From Zotero 标签页，显示两条错误消息](https://mintcdn.com/ayakaleaf-pro/Obqf0nQWnHIHMjO7/images/on-premises/zotero-access-error.png?fit=max\&auto=format\&n=Obqf0nQWnHIHMjO7\&q=85\&s=65bee2963ce16aec585fb55945e6554d)

Overleaf 无法再读取你的文献库

点击 **Refresh** 时出现 **The remote service produced an error**：对 Zotero 的请求失败。文件内容保持不变。请稍后再次点击 **Refresh**。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.