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.TexLive下载安装

官网

直接git下载

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

或者 

清华大学开源软件镜像

双击.bat文件 

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

查看是否安装成功:

latex -v 

2.TeXstudio编辑器的安装

清华大学开源软件镜像站 

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

3.安装验证

安装完成后,打开编辑器

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

1、新建一个空白文件

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

\documentclass[UTF8]{article}

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

输入代码后,构建并查看 

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内置文件(以下是路径)

\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使用

最近更新

  1. TCP协议是安全的吗?

    2024-03-27 05:36:02       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-27 05:36:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-27 05:36:02       20 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-27 05:36:02       20 阅读

热门阅读

  1. 蓝桥杯:BFS

    2024-03-27 05:36:02       17 阅读
  2. Unity3D 主城角色动画控制与消息触发详解

    2024-03-27 05:36:02       19 阅读
  3. 约瑟夫环-递推公式的个人理解

    2024-03-27 05:36:02       21 阅读
  4. 计算机网络(04)

    2024-03-27 05:36:02       22 阅读
  5. C# get set 访问器

    2024-03-27 05:36:02       18 阅读
  6. 智能媒体api调用

    2024-03-27 05:36:02       19 阅读
  7. C#语言规范及特殊用法笔记

    2024-03-27 05:36:02       20 阅读
  8. Python中类(class)的使用方法

    2024-03-27 05:36:02       19 阅读
  9. React Native获取及监听网络状态

    2024-03-27 05:36:02       19 阅读
  10. docker 安装 kibana

    2024-03-27 05:36:02       22 阅读