# Technical Documentation: Keldos-Li/typora-latex-theme

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/Keldos-Li/typora-latex-theme)

### Overview (`README.md`)

# Typora 伪装 LaTeX 中文样式主题

[下载与安装](#下载与安装) | [帮助文档](https://github.com/Keldos-Li/typora-latex-theme/wiki) | [个性化设置](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E4%B8%AA%E6%80%A7%E5%8C%96%E8%AE%BE%E7%BD%AE) | [贡献指南](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E8%B4%A1%E7%8C%AE%E6%8C%87%E5%8D%97) | [技术细节](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E6%8A%80%E6%9C%AF%E7%BB%86%E8%8A%82) | [常见问题](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)  

本项目的初衷是为了简化中国大陆本科生**小型通识课论文**（或**小型实验报告**）撰写的负担。这里基本采用了浙江大学要求的格式（字体较小，页边距较小），但大部分同学都可以自行在 CSS 中修改适合自己学校的格式。  

Markdown 的轻量化特性，使您可以专注于论文内容而不用担心格式。书写时仅通过简单的标记，并通过替换样例模板中的个人信息，您就可以输出类 LaTeX 排版的精美论文与报告。本项目支持 Windows, macOS 和 Linux 三大平台的 Typora。

<a href="https://github.com/Keldos-Li/typora-latex-theme/releases"></a>
<a href="https://github.com/Keldos-Li/typora-latex-theme/releases/latest"></a>
<a href="https://github.com/Keldos-Li/typora-latex-theme/stargazers"></a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=IB2QSpQSSOQIDZfN74ujqx1aVtQtdtXF&jump_from=webapi">
</a>

## 预览

您可以通过以下方式预览本主题：

1. 通过[在线 PDF 预览器](https://blog.keldos.me/2021/05/md-latex-template/)预览导出结果
2. 观看[介绍视频](https://www.bilibili.com/video/BV1634y1h7pE)，其中简洁清晰地介绍了主题外观和安装方法
3. 查看下列截图

### 封面，摘要和关键词

| ||
| :----: | :----: |

### 预览与编写

| ||
| :----: | :----: |
| ||

#### 层级标题 

|||
| :----: | :----: |

#### 表格 
|||
| :----: | :----: |

```markdown
表格：

<center><strong>表 2  全球/中国桌面操作系统市场份额占比（%）</strong></center>

| OS   | Windows | macOS | Unknown | Linux | Chrome OS | 其他 |
| ---- | ------- | ----- | ------- | ----- | --------- | ---- |
| 全球 | 76.56   | 17.1  | 2.68    | 1.93  | 1.72      | 0.01 |
| 中国 | 87.55   | 5.44  | 6.24    | 0.75  | 0.01      | 0.01 |
```

#### 项目列表
|||
| :----: | :----: |

#### 代码块 
|||
| :----: | :----: |

#### Mermaid
|||
| :----: | :----: |

```markdown
mermaid 图形：

​```mermaid
graph LR
A(开始) -->
input[/输入a,b/] --> if{a%b=0 ?}
if --->|yes| f1[GCD = b] --> B(结束)
if --->|no| f2["a, b = b, a % b "]-->if
​```
```

#### 公式

|||
| :----: | :----: |

```latex
公式：

$$
\iint\limits_{x^2 + y^2 \leq R^2} f(x,y)\,\mathrm{d}x\,\mathrm{d}y = \int_{\theta=0}^{2\pi} \mathrm{d}\theta\int_{r=0}^R f(r\cos\theta,r\sin\theta) r\,\mathrm{d}r\, \tag{1}
$$
```

## 下载与安装

**请完整阅读以下过程，以确保一切符合预期。**  

1. [Typora](https://typora.io/) 是一个支持实时预览的 markdown 编辑器。在安装本主题前，请确认您已[下载 Typora](https://typora.io/#download) 并完成了安装。如果您对 markdown 的语法还不了解，您可以从这里[获得帮助](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98#%E4%BB%80%E4%B9%88%E6%98%AF-markdown)。

2. 前往本项目的 [release](https://github.com/Keldos-Li/typora-latex-theme/releases) 页面，下载适合您操作系统的最新版本压缩包。比如，如果您在使用 Windows 操作系统，您就应该下载 `latex-theme-windows.zip`。 

3. 解压缩这个文件，进入解压缩后的文件夹。按照[在线安装教程](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B)或该文件夹下 `README.md` 中的安装教程**完成剩余的安装步骤**。请务必确认您完成了下面的步骤：
     - [进行手动或自动主题安装](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B#%E5%BC%80%E5%A7%8B%E5%AE%89%E8%A3%85)
     - [下载并安装所需的字体](https://github.com/Keldos-Li/typora-latex-theme/wiki/%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B#%E5%AE%89%E8%A3%85%E5%AD%97%E4%BD%93)



## 鸣谢

本项目是在下面两个开源项目的基础上完成的：  

- [yfzhao20/Typora-markdown](https://github.com/yfzhao20/Typora-markdown)  
- [du33169/typora-theme-essay_cn](https://github.com/du33169/typora-theme-essay_cn)  

感谢 [@大啊好我r中之](https://space.bilibili.com/239828907) 制作介绍视频

---

### Overview (`src/README.md`)

# 安装教程

## 安装前

安装本主题前，**请确保您已经安装 Typora**.
请注意，`resources` 文件夹中的 `essay-template.md` 和 `essay-template.pdf` 展示了一篇小论文在该主题下的效果（其中文字来源于我本人的课程作业以及一些拼凑，请不要在意过多细节），其中论文封面（也单独放置在 `cover-template.md` 文件中）、摘要、关键词和其他一些特别的元素使用 HTML 代码来编写。您可以自行取用修改它们的文字内容部分和代码部分来完成您的课程论文。  

## 开始安装

以下给出两种安装途径，请任选其一执行。  

### 手动安装

请您打开安装包的 `target` 文件夹，按照[官方教程（英文）](https://theme.typora.io/doc/Install-Theme/)，将这个文件夹里的所有 CSS 文件复制到指定的 Typora 主题文件夹中。 

### 自动安装
- 如果您在使用 macOS ，请运行 `install.sh` 文件。具体的运行方式是：打开*终端*，将 `install.sh` 文件拖入终端窗口中。如果您不知道如何打开终端，请参考以下步骤：打开[启动台](https://support.apple.com/zh-cn/HT202635)；在启动台顶部的搜索栏里，搜索“终端”，然后点击搜索结果中的终端图标。  
- 如果您在使用 Windows ，请运行 `install.ps1` 文件。具体的运行方式是：右键点击 `install.ps1` 文件，然后点击“使用 PowerShell 运行”。  
    若您看到了以下提示，请输入`Y`，然后按下回车`enter`：  
    
    > 执行策略更改  
    > 执行策略可帮助你防止执行不信任的脚本。更改执行策略可能会产生安全风险，如 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies 帮助主题所述。是否要更改执行策略?  
    > [Y] 是(Y)  [A] 全是(A)  [N] 否(N)  [L] 全否(L)  [S] 暂停(S)  [?] 帮助 (默认值为“N”):  

- 如果您在使用 Linux ，只需在终端执行 `sh ./install.sh` 即可完成安装。  

## 安装字体

**以上步骤执行完毕后， Typora 显示的结果可能并不符合您的预期。比如，中文字体缺少衬线，或中文字体是点阵字体等。这时，您需要安装本主题依赖的所有字体。** 对于 macOS 和 Windows 用户，您可以在  [Keldos-Li/typora-latex-theme-fonts](https://github.com/Keldos-Li/typora-latex-theme-fonts) 仓库下载并安装您需要的字体； Linux 用户应确保相关字体在您的发行版上被正确安装。具体而言：  

- macOS 用户可以前往 [`/macOS`](https://github.com/Keldos-Li/typora-latex-theme-fonts/tree/main/macOS) 和 [`/General platform`](https://github.com/Keldos-Li/typora-latex-theme-fonts/tree/main/General%20platform) 获取适用于 macOS 的额外字体。  
- Windows 用户可以前往 [`/Windows`](https://github.com/Keldos-Li/typora-latex-theme-fonts/tree/main/Windows) 和 [`/General platform`](https://github.com/Keldos-Li/typora-latex-theme-fonts/tree/main/General%20platform) 获取适用于 Windows 的额外字体。  
- **Linux 用户必须确认已安装 `Noto CJK` 家族的字体，因为一些发行版或桌面环境并不默认安装该字体。** 您需要在您的包管理器中搜索 `noto-cjk` 或 `noto-fonts-cjk`， 确认该字体的来源或维护者与谷歌相关，即可放心进行安装。如果您不理解以上描述，我们在附录里给出了一些常见包管理器安装 `Noto CJK` 的指令，供您参考。  


## 最后一步

重新启动 Typora，然后在菜单栏的**主题**下拉菜单中选择 `Latex` 或 `Latex Dark` 选项。如果您在手动安装字体后，依然出现与字体相关的问题，请尝试重启您的计算机。  

如果您觉得这个主题对您有帮助，您可以考虑在 GitHub 上为我们的项目点 star ⭐. 因为，这不仅有助于将这个主题推广给更多有需要的人，还能对我们的开发与维护产生帮助。您的支持就是我们做下去的最大动力。  

## 附录

### Linux 常见包管理器 `Noto CJK` 安装指令

|   包管理器   |   `Noto CJK` 安装指令   |
| ---- | ---- |
|   apt   |   `sudo apt install fonts-noto-cjk`   |
|   pacman   |   `sudo pacman -S noto-fonts-cjk`   |
|  yay    |   `yay -S noto-fonts-cjk`   |
|   portage    |   `sudo emerge noto-cjk`   |

如果您常用的包管理器不在列表里，希望您能在 issue 中进行报告。

---

--- METRICS ---
- Files Extracted: 2
- Estimated Token Budget: ~1516 tokens
- Canonical Reference: https://codewiki.google/github.com/Keldos-Li/typora-latex-theme
