【记录贴】在树莓派中安装 TeX Live

前言

为什么要在树莓派上安装 TeX\TeX Live 呢?因为好玩可以学到 Linux 的一些东西,还可以拿来装逼体验 Linux 下跑 LaTeX\LaTeX 的速度。

以此贴笼统的记录全过程,配置树莓派的过程比较简略,毕竟详细的步骤网上都有很多,搜一搜就能找到。

正文

用到的主要设备:

  • Raspberry Pi 4 Model B
  • 网线
  • 读卡器
  • tf 卡
  • Win 10 笔记本电脑

购买

找到官网推荐的购买链接,选择

  • Select a model: 4GB RAM
  • Country: 中国

然后找一家淘宝店购买。(注意 RPi 4B 的发热比较严重,建议购买主动散热装置)

组装及烧录

组装看配套的说明手册。

烧录我是用了淘宝店提供的百度网盘里的软件。(也可以用官网提供的 Downloads,总之不是重点)

格式化 tf 卡、烧录好系统之后,在 tf 卡的主目录下创建一个

  • 文件名为 ssh
  • 不带后缀

的文件,代表开启树莓派的 SSH 功能。

SSHVNC 连接树莓派

参考知乎问题《没有显示器可以使用树莓派么,初次安装过程中呢?》。(温馨提示:可以连接上树莓派的 IP 地址可能要等一段时间才能刷出来,如果测试了好几个 IP 都不行,就多等会)

安装 TeX Live

在《TeX Live 2019安装指南》中,@李阿玲提到

如果想要装TUG官方的,还不能从iso里面安装,得用联网安装的模式。

经测试,如果用 iso 安装,会返回

Quitting, no binary platform specified/available.
See https://tug.org/texlive/custom-bin.html for
information on other precompiled binary sets.

因此采用联网安装的方式(参考《Texlive网络安装与配置》)。
下载安装程序(这里使用阿里云,可以自己换源)

wget http://mirrors.aliyun.com/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -zxvf install-tl-unx.tar.gz

切换到压缩包解压后的位置(这里写的是我的树莓派解压后的位置)

cd /home/pi/install-tl-20200805

开始安装

sudo ./install-tl --no-gui -location http://mirrors.aliyun.com/CTAN/systems/texlive/tlnet/

然后根据自己的需求选择性安装,由于树莓派我是打算拿来跑程序而不是拿来查文档的,因此我选择了不安装说明文档。安装界面如下:

======================> TeX Live installation procedure <=====================

======> Letters/digits in <angle brackets> indicate <=======
======> menu items for actions or customizations <=======

Detected platform: GNU/Linux on ARMv6/RPi

<B> set binary platforms: 1 out of 16

<S> set installation scheme: scheme-full

<C> set installation collections:
40 collections out of 41, disk space required: 6983 MB

<D> set directories:
TEXDIR (the main TeX directory):
/usr/local/texlive/2020
TEXMFLOCAL (directory for site-wide local files):
/usr/local/texlive/texmf-local
TEXMFSYSVAR (directory for variable and automatically generated data):
/usr/local/texlive/2020/texmf-var
TEXMFSYSCONFIG (directory for local config):
/usr/local/texlive/2020/texmf-config
TEXMFVAR (personal directory for variable and automatically generated data):
~/.texlive2020/texmf-var
TEXMFCONFIG (personal directory for local config):
~/.texlive2020/texmf-config
TEXMFHOME (directory for user-specific files):
~/texmf

<O> options:
[ ] use letter size instead of A4 by default
[X] allow execution of restricted list of programs via \write18
[X] create all format files
[X] install macro/font doc tree
[X] install macro/font source tree
[ ] create symlinks to standard directories

<V> set up for portable installation

Actions:
<I> start installation to hard disk
<P> save installation profile to 'texlive.profile' and exit
<H> help
<Q> quit

键入 O,返回:

===============================================================================
Options customization:

<P> use letter size instead of A4 by default: [ ]
<E> execution of restricted list of programs: [X]
<F> create all format files: [X]
<D> install font/macro doc tree: [X]
<S> install font/macro source tree: [X]
<L> create symlinks in standard directories: [ ]
binaries to:
manpages to:
info to:

Actions: (disk space required: 6983 MB)
<R> return to main menu
<Q> quit

键入 D 取消安装文档,键入 R,返回主界面,键入 C 选择性安装 TeX\TeX Live 的 collection:

===============================================================================
Select collections:

a [X] Essential programs and files w [X] Italian
b [X] BibTeX additional styles x [X] Japanese
c [X] TeX auxiliary programs y [X] Korean
d [X] ConTeXt and packages z [X] Other languages
e [X] Additional fonts A [X] Polish
f [X] Recommended fonts B [X] Portuguese
g [X] Graphics and font utilities C [X] Spanish
h [X] Additional formats D [X] LaTeX fundamental packages
i [X] Games typesetting E [X] LaTeX additional packages
j [X] Humanities packages F [X] LaTeX recommended packages
k [X] Arabic G [X] LuaTeX packages
l [X] Chinese H [X] MetaPost and Metafont packages
m [X] Chinese/Japanese/Korean (base) I [X] Music packages
n [X] Cyrillic J [X] Graphics, pictures, diagrams
o [X] Czech/Slovak K [X] Plain (La)TeX packages
p [X] US and UK English L [X] PSTricks
s [X] Other European languages M [X] Publisher styles, theses, etc.
t [X] French N [ ] Windows-only support programs
u [X] German O [X] XeTeX and packages
v [X] Greek
P [X] Mathematics, natural sciences, computer science packages
S [X] TeXworks editor; TL includes only the Windows binary

Actions: (disk space required: 4143 MB)
<-> deselect all
<+> select all
<R> return to main menu
<Q> quit

键入 - 取消所有,参考《TeX Live宏包集合和自定义安装》,键入 abcflmDFGJOP,返回

 a [X] Essential programs and files      w [ ] Italian                         
b [X] BibTeX additional styles x [ ] Japanese
c [X] TeX auxiliary programs y [ ] Korean
d [ ] ConTeXt and packages z [ ] Other languages
e [ ] Additional fonts A [ ] Polish
f [X] Recommended fonts B [ ] Portuguese
g [ ] Graphics and font utilities C [ ] Spanish
h [ ] Additional formats D [X] LaTeX fundamental packages
i [ ] Games typesetting E [ ] LaTeX additional packages
j [ ] Humanities packages F [X] LaTeX recommended packages
k [ ] Arabic G [X] LuaTeX packages
l [X] Chinese H [ ] MetaPost and Metafont packages
m [X] Chinese/Japanese/Korean (base) I [ ] Music packages
n [ ] Cyrillic J [X] Graphics, pictures, diagrams
o [ ] Czech/Slovak K [ ] Plain (La)TeX packages
p [ ] US and UK English L [ ] PSTricks
s [ ] Other European languages M [ ] Publisher styles, theses, etc.
t [ ] French N [ ] Windows-only support programs
u [ ] German O [X] XeTeX and packages
v [ ] Greek
P [X] Mathematics, natural sciences, computer science packages
S [ ] TeXworks editor; TL includes only the Windows binary

Actions: (disk space required: 996 MB)
<-> deselect all
<+> select all
<R> return to main menu
<Q> quit

键入 R 返回主界面

======================> TeX Live installation procedure <=====================

======> Letters/digits in <angle brackets> indicate <=======
======> menu items for actions or customizations <=======

Detected platform: GNU/Linux on ARMv6/RPi

<B> set binary platforms: 1 out of 16

<S> set installation scheme: scheme-custom

<C> set installation collections:
12 collections out of 41, disk space required: 996 MB

<D> set directories:
TEXDIR (the main TeX directory):
/usr/local/texlive/2020
TEXMFLOCAL (directory for site-wide local files):
/usr/local/texlive/texmf-local
TEXMFSYSVAR (directory for variable and automatically generated data):
/usr/local/texlive/2020/texmf-var
TEXMFSYSCONFIG (directory for local config):
/usr/local/texlive/2020/texmf-config
TEXMFVAR (personal directory for variable and automatically generated data):
~/.texlive2020/texmf-var
TEXMFCONFIG (personal directory for local config):
~/.texlive2020/texmf-config
TEXMFHOME (directory for user-specific files):
~/texmf

<O> options:
[ ] use letter size instead of A4 by default
[X] allow execution of restricted list of programs via \write18
[X] create all format files
[ ] install macro/font doc tree
[X] install macro/font source tree
[ ] create symlinks to standard directories

<V> set up for portable installation

Actions:
<I> start installation to hard disk
<P> save installation profile to 'texlive.profile' and exit
<H> help
<Q> quit

发现只需要 996 MB,不喜欢这个数字的朋友可以多 / 少安装几个 collection。键入 I 开始安装。

安装完之后,开始设置环境变量。(参考 install-latex

sudo apt-get install gedit
gedit ~/.bashrc

在打开的文件末尾添加(实际上只需要第一个环境变量即可)

# Add TeX Live to the PATH, MANPATH, INFOPATH
export PATH=/usr/local/texlive/2020/bin/armhf-linux:$PATH
export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH
export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH

并保存退出,输入

tex -v

查看是否安装成功。若成功,接下来处理字体,输入

sudo cp /usr/local/texlive/2020/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf

将配置文件复制到系统,然后继续执行

sudo fc-cache -fsv

刷新字体缓存。至此安装结束。

然后就可以测试树莓派的性能,开始愉快的玩耍了。(测试代码可以使用 @stone-zeng 的博文《TeX\TeX 性能评测》中的代码)

文章作者: sikouhjw
文章链接: https://sikouhjw.github.io/2020/08/07/2020-08-07-RPi-texlive/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 sikouhjw.github.io
支付宝捐赠
微信捐赠