jupyter notebook导出含中文的pdf(LaTex安装和Pandoc、MiKTex安装)

用jupyter notebook导出pdf时,因为报错信息,需要用到Tex

nbconvert failed: xelatex not found on PATH, if you have not installed xelatex you may need to do so. Find further instructions at https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex.

目录

一 LaTex安装

1. macOS版

 1.1 Tex Live下载 安装

 1.2 TeXstudio编辑器下载安装

​编辑

2. windows版

2.1 TexLive下载安装

2.2 TeXstudio编辑器的安装

3.安装验证

4.导出验证

5.不显示中文处理

二 如果上面的不行,再用下面的方法

1安装Pandoc

2安装MiKTex

补充: 更多LaTex使用


一 LaTex安装

1. macOS版

 1.1 Tex Live下载 安装

macOS版下载

 1.2 TeXstudio编辑器下载安装

TeXstudio - A LaTeX editor

2. windows版

2.1 TexLive下载安装

官网

直接git下载

git clone https://github.com/latex3/latex2e.git

或者 

清华大学开源软件镜像

双击.bat文件 

大概需要1-2小时,如果安装失败,重新进行安装

查看是否安装成功:

latex -v 

2.2 TeXstudio编辑器的安装

清华大学开源软件镜像站 

下载后,双击安装,安装路径选择默认最好!! 

3.安装验证

安装完成后,打开编辑器

搜索栏搜索“TeXstudio”(为了方便,快捷方式可以移到桌面)

1、新建一个空白文件

2. 编写一个简单的文档,编译并查看效果

\documentclass[UTF8]{article}

\begin{document}
	hello!
\end{document}

输入代码后,构建并查看 

macOS

3、保存

最后,请记住自己安装texlive和texstudio的路径!!!!

我的路径:

 C:/softwares/texlive/2024

C:\Program Files\texstudio

4.导出验证

重启jupyter notebook,再次导出pdf,成功!!!!!

pdf如下: 

如果还不行的话,尝试配置路径,把C:\softwares\texlive\2024\bin\windows路径加入path中

5.不显示中文处理

由上图可看出红色箭头指向的 # 号后面的中文没有显示出来

修改jupyter内置文件(以下是路径)

macOS下的路径:

/Users/mac/Library/Python/3.9/share/jupyter/nbconvert/templates/latex

 修改的代码如下:

\documentclass[11pt]{ctexart}

修改前: 

修改后:

重启jupyter notebook后,导出,中文显示了

 更多pdf导出显示问题

二 如果上面的不行,再用下面的方法

1安装Pandoc

Pandoc官网下载地址: https://pandoc.org/installing.html

git下载

Release pandoc 3.1.6.2 · jgm/pandoc · GitHub

正常安装即可 

gitcode的镜像也有:https://gitcode.net/mirrors/jgm/pandoc/-/releases/3.1.6.1?spm=1033.2243.3001.5876

2安装MiKTex

如果导出pdf通过LaTex,还需要下载MiKTex: https://miktex.org/download

 正常安装即可!

记得重启jupyter notebook!!!!!

补充: 更多LaTex使用

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值