Code Monkey home page Code Monkey logo

install-latex-guide-zh-cn's Introduction

Install-LaTeX-Guide-zh-cn (A short introduction to LaTeX installation written in Chinese)

This package will introduce the operations related to installing TeX Live (introducing MacTeX in macOS), upgrading packages, and compiling simple documents on Windows 11, Ubuntu 22.04, and macOS systems, and mainly introducing command line operations. At the same time, it briefly introduces the use of several common editors under different operating systems, and additionally adds some related content using Online LaTeX editor, e.g. Overleaf.

Users are advised to read texlive-zh-cn and lshort-zh-cn for a more comprehensive understanding of the basic content.

The code involved in this article also asks users to do more, don't simply copy and paste.

If you need to compile the source files, please make sure to install the fandol font and use the xelatex command. TeX Live users are recommended to use the following commands

latexmk -xelatex -synctex=1 install-latex-guide-zh-cn

Users who cannot use latexmk can execute make.bat or make according to their operating system.

If you need the PDF file compiled by this project, you can download it from Releases.

License

This work is released under the LaTeX Project Public License, v1.3c or later.

一份简短的关于 LaTeX 安装的介绍

本文将介绍 Windows 11、Ubuntu 22.04 和 macOS 系统中安装 TeX Live (macOS 中介绍 MacTeX)、升级宏包、编译简易文档的相关操作, 并多以介绍命令行操作为主. 同时简要介绍不同操作系统下几款常见编辑器的使用方法, 并额外补充了一些使用在线 LaTeX 编辑器, 如 Overleaf, 的相关内容.

建议用户阅读 texlive-zh-cnlshort-zh-cn 以更全面地了解基础内容.

本文所涉及到的代码还请用户多多动手, 不要简单地复制粘贴.

若需要编译源文件, 请确保安装 fandol 字体, 并使用 xelatex 命令. 推荐 TeX Live 用户使用如下命令

latexmk -xelatex -synctex=1 install-latex-guide-zh-cn

无法使用 latexmk 的用户可以根据自己的操作系统执行 make.batmake.

若需要本项目编译完成的 PDF 文件, 可至 Releases 处下载.

开源协议

本次工作将遵循协议 LaTeX Project Public License, v1.3c 或其后版本.

install-latex-guide-zh-cn's People

Contributors

ethandeng avatar hermitsun avatar liziwl avatar muzimuzhi avatar nemoyuan2008 avatar osbertwang avatar stone-zeng avatar syvshc avatar tanukihee avatar tauyoungsama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

install-latex-guide-zh-cn's Issues

windows 下卸载 tl 时的注册表清理位置

目前版本中关于 win 下手动卸载 tl 的介绍中,需要手动清理 HKCU 下的三条注册表。

并且清理注册表
\begin{lstlisting}
HKEY_CURRENT_USER\Software\Classes\TL.bitmap2eps.convert.2020
HKEY_CURRENT_USER\Software\Classes\TL.DVIOUT.view.2020
HKEY_CURRENT_USER\Software\Classes\TL.TeXworks.edit.2020
\end{lstlisting}

但若在安装时使用管理员权限「为所有人安装」后,此三条注册表并不在 HKCU 下,而在 HKLM 下。

可以考虑使用海洋大师的latexmkrc脚本用latexmk编译install-LaTeX

$pdf_mode = 5;
$pdflatex = 'pdflatex -file-line-error -interaction=errorstopmode -shell-escape %O %S';
$xelatex = 'xelatex -file-line-error -interaction=errorstopmode -no-pdf -shell-escape %O %S';
$xdvipdfmx = 'xdvipdfmx -q -E -o %D %O %S';
$bibtex_use = 1.5;
$force_mode = 1;
$go_mode = 1;
$clean_ext = 'synctex.gz acn acr snm alg aux bbl xdv bcf nav blg brf fdb_latexmk glg glo gls idx ilg ind ist lof log lot out run.xml toc dvi';

add_cus_dep('glo', 'gls', 0, 'glo2gls');
sub glo2gls {
system("makeindex -s gglo.ist -o "$[0].gls" "$[0].glo"");
}
push @generated_exts, "glo", "gls";

add_cus_dep('nlo', 'nls', 0, 'nlo2nls');
sub nlo2nls {
system("makeindex -s nomencl.ist -o "$[0].nls" "$[0].nlo"");
}
push @generated_exts, "nlo", "nls";

如果 Tex Live 大版本发布但本地未更新,tlmgr 无法正常安装/更新 package

手册中使用 tlmgr option repository ctan 自动获取仓库 URL 或者手动配置的仓库镜像都会随 texlive 发行版更新,如果用户不希望每年都重新安装一次 texlive 发行版,那么每次 texlive 发布新版本后这个仓库 URL 就无法使用了。

对于这类用户,可以参考此帖相关 tug 页面,合适地配置 tlmgr。

如果作者愿意加入这部分内容的话我可以提 pr。

有关 WSL 尚未解决问题的可能解决思路

有关 texdoc 打开相应手册的问题,貌似可以借鉴这个项目 Github - wslu 的工作。

其中有一个工具wslview,它可以将 WSL 的默认浏览器绑定到 Windows 上。

一种选择是,用类似的方法,把 WSL 中的 PDF 浏览器绑定到 Windows 上的。

当然,由于一般现代浏览器都支持浏览 PDF 文档,所以可以直接使用 wslview

可以搞一个 bash 脚本(以下代码是我自行YY的。。)

alias texdoc [pkg-name] = "texdoc -l [pkg-name] || <截取其中 PDF 地址> || wslview "

(好吧,我不知道 bash 里面函数怎么写。。)

就这样,希望有些帮助。

Win 下,TeX Live 2023 的二进制文件路径变为 `<TEXDIR>/bin/windows`

texlive 2023 起,windows 下提供 64 位的二进制文件。对应的,路径 <TEXDIR>/bin/win32 变为 <TEXDIR>/bin/windows

见 The TeX Live Guide—2023, sec. 9.2 Present: 2023

Windows: As announced previously, TeX Live now contains 64-bit Windows binaries instead of 32-bit. The new directory name is bin/windows (it did not seem right to put 64-bit binaries into a directory named with “32”).

涉及的修改。需要额外提及「TeX Live 2023 之前为 bin/win32」吗?

diff --git a/chapter/editor.tex b/chapter/editor.tex
index e7941ff..8a7f99a 100644
--- a/chapter/editor.tex
+++ b/chapter/editor.tex
@@ -20,7 +20,7 @@
 和大多数国产软件不同, \TeX works 不会自动在桌面生成快捷方式,
 新人往往不知道如何打开它. 
 实际上 \TeX works 在 \TeX{} Live 安装路径的
-\texttt{\textbackslash bin\textbackslash win32} 中,
+\texttt{\textbackslash bin\textbackslash windows} 中,
 可在 \textsf{cmd} 中执行 \texttt{texworks} 打开,
 也可直接在 Windows 搜索栏里搜 \TeX works 打开. 
 
diff --git a/chapter/windows.tex b/chapter/windows.tex
index 3e24d45..30c1d75 100644
--- a/chapter/windows.tex
+++ b/chapter/windows.tex
@@ -204,7 +204,7 @@
 \end{lstlisting}
 即可认为安装顺利完成%
 \footnote{若未能正确显示结果, 则可能是因为环境变量未改变,
-用户可手动添加 \texttt{<TEXDIR>\textbackslash bin\textbackslash win32} 至环境变量,
+用户可手动添加 \texttt{<TEXDIR>\textbackslash bin\textbackslash windows} 至环境变量,
 \texttt{<TEXDIR>} 需与你方才的安装路径一致}.
 弹出前面装载的光盘镜像,
 安装到此结束.

未win 跨版本升级尚不支持,无需提及这个路径变化。


CTeX-org/ctex-kit 最近一次的定时测试失败了,在尝试修复时发现了这个变化,

对 5.3 节一些疑问

5.3 节里面有写

在 WSL 中添加窗口化插件

这是什么意思?

是安装图形界面(GUI)的意思吗?

latemk的魔法注释会把当前目录的其它文件按顺序也编译了

% !TeX TXS-program:compile = txs:///latexmk/{}[-xelatex -synctex=1 -interaction=nonstopmode] ,latemk的魔法注释会把当前目录的其它文件按顺序也编译了,如果这个目录放了别的文件,会浪费时间,建议在最后面的参数上加 %.tex,这样就只会编译当前的文件。

修改建议:电脑不能联网时的 texlive 宏包更新

目前描述(共有四份,这里摘取 windows 的那份)

https://github.com/OsbertWang/install-latex/blob/6649e8dc10b7a5164de34a93431b3f4e0c736dcb/chapter/windows.tex#L292-L298

需要修改的

  1. tar.xz 文档,文档里现作 tar.gz

需要补充的

  1. 去哪里下载:https://ctan.org/tex-archive/systems/texlive/tlnet/archive (文件列表很长,需要时间加载)
  2. 下载哪个文件
    • 获取包名:从宏包的 CTAN 页面 ctan.org/pkg/<package name> 查看 texlive 收录它时的包名(通常就是 xxx.sty 文件里的 xxx,有特例)
    • 搜索包名:在第一步的文件列表里搜索包名
    • 搜索的是一个宏包/字体包:以 pgf 包为例,能搜到 pgf.tar.xzpgf.source.tar.xzpgf.code.tar.xz 三个文件,分别对应宏包文件(必装)、源码(如 dtx 文件,可选安装)和文档(readme、pdf 文档,可选安装)。有的包没有 xxx.source.tar.xz,例如 hlist
    • 搜索的是一个提供可执行文件的包:可能搜到很多个文件,每个对应不同的系统,例如 xetex
      • 如果本地已安装、只需要更新,执行 tlmgr info --only-installed | grep 'xetex' 的结果中就包含了带系统信息的包名
      • 如果本地没安装、需要的是安装新包,需要读懂系统名。 (可以使用上一条的命令,输出其他已安装的同类型包的信息,以此作为辅助信息)
  3. 如何安装:手册中已记录

考虑到这一部分的内容较长、是较少遇到的情况、与操作系统几乎无关(grep 可以不用,靠肉眼观察),可以把它移放到附录,免去维护四份描述的麻烦。

为什么不用图形界面安装

第6页中写道:
“打开 cmd 窗口并执行
Z:\install-tl-windows.bat --no-gui”
为什么不用图形界面呢?这样是不是会让新手望而生畏,以为很复杂

macOS安装教程中,与Homebrew有关的内容已过时

第3章安装MacTeX一节中,与Homebrew有关的内容已过时,需要重新编写。

  • Homebrew的安装命令不需要ruby,且目前官网给出的安装命令与文档中的不同。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • 更改镜像的命令是建立在用户已经从官方源成功安装Homebrew的基础上,如果用户无法安装,同样也无法修改镜像源;应增加直接从镜像源安装的教程。
  • Homebrew安装时会自动安装Xcode CLI,用户无需手动安装;并且Homebrew需要的仅仅是Xcode CLI(命令行工具),不需要安装整个XCode。
  • brew cask命令已被废弃,新的安装命令为brew install --cask mactex,升级命令为brew upgrade mactex
  • Homebrew还提供了不安装GUI组件的选项,命令为brew install --cask mactex-no-gui,适合仅从命令行编译或使用其他文本编辑器的用户。

修改建议:建议补充更新指定宏包的写法

image

对于我这种『只读过Lshort』的用户而言,显然不是高级用户,可能也想知道只更新一个宏包如何去写。因为我发现,尽管在对网络状态比较自信的情况下,更新的时间还是有点不想等。毕竟有的宏包更不更新,对我目前的使用来说影响不大。

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.