diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-16 22:02:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-16 22:02:25 +0000 |
commit | a4b88eb91823c7b7676532fdb6fc684fc55fa2d7 (patch) | |
tree | e38cab6bbbe9f5ad652a47ae6c000ee90438745f /Master | |
parent | 63986ae60a171a88aa3d89e53dfcf80486329944 (diff) |
install-latex-guide-zh-cn (16jul20)
git-svn-id: svn://tug.org/texlive/trunk@55849 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
21 files changed, 2937 insertions, 2 deletions
diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/LICENSE b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/LICENSE new file mode 100644 index 00000000000..f8b699e6eb5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/LICENSE @@ -0,0 +1,415 @@ +The LaTeX Project Public License +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +LPPL Version 1.3c 2008-05-04 + +Copyright 1999 2002-2008 LaTeX3 Project + Everyone is allowed to distribute verbatim copies of this + license document, but modification of it is not allowed. + + +PREAMBLE +======== + +The LaTeX Project Public License (LPPL) is the primary license under +which the LaTeX kernel and the base LaTeX packages are distributed. + +You may use this license for any work of which you hold the copyright +and which you wish to distribute. This license may be particularly +suitable if your work is TeX-related (such as a LaTeX package), but +it is written in such a way that you can use it even if your work is +unrelated to TeX. + +The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', +below, gives instructions, examples, and recommendations for authors +who are considering distributing their works under this license. + +This license gives conditions under which a work may be distributed +and modified, as well as conditions under which modified versions of +that work may be distributed. + +We, the LaTeX3 Project, believe that the conditions below give you +the freedom to make and distribute modified versions of your work +that conform with whatever technical specifications you wish while +maintaining the availability, integrity, and reliability of +that work. If you do not see how to achieve your goal while +meeting these conditions, then read the document `cfgguide.tex' +and `modguide.tex' in the base LaTeX distribution for suggestions. + + +DEFINITIONS +=========== + +In this license document the following terms are used: + + `Work' + Any work being distributed under this License. + + `Derived Work' + Any work that under any applicable law is derived from the Work. + + `Modification' + Any procedure that produces a Derived Work under any applicable + law -- for example, the production of a file containing an + original file associated with the Work or a significant portion of + such a file, either verbatim or with modifications and/or + translated into another language. + + `Modify' + To apply any procedure that produces a Derived Work under any + applicable law. + + `Distribution' + Making copies of the Work available from one person to another, in + whole or in part. Distribution includes (but is not limited to) + making any electronic components of the Work accessible by + file transfer protocols such as FTP or HTTP or by shared file + systems such as Sun's Network File System (NFS). + + `Compiled Work' + A version of the Work that has been processed into a form where it + is directly usable on a computer system. This processing may + include using installation facilities provided by the Work, + transformations of the Work, copying of components of the Work, or + other activities. Note that modification of any installation + facilities provided by the Work constitutes modification of the Work. + + `Current Maintainer' + A person or persons nominated as such within the Work. If there is + no such explicit nomination then it is the `Copyright Holder' under + any applicable law. + + `Base Interpreter' + A program or process that is normally needed for running or + interpreting a part or the whole of the Work. + + A Base Interpreter may depend on external components but these + are not considered part of the Base Interpreter provided that each + external component clearly identifies itself whenever it is used + interactively. Unless explicitly specified when applying the + license to the Work, the only applicable Base Interpreter is a + `LaTeX-Format' or in the case of files belonging to the + `LaTeX-format' a program implementing the `TeX language'. + + + +CONDITIONS ON DISTRIBUTION AND MODIFICATION +=========================================== + +1. Activities other than distribution and/or modification of the Work +are not covered by this license; they are outside its scope. In +particular, the act of running the Work is not restricted and no +requirements are made concerning any offers of support for the Work. + +2. You may distribute a complete, unmodified copy of the Work as you +received it. Distribution of only part of the Work is considered +modification of the Work, and no right to distribute such a Derived +Work may be assumed under the terms of this clause. + +3. You may distribute a Compiled Work that has been generated from a +complete, unmodified copy of the Work as distributed under Clause 2 +above, as long as that Compiled Work is distributed in such a way that +the recipients may install the Compiled Work on their system exactly +as it would have been installed if they generated a Compiled Work +directly from the Work. + +4. If you are the Current Maintainer of the Work, you may, without +restriction, modify the Work, thus creating a Derived Work. You may +also distribute the Derived Work without restriction, including +Compiled Works generated from the Derived Work. Derived Works +distributed in this manner by the Current Maintainer are considered to +be updated versions of the Work. + +5. If you are not the Current Maintainer of the Work, you may modify +your copy of the Work, thus creating a Derived Work based on the Work, +and compile this Derived Work, thus creating a Compiled Work based on +the Derived Work. + +6. If you are not the Current Maintainer of the Work, you may +distribute a Derived Work provided the following conditions are met +for every component of the Work unless that component clearly states +in the copyright notice that it is exempt from that condition. Only +the Current Maintainer is allowed to add such statements of exemption +to a component of the Work. + + a. If a component of this Derived Work can be a direct replacement + for a component of the Work when that component is used with the + Base Interpreter, then, wherever this component of the Work + identifies itself to the user when used interactively with that + Base Interpreter, the replacement component of this Derived Work + clearly and unambiguously identifies itself as a modified version + of this component to the user when used interactively with that + Base Interpreter. + + b. Every component of the Derived Work contains prominent notices + detailing the nature of the changes to that component, or a + prominent reference to another file that is distributed as part + of the Derived Work and that contains a complete and accurate log + of the changes. + + c. No information in the Derived Work implies that any persons, + including (but not limited to) the authors of the original version + of the Work, provide any support, including (but not limited to) + the reporting and handling of errors, to recipients of the + Derived Work unless those persons have stated explicitly that + they do provide such support for the Derived Work. + + d. You distribute at least one of the following with the Derived Work: + + 1. A complete, unmodified copy of the Work; + if your distribution of a modified component is made by + offering access to copy the modified component from a + designated place, then offering equivalent access to copy + the Work from the same or some similar place meets this + condition, even though third parties are not compelled to + copy the Work along with the modified component; + + 2. Information that is sufficient to obtain a complete, + unmodified copy of the Work. + +7. If you are not the Current Maintainer of the Work, you may +distribute a Compiled Work generated from a Derived Work, as long as +the Derived Work is distributed to all recipients of the Compiled +Work, and as long as the conditions of Clause 6, above, are met with +regard to the Derived Work. + +8. The conditions above are not intended to prohibit, and hence do not +apply to, the modification, by any method, of any component so that it +becomes identical to an updated version of that component of the Work as +it is distributed by the Current Maintainer under Clause 4, above. + +9. Distribution of the Work or any Derived Work in an alternative +format, where the Work or that Derived Work (in whole or in part) is +then produced by applying some process to that format, does not relax or +nullify any sections of this license as they pertain to the results of +applying that process. + +10. a. A Derived Work may be distributed under a different license + provided that license itself honors the conditions listed in + Clause 6 above, in regard to the Work, though it does not have + to honor the rest of the conditions in this license. + + b. If a Derived Work is distributed under a different license, that + Derived Work must provide sufficient documentation as part of + itself to allow each recipient of that Derived Work to honor the + restrictions in Clause 6 above, concerning changes from the Work. + +11. This license places no restrictions on works that are unrelated to +the Work, nor does this license place any restrictions on aggregating +such works with the Work by any means. + +12. Nothing in this license is intended to, or may be used to, prevent +complete compliance by all parties with all applicable laws. + + +NO WARRANTY +=========== + +There is no warranty for the Work. Except when otherwise stated in +writing, the Copyright Holder provides the Work `as is', without +warranty of any kind, either expressed or implied, including, but not +limited to, the implied warranties of merchantability and fitness for a +particular purpose. The entire risk as to the quality and performance +of the Work is with you. Should the Work prove defective, you assume +the cost of all necessary servicing, repair, or correction. + +In no event unless required by applicable law or agreed to in writing +will The Copyright Holder, or any author named in the components of the +Work, or any other party who may distribute and/or modify the Work as +permitted above, be liable to you for damages, including any general, +special, incidental or consequential damages arising out of any use of +the Work or out of inability to use the Work (including, but not limited +to, loss of data, data being rendered inaccurate, or losses sustained by +anyone as a result of any failure of the Work to operate with any other +programs), even if the Copyright Holder or said author or said other +party has been advised of the possibility of such damages. + + +MAINTENANCE OF THE WORK +======================= + +The Work has the status `author-maintained' if the Copyright Holder +explicitly and prominently states near the primary copyright notice in +the Work that the Work can only be maintained by the Copyright Holder +or simply that it is `author-maintained'. + +The Work has the status `maintained' if there is a Current Maintainer +who has indicated in the Work that they are willing to receive error +reports for the Work (for example, by supplying a valid e-mail +address). It is not required for the Current Maintainer to acknowledge +or act upon these error reports. + +The Work changes from status `maintained' to `unmaintained' if there +is no Current Maintainer, or the person stated to be Current +Maintainer of the work cannot be reached through the indicated means +of communication for a period of six months, and there are no other +significant signs of active maintenance. + +You can become the Current Maintainer of the Work by agreement with +any existing Current Maintainer to take over this role. + +If the Work is unmaintained, you can become the Current Maintainer of +the Work through the following steps: + + 1. Make a reasonable attempt to trace the Current Maintainer (and + the Copyright Holder, if the two differ) through the means of + an Internet or similar search. + + 2. If this search is successful, then enquire whether the Work + is still maintained. + + a. If it is being maintained, then ask the Current Maintainer + to update their communication data within one month. + + b. If the search is unsuccessful or no action to resume active + maintenance is taken by the Current Maintainer, then announce + within the pertinent community your intention to take over + maintenance. (If the Work is a LaTeX work, this could be + done, for example, by posting to comp.text.tex.) + + 3a. If the Current Maintainer is reachable and agrees to pass + maintenance of the Work to you, then this takes effect + immediately upon announcement. + + b. If the Current Maintainer is not reachable and the Copyright + Holder agrees that maintenance of the Work be passed to you, + then this takes effect immediately upon announcement. + + 4. If you make an `intention announcement' as described in 2b. above + and after three months your intention is challenged neither by + the Current Maintainer nor by the Copyright Holder nor by other + people, then you may arrange for the Work to be changed so as + to name you as the (new) Current Maintainer. + + 5. If the previously unreachable Current Maintainer becomes + reachable once more within three months of a change completed + under the terms of 3b) or 4), then that Current Maintainer must + become or remain the Current Maintainer upon request provided + they then update their communication data within one month. + +A change in the Current Maintainer does not, of itself, alter the fact +that the Work is distributed under the LPPL license. + +If you become the Current Maintainer of the Work, you should +immediately provide, within the Work, a prominent and unambiguous +statement of your status as Current Maintainer. You should also +announce your new status to the same pertinent community as +in 2b) above. + + +WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE +====================================================== + +This section contains important instructions, examples, and +recommendations for authors who are considering distributing their +works under this license. These authors are addressed as `you' in +this section. + +Choosing This License or Another License +---------------------------------------- + +If for any part of your work you want or need to use *distribution* +conditions that differ significantly from those in this license, then +do not refer to this license anywhere in your work but, instead, +distribute your work under a different license. You may use the text +of this license as a model for your own license, but your license +should not refer to the LPPL or otherwise give the impression that +your work is distributed under the LPPL. + +The document `modguide.tex' in the base LaTeX distribution explains +the motivation behind the conditions of this license. It explains, +for example, why distributing LaTeX under the GNU General Public +License (GPL) was considered inappropriate. Even if your work is +unrelated to LaTeX, the discussion in `modguide.tex' may still be +relevant, and authors intending to distribute their works under any +license are encouraged to read it. + +A Recommendation on Modification Without Distribution +----------------------------------------------------- + +It is wise never to modify a component of the Work, even for your own +personal use, without also meeting the above conditions for +distributing the modified component. While you might intend that such +modifications will never be distributed, often this will happen by +accident -- you may forget that you have modified that component; or +it may not occur to you when allowing others to access the modified +version that you are thus distributing it and violating the conditions +of this license in ways that could have legal implications and, worse, +cause problems for the community. It is therefore usually in your +best interest to keep your copy of the Work identical with the public +one. Many works provide ways to control the behavior of that work +without altering any of its licensed components. + +How to Use This License +----------------------- + +To use this license, place in each of the components of your work both +an explicit copyright notice including your name and the year the work +was authored and/or last substantially modified. Include also a +statement that the distribution and/or modification of that +component is constrained by the conditions in this license. + +Here is an example of such a notice and statement: + + %% pig.dtx + %% Copyright 2005 M. Y. Name + % + % This work may be distributed and/or modified under the + % conditions of the LaTeX Project Public License, either version 1.3 + % of this license or (at your option) any later version. + % The latest version of this license is in + % http://www.latex-project.org/lppl.txt + % and version 1.3 or later is part of all distributions of LaTeX + % version 2005/12/01 or later. + % + % This work has the LPPL maintenance status `maintained'. + % + % The Current Maintainer of this work is M. Y. Name. + % + % This work consists of the files pig.dtx and pig.ins + % and the derived file pig.sty. + +Given such a notice and statement in a file, the conditions +given in this license document would apply, with the `Work' referring +to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being +generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' +referring to any `LaTeX-Format', and both `Copyright Holder' and +`Current Maintainer' referring to the person `M. Y. Name'. + +If you do not want the Maintenance section of LPPL to apply to your +Work, change `maintained' above into `author-maintained'. +However, we recommend that you use `maintained', as the Maintenance +section was added in order to ensure that your Work remains useful to +the community even when you can no longer maintain and support it +yourself. + +Derived Works That Are Not Replacements +--------------------------------------- + +Several clauses of the LPPL specify means to provide reliability and +stability for the user community. They therefore concern themselves +with the case that a Derived Work is intended to be used as a +(compatible or incompatible) replacement of the original Work. If +this is not the case (e.g., if a few lines of code are reused for a +completely different task), then clauses 6b and 6d shall not apply. + + +Important Recommendations +------------------------- + + Defining What Constitutes the Work + + The LPPL requires that distributions of the Work contain all the + files of the Work. It is therefore important that you provide a + way for the licensee to determine which files constitute the Work. + This could, for example, be achieved by explicitly listing all the + files of the Work near the copyright notice of each file or by + using a line such as: + + % This work consists of all files listed in manifest.txt. + + in that place. In the absence of an unequivocal list it might be + impossible for the licensee to determine what is considered by you + to comprise the Work and, in such a case, the licensee would be + entitled to make reasonable conjectures as to which files comprise + the Work. diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/README.md b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/README.md new file mode 100644 index 00000000000..05e5d2a0f77 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/README.md @@ -0,0 +1,43 @@ +# 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 10, Ubuntu 20.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 [Overleaf](www.overleaf.com). + +Users are advised to read [texlive-zh-cn](https://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf) and [lshort-zh-cn](http://mirrors.ctan.org/info/lshort/chinese/lshort-zh-cn.pdf) 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-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](https://github.com/OsbertWang/install-latex-zh-cn/releases/latest). + +# License + +This work is released under the LaTeX Project Public License, v1.3c or later. + +# 一份简短的关于 LaTeX 安装的介绍 + +本文将介绍 Windows 10、Ubuntu 20.04 和 macOS 系统中安装 TeX Live (macOS 中介绍 MacTeX)、升级宏包、编译简易文档的相关操作, 并多以介绍命令行操作为主. +同时简要介绍不同操作系统下几款常见编辑器的使用方法, 并额外补充了一些使用 [Overleaf](www.overleaf.com) 的相关内容. + +建议用户阅读 [texlive-zh-cn](https://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf) 和 [lshort-zh-cn](http://mirrors.ctan.org/info/lshort/chinese/lshort-zh-cn.pdf) 以更全面地了解基础内容. + +本文所涉及到的代码还请用户多多动手, 不要简单地复制粘贴. + +若需要编译源文件, 请确保安装 fandol 字体, 并使用 `xelatex` 命令. +推荐 TeX Live 用户使用如下命令 +``` +latexmk -xelatex -synctex=1 install-latex-zh-cn +``` +无法使用 `latexmk` 的用户可以根据自己的操作系统执行 `make.bat` 或 `make`. + +若需要本项目编译完成的 PDF 文件, 可至 [Releases](https://github.com/OsbertWang/install-latex-zh-cn/releases/latest) 处下载. + +# 开源协议 + +本次工作将遵循协议 LaTeX Project Public License,v1.3c 或其后版本. diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/mirror.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/mirror.tex new file mode 100644 index 00000000000..1e4cb14ed85 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/mirror.tex @@ -0,0 +1,81 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{大陆地区的源}\label{chp:appendix:mirror} + +由于各种不知名的原因, +下载 \TeX{} Live 的 iso 文件或升级宏包时, +系统自动选择的源并没有满足用户关于``附近''的要求. +因此, +很多时候, +用户需要手动选择 CTAN 的源. +目前已搜集到的大陆地区的源见表~\ref{tab:appendix:mirror}. +接下来简述使用大陆地区的源下载 iso 文件和升级宏包. + +\begin{table} + \centering + \caption{大陆地区的源}\label{tab:appendix:mirror} + \begin{tabular}{*{2}{l}} + \hline\hline + 清华大学 & \url{https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/}\\ + 北京理工大学 & \url{https://mirrors.bit.edu.cn/CTAN/systems/texlive/}\\ + 北京交通大学 & \url{https://mirror.bjtu.edu.cn/ctan/systems/texlive/}\\ + % 上海科技大学 & \url{https://mirrors-wan.geekpie.club/CTAN/systems/texlive/}\\ + 上海交通大学 & \url{https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/}\\ + 中国科学技术大学 & \url{https://mirrors.ustc.edu.cn/CTAN/systems/texlive/}\\ + % 浙江大学 & \url{https://mirrors.zju.edu.cn/CTAN/systems/texlive/}\\ + 南京大学 & \url{https://mirrors.nju.edu.cn/CTAN/systems/texlive/}\\ + 华中科技大学 & \url{http://mirrors.hust.edu.cn/CTAN/systems/texlive/}\\ + 重庆大学 & \url{https://mirrors.cqu.edu.cn/CTAN/systems/texlive/}\\ + % 东北大学 & \url{https://mirror.neu.edu.cn/CTAN/systems/texlive/}\\ + 兰州大学 & \url{https://mirror.lzu.edu.cn/CTAN/systems/texlive/}\\ + 腾讯云 & \url{https://mirrors.cloud.tencent.com/CTAN/systems/texlive/}\\ + 华为云 & \url{https://mirrors.huaweicloud.com/CTAN/systems/texlive/}\\ + 阿里云 & \url{https://mirrors.aliyun.com/CTAN/systems/texlive/}\\ + \hline\hline + \end{tabular} +\end{table} + +使用最近的 CTAN 源下载 iso 文件, +实际上是下载 +\begin{lstlisting} + https://mirrors.ctan.org/systems/texlive/Images/texlive2020.iso +\end{lstlisting} +使用大陆的源下载它, +只需将以上网址中的 +\begin{lstlisting} + https://mirrors.ctan.org/systems/texlive/ +\end{lstlisting} +替换为相应的源的地址, +而将 +\begin{lstlisting} + Images/texlive2020.iso +\end{lstlisting} +予以保留. +以清华大学为例, +从清华大学源中下载 iso 镜像文件, +实际上是下载 +\begin{lstlisting} + https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2020.iso +\end{lstlisting} + +同理, +升级宏包也只需要将对应的网址替换为源地址即可. +前面正文中所设置的 +\begin{lstlisting} + tlmgr option repository ctan +\end{lstlisting} +等价于 +\begin{lstlisting} + tlmgr option repository http://mirror.ctan.org/systems/texlive/tlnet +\end{lstlisting} +使用大陆的源升级宏包, +只需将 +\begin{lstlisting} + http://mirror.ctan.org/systems/texlive/ +\end{lstlisting} +替换为大陆源的地址而保留其他部分即可. +依旧以清华大学为例, +那么设置将变为 +\begin{lstlisting} + tlmgr option repository https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet +\end{lstlisting}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/offline.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/offline.tex new file mode 100644 index 00000000000..3aa0ec1027c --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/offline.tex @@ -0,0 +1,52 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{离线安装宏包} + +由于一些原因, +有些电脑不能联网, +这对升级宏包不利. +这里介绍离线升级标准 \TeX{} Live 的包 (pkg) 的方法, +主要是用 \texttt{tlmgr install} 的 \texttt{--file} 参数来实现. + +首先在能够联网的电脑上访问 +\href{https://ctan.org/tex-archive/systems/texlive/tlnet/archive}{archive} +页面, 下载 \texttt{<archivename>.tar.xz} 文件. +文件列表很长, 加载需花费些时间. +注意 \texttt{<archivename>} 未必是 \href{https://ctan.org/pkg/}{pkg} 上的 \texttt{<pkgname>}, +例如在 \texttt{pkg} 上的 +\href{https://ctan.org/pkg/lshort-zh-cn}{lshort-zh-cn} +对应着 \texttt{archive} 上的 +\href{http://mirrors.ctan.org/systems/texlive/tlnet/archive/lshort-chinese.tar.xz}{lshort-chinese.tar.xz} +和 +\href{http://mirrors.ctan.org/systems/texlive/tlnet/archive/lshort-chinese.doc.tar.xz}{lshort-chinese.doc.tar.xz}. + +这里多解释一点 \texttt{<archivename>}. +前面已经看到一个 \texttt{<pkgname>} 可能会对应多个 \texttt{<archivename>}, +但基本上 \texttt{<archivename>} 的命名规则是 \texttt{<xxx>}, +\texttt{<xxx.source>} 和 \texttt{<xxx.doc>}. +\texttt{<xxx>} 是必装的宏包文件; +\texttt{<xxx.source>} 是选择安装的源码, 如 \texttt{dtx} 文件; +\texttt{<xxx.doc>} 是选择安装的文档, 如 \texttt{pdf} 文件等. +这三者未必同时存在, 例如前面提到的 \texttt{lshort-chinese}. + +另外, 如果需要安装的是一个可执行文件, 例如 \texttt{pdftex} 或 \texttt{xetex}, +那么会涉及到根据操作系统进行下载的相关判断. +如果要升级本地已安装的可执行文件, 可以在命令行输入以下语句查询: +\begin{lstlisting}[language=bash, title={\small\sffamily Windows 系统}] + tlmgr info --only-installed | findstr "pdftex" +\end{lstlisting} +\begin{lstlisting}[language=bash, title={\small\sffamily Ubuntu 和 Mac 系统}] + tlmgr info --only-installed | grep 'pdftex' +\end{lstlisting} +在输出结果中可看到带系统信息的名称. +如果是升级本地未安装的可执行文件, +那么用户就需要根据经验自行判断. + +下载正确的 \texttt{<archivename>.tar.xz} 后, +可先检查一下该压缩文件中是否包含了 \texttt{tlpobj} 文件. +之后将压缩文件拷贝到未联网电脑上, +在命令行执行 +\begin{lstlisting} + tlmgr install --file <archivename>.tar.gz +\end{lstlisting} +系统便可自行安装.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/updateinfo.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/updateinfo.tex new file mode 100644 index 00000000000..50efd37c11b --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/updateinfo.tex @@ -0,0 +1,91 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{版本信息} + +\section*{v2020.8.1} + +\begin{enumerate} + \item 增加验证 sha512 的内容 + \item 将本文提交至 CTAN 而进行必要更改 +\end{enumerate} + +\section*{v2020.7.1} + +\begin{enumerate} + \item \TeX works 拼写检查调整 + \item VS Code 是开源软件 + \item 改摘要为前言并增加内容 + \item 增加调出宏包手册内容 +\end{enumerate} + +\section*{v2020.6.1} + +\begin{enumerate} + \item 重述大陆地区的源的相关内容 + \item 为适应 Ubuntu 20.04 调整某些内容 + \item 调整有关管理员权限的内容 + \item 调整有关编辑器的内容 + \item 借助网站加速下载 TeXstudio + \item 提示卸载时的权限 + \item 给出 make.bat 与 makefile + \item 增加 MD5 的说明 + \item 更正设置主文档的错误 +\end{enumerate} + +\section*{v2020.5.1} + +\begin{enumerate} + \item 更新 MiK\TeX{} 相关网址 + \item 更新 至 \TeX{} Live 2020 + \item 更新 Windows 10 手动卸载 \TeX{} Live 的内容 + \item 调整 \TeX studio 图标大小 + \item 更新镜像网址 + \item 更改 openoffice 网址 + \item 更新 Windows 10 升级宏包描述 + \item 更新 Overleaf 的介绍 +\end{enumerate} + +\section*{v2020.4.1} + +\begin{enumerate} + \item 简要介绍 WSL 辅助程序 + \item 添加 Overleaf 学习与帮助 + \item 添加两处与 WSL 有关的内容 + \item 增加几处软件菜单栏的讲解 + \item 更清晰查看 Windows 10 环境变量的代码 + \item Windows 10 直接以管理员身份打开命令行安装 + \item 调整标点 +\end{enumerate} + +\section*{v2020.3.1} + +\begin{enumerate} + \item 摘要中明确提到 C\TeX{} 套装和发行版、编辑器 + \item 更改 Windows 10 安装 \TeX{} Live 的描述, 如路径名, 文件扩展名等 + \item 将文件名要求写入注释 + \item 添加 \TeX studio 数学符号表和插入、改写调整 + \item 解决 \LaTeXe 版本不匹配导致 \texttt{xelatex} 失败的问题 + \item 添加打开 \textsf{cmd} 的方法 + \item 改写 \TeX studio 显示行号的设置 + \item 更新 MiK\TeX{} 相关网址 + \item 添加调整 \TeX works 字体的内容 + \item 添加 Windows 中手动卸载 \TeX{} Live 的方法 + \item 添加 Overleaf 中文网址 +\end{enumerate} + +\section*{v2020.2.1} + +\begin{enumerate} + \item 添加版本信息列表 + \item 改变 Windows 10 的 \TeX studio 的下载网址 + \item 添加 macOS 中 \texttt{xelatex} 用字体名调用字体的方法 + \item 详述 WSL 中不懂 vim 的处理方法和阅读宏包手册的方法 + \item 强调路径为不带空格的英文 + \item 订正若干拼写错误 + \item 给出 \texttt{jdk} 环境变量的处理 + \item 添加北京交通大学镜像 + \item 注明安装需卸载国产安全软件 + \item 更正 \TeX works 自动补全的教程网址 + \item 给出更换 2345 好压的建议 + \item 补充 Overleaf 升级内容 +\end{enumerate}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/wsladdition.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/wsladdition.tex new file mode 100644 index 00000000000..348dd85978d --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/appendix/wsladdition.tex @@ -0,0 +1,120 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{有关 WSL 的一点补充内容}\label{chp:appendix:wsl} + +有用户指出, +WSL (本质上是 Ubuntu) 中安装字体比较麻烦. +这里引用 +\href{https://www.jianshu.com/p/e7f12b8c8602}{Ubuntu系统字体命令和字体的安装} +一文. +大致步骤如下. + +首先获取需要安装的字体文件, +假设文件保存在 \verb|~/fonts/|. +然后在 \texttt{/usr/share/fonts/} 文件夹中创建新的文件夹, +例如 \texttt{myfonts} +\begin{lstlisting}[language=bash] + cd /usr/share/fonts/ + sudo mkdir myfonts +\end{lstlisting} +接下来将获取的字体文件复制到 \texttt{myfonts} 中 +\begin{lstlisting}[language=bash] + sudo cp ~/fonts/* /usr/share/fonts/myfonts/ +\end{lstlisting} +然后修改字体文件的权限 +\begin{lstlisting}[language=bash] + sudo chmod -R 755 myfonts +\end{lstlisting} +最后建立字体缓存 +\begin{lstlisting}[language=bash] + mkfontscale + mkfontdir + fc-cache -fv +\end{lstlisting} + +实际上有部分字体可直接使用源进行安装, +如安装 \texttt{Noto CJK} +\begin{lstlisting}[language=bash] + sudo apt-get install fonts-noto-cjk + sudo apt-get install fonts-noto-cjk-extra +\end{lstlisting} + +在目前的版本中, 本文在 WSL 中进行编译. +目前感受是该方法较之 Windows 10 系统中的编译更快. +其他方面并未进行比较. +由于 \TeX studio 在 WSL 中无法正常正反搜索, +因此我使用了 VS Code 配合 +\href{https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl}{Remote WSL} +和 +\href{https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop}{\LaTeX{} Workshop} +来编写文档. +这里将个人使用的相关配置附上, +其中注释的部分是调用外部 SumatraPDF 阅读器的配置, +用户可参考 +\href{https://github.com/OsbertWang/latex-editor-sumatrapdf}{latex-editor-sumatrapdf} +来了解更多内容. + +\begin{lstlisting} + "latex-workshop.latex.tools": [ + { + "name": "latexmkpdf", + "command": "latexmk", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-halt-on-error", + "-file-line-error", + "-pdf", + "%DOCFILE%" + ] + }, + { + "name": "latexmkxe", + "command": "latexmk", + "args": [ + "-synctex=1", + "-interaction=nonstopmode", + "-halt-on-error", + "-file-line-error", + "-pdfxe", + "%DOCFILE%" + ] + }, + ], + "latex-workshop.latex.recipes": [ + { + "name": "latexmkpdf", + "tools": [ + "latexmkpdf" + ] + }, + { + "name": "latexmkxe", + "tools": [ + "latexmkxe" + ] + }, + ], + "latex-workshop.latex.autoBuild.run": "never", + "latex-workshop.view.pdf.viewer": "tab" + // "latex-workshop.view.pdf.viewer": "external", + // "latex-workshop.view.pdf.ref.viewer": "external", + // "latex-workshop.view.pdf.external.viewer.command": "<SumatraPDFROOT>/SumatraPDF.exe", + // "latex-workshop.view.pdf.external.viewer.args": [ + // "-inverse-search", + // "\"<VSCodeROOT>/bin/code.cmd\" -r -g \"%f:%l\"", + // "%PDF%" + // ], + // "latex-workshop.view.pdf.external.synctex.command":"<SumatraPDFROOT>/SumatraPDF.exe", + // "latex-workshop.view.pdf.external.synctex.args":[ + // "-forward-search", + // "%TEX%", + // "%LINE%", + // "%PDF%", + // ], +\end{lstlisting} + +实际配置时, +用户需要结合自身安装情况更换 \texttt{<SumatraPDFROOT>} 和 \texttt{<VSCodeROOT>}, +即 SumatraPDF 和 VS Code 各自的安装路径. +希望阅读本文的用户能够尽快上手使用 \LaTeX. diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/editor.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/editor.tex new file mode 100644 index 00000000000..a44e8620565 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/editor.tex @@ -0,0 +1,514 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{使用编辑器} + +\section{Windows 10 系统} + +在实际操作中, 用户会发觉使用记事本编写 \texttt{tex} 文件十分不便, +因此很多用户都将其他编辑器作为自己的首选. +这里向大家介绍随 \TeX{} Live 一同发行的轻量级编辑器 \TeX works +和功能更加丰富的 +\href{http://texstudio.sourceforge.net/}{\TeX studio} +(github 上有% +\href{https://github.com/texstudio-org/texstudio}{源码}% +和% +\href{https://github.com/texstudio-org/texstudio/releases}{可执行文件}). +其他编辑器无法一一介绍, 还请自己在网上寻求更多帮助. + +\subsection{\TeX works} + +\TeX works 是一款轻量级的 \LaTeX 编辑器, 个人认为非常适合入门级用户使用% +\footnote{很多用户在编写 \texttt{tex} 文件时喜欢借助其他工具, +这不是个好习惯, 这里鼓励用户多手动敲代码}. + +和大多数国产软件不同, \TeX works 不会自动在桌面生成快捷方式, +新人往往不知道如何打开它. +实际上 \TeX works 在 \TeX{} Live 安装路径的 +\texttt{\textbackslash bin\textbackslash win32} 中, +可在 \textsf{cmd} 中执行 \texttt{texworks} 打开, +也可直接在 Windows 搜索栏里搜 \TeX works 打开. + +刚开始使用 \TeX works 的用户不必过多配置, +在默认状态下打开软件、编写代码、保存文件后, +用户可使用 \TeX works 的“排版”按钮进行文档编译而不必回到命令行% +\footnote{实际上编辑器的按钮也是调用命令行来编译文档, +\TeX works 默认排版快捷键是 \texttt{ctrl + T}}. +按钮旁边是编译命令菜单, 用户可根据需要自行选择. + +下面介绍几个常用的功能. + +\subsubsection{显示行号} + +打开 \menu{编辑 > 首选项 > 编辑器}, 选择 \menu{行号} 即可. + +\subsubsection{调整字体} + +\TeX works 有时会擅自更改编辑器所使用的字体, +很多字体``长相''诡异, +让用户误以为是乱码. +用户可在 \menu{编辑 > 首选项 > 编辑器默认配置} +和 \menu{格式 > 字体} 处进行更改. +Windows 10 中字体列表见% +\href{https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list}{这里}. + +\subsubsection{自动补全} + +自动补全主要是 \keys{tab} 键的功能, +使用前需确定 \menu{首选项 > 编辑器} 中是否勾选了 \menu{启动自动补全}. +有关自动补全的更多内容用户可参考 +\href{https://github.com/EthanDeng/texworks-autocomplete}{\TeX works 的自动补全功能}. + +\subsubsection{使用模板} + +\TeX works支持从模板新建文档, 在 \menu{文件} 菜单中可见. + +\subsubsection{拼写检查} + +默认情况, \TeX works没有搭载拼写检查字典, 需要用户自己配置. +首先, 访问 +\href{https://extensions.openoffice.org/dictionary}{openoffice} +下载 \texttt{.oxt} 文件. +将 \texttt{.oxt} 文件重命名为 \texttt{.zip} 文件, +解压缩得到里面的 \texttt{.dic} 和 \texttt{.aff} 文件. +接下来将它们安装到 +\texttt{<resources>\textbackslash dictionaries}% +\footnote{\texttt{<resources>} 的具体位置可以在 +\menu{帮助 > TeXworks 配置与资源} 中找到}. +安装完成后, 在 \menu{编辑 > 拼写} 中选择即可. + +\subsubsection{魔法注释} + +魔法注释可以直接规定主文档、文件编码和编译命令等. +例如用户写学位论文时, 往往有一个主文档和若干子文档. +在子文档的开头写上魔法注释 +\begin{lstlisting} + % !TeX root = ../main.tex +\end{lstlisting} +即可告诉系统上一级目录中的 \texttt{main.tex} 是主文档% +\footnote{主文档和子文档的更多内容请参考 \texttt{\textbackslash include} +和 \texttt{\textbackslash input} 的用法}. +\begin{lstlisting} + % !TeX encoding = UTF8 +\end{lstlisting} +表示该文档使用 ``UTF-8'' 编码% +\footnote{目前建议用户多用 ``UTF-8'' 编码, 尤其是中文文档}. +\begin{lstlisting} + % !TeX program = xelatex +\end{lstlisting} +表示该文档使用 \texttt{xelatex} 编译命令进行编译. +\begin{lstlisting} + % !TeX spellcheck = <language_code> +\end{lstlisting} +表示该文档使用 \texttt{<language\_code>} 进行拼写检查, +它的具体名称请用户到 \menu{编辑 > 拼写} 中查看. + +\subsubsection{转编码} + +实际上转编码是很多编辑器都具备的功能. +在\TeX works右下角有三个按钮, +左边按钮控制换行符类型, 中间按钮控制文档编码, 右边按钮控制行跳转. +目前大部分中文用户主要面临的是``UTF-8''和``GBK''之间的转换. +如果文档是``GBK''编码, 使用\TeX works打开文件后, 文档会出现乱码. +这时, 点中间按钮, 选择编码类型``GBK'', 再点击按钮, +选择 \menu{使用所选编码重载文档}, 若文档中乱码消失, 则再次点击按钮, +选择``UTF-8'', 最后保存文档, 完成转码工作. + +除以上内容外, \TeX works 还支持正则表达式、自定义快捷键等. +这些内容都写在 \TeX works 自带的手册中. +手册不长, 用户可以通读一遍以了解更多内容. +很多功能可以通过\textbf{菜单栏}找到, +因此建议用户稍微了解一下它的菜单栏. + +\subsection{\TeX studio} + +相较于 \TeX works, \TeX studio 功能更丰富, 用法更多. +在使用 \TeX studio 前, +用户一定要查询 \texttt{system32} 是否在\textbf{环境变量}中. +具体方法在前面已有说明, 此处不再赘述. +以下有关 \TeX studio 的用法介绍, +还请用户提前在 \menu{Options > configure TeXstudio} 中勾选 +\menu{Show Advanced Options}. +由于网络原因, +\TeX studio 下载有些困难. +大家可以借助于 +\url{https://d.serctl.com} +加速下载, +网站提供了下载教程, +这里不再展开. + +\subsubsection{更改默认编译命令} + +在 \menu{Options > configure TeXstudio > build > default compiler} +中选择默认编译命令. + +另外用 \texttt{latexmk} 和 \texttt{biblatex} 做编译时, +需要在 \menu{Options > Configure TeXstudio > build > Build Options} +中取消 \menu{Check and update bibliography before compiling}. + +\subsubsection{显示行号} + +在 \menu{Editor > Show Line Numbers} 选择行号如何显示. + +\subsubsection{数学符号表} + +在 \TeX studio 左下角有两个按钮: +\menu{Side Panel} 和 \menu{Messages / Log file}. +打开 \menu{Side Panel}, +点击软件左侧边栏第 3 个图标 \menu{Symbols}. + + +\subsubsection{插入、改写调整} + +与很多其他编辑器一样, +\TeX studio 也可以通过键盘 \keys{insert} +改变插入、改写状态. +分别处于插入、改写状态时, +编辑器光标会呈现不同的样子. + +\subsubsection{调整缩进} + +在 \menu{Options > Configure TeXstudio > Editor > Indentation Mode} +处可以选择是否保持缩进. +如果需要让缩进完全变为空格, +勾选 \menu{Replace Indentation Tab by Spaces}. + +在 \menu{Adv. Editor > Appearance} 中可以更改 \menu{Tab Widths}. + +\subsubsection{块选择模式} + +同时按 \keys{Ctrl + Alt} 便可通过鼠标左键进行块选择. + +\subsubsection{调整图标大小} + +有些用户屏幕分辨率高, +因此软件上图标会显得很小. +在 \menu{Options > Configure TeXstudio > Gui Scaling} 处可以调整三处的显示比例. + +\subsubsection{自动补全和未识别代码} + +\TeX studio 自动补全功能会先通过用户引用的宏包来判断代码是否需要自动补全, +同时它也可以以此判定用户输入的命令是否正确. +若系统判断命令无法识别, +则该命令会出现红色背景. + +\TeX studio 能够识别的命令全部被写入了 +\href{https://github.com/texstudio-org/texstudio/tree/master/completion}{cwl 文件} +中. +用户可以根据自己的需要更改 cwl 文件, +然后将其放入 +\texttt{<settings directory>\textbackslash completion\textbackslash user} +文件夹% +\footnote{点击 \menu{Help > Check LaTeX Installation}, +在生成的 \texttt{System Report.txt} 中找到 \texttt{texstudio.ini} 文件, +其所在文件夹即为 \texttt{<settings directory>}}. + +自动补全后有可能生成文本框, +使用 \keys{\ctrl + \arrowkey{>}} 可以跳转至下一个文本框, +\keys{\ctrl + \arrowkey{<}} 则可以跳转至上一个. + +\subsubsection{拼写检查} + +在 +\menu{Options > Configure TeXstudio > Language Checking > Default Language} +处选择 \texttt{en\_US} 即可默认进行英文拼写检查. + +\subsubsection{魔法注释} + +除了像 \TeX works 中使用魔法注释外, \TeX studio 还有很多其他的魔法注释, 例如 +\begin{lstlisting} + % !TeX TXS-program:compile = txs:///latexmk/{}[-xelatex -synctex=1 -interaction=nonstopmode ?me"] +\end{lstlisting} +表示使用 \texttt{latexmk} 编译命令, +\texttt{\{\}} 表示无视编辑器赋予该命令的一切参数, +而 \texttt{[]} 表示添加其中的参数进行编译, +本例中添加 \texttt{-xelatex -synctex=1 -interaction=nonstopmode} 作为参数. +如果用户不清楚魔法注释都可以写哪些类型, +可以点击 \menu{LaTeX > Add magic comments} 查看五种魔法注释类型. +更多内容需要阅读软件手册. + +\subsubsection{渲染方式} + +默认的渲染方式对中文括号的支持不够好. +用户可以在 \menu{Options > Configure TeXstudio > Adv. Editor > Hacks/Workarounds} 中取消 +\menu{Try to automatically choose best display options}, +选择 \menu{Disable cache of character width} 和 \menu{Disable fixed pitch mdoe}. +这样能够比较好地渲染中文括号. + +\subsubsection{转编码} + +\TeX studio 右下角有一处显示文档编码 (Encoding). +依旧以``UTF-8''和``GBK''之间的转换为例. +如果文档是``GBK''编码, 使用 \TeX studio 打开文件后, +点击 \menu{Encoding} 处, 选择 \menu{More Encodings}. +打开窗口后, 选择``GBK / ...'', 点击 \menu{Reload With}. +若这时文档没有乱码, 再点击 \menu{Encoding > More Encodings}, +选择``UTF-8'', 点击 \menu{Change To}, 保存文件, 完成转码. +在 \menu{Edit > Setup Encoding ...} 处同样可以打开编码窗口. + +\subsubsection{自定义命令并生成按钮} + +\TeX studio 允许用户自定义命令, 并将命令做成按钮放置于面板上. +如在 \menu{Options > Configure TeXstudio > Build > User commands} 中, +填写名称 \texttt{User1:Build-xe-view} +和对应的功能 +\begin{lstlisting} + latexmk -pdfxe -silent -synctex=1 -interaction=nonstopmode ?me" | txs:///view-pdf-internal --embedded +\end{lstlisting} +点击 \menu{OK}. +接下来我们在 \menu{Tools > User} 中即可看到自定义的命令和相应快捷键. + +接下来设置按钮. +打开 \menu{Options > Configure TeXstudio > Toolbars}, +在两个下拉菜单中分别选择 \menu{Tools} 和 \menu{All menus}, +在右边找到 \menu{Tools > User > Build-xe-view} 并将其添加至左端, +点击 \menu{OK}. +这时, 在面板中将添加新的按钮. + +\subsubsection{生成宏指令} + +\TeX studio 允许用户生成宏指令. +在 \menu{Macros > Edit Macros} 中, 用户可以根据自己的需要, +给出宏指令的名称、快捷键、内容等等. +例如我们将 \texttt{latexmk-pdf} 填写在 \menu{name} 中, +将 +\begin{lstlisting} + % !TeX TXS-program:compile = txs:///latexmk/{}[-pdf -synctex=1 -interaction=nonstopmode ?me"] +\end{lstlisting} +填写在 \menu{LaTeX Content} 中, +再将 \texttt{Shift+F1} 填写在 \menu{Shortcut}. +设置完毕后, 点击 \menu{OK}. +这时, 我们可以看到 \menu{Macros > latexmk-pdf} 出现. +在文档特定位置点击它或者直接使用 \keys{\shift + F1}, 即可看到魔法注释出现. + +\subsubsection{更改颜色方案} + +有一些用户喜欢深色的颜色方案. +手动修改颜色不方便的话, 我们可以从网上找到一些现成的颜色方案, +例如 +\href{https://tex.stackexchange.com/questions/108315/how-can-i-set-a-dark-theme-in-texstudio}{stackexchange 网站}% +和% +\href{https://robjhyndman.com/hyndsight/dark-themes-for-writing/}{某些用户的博客}. +更改方案只需要打开 \texttt{ini} 文件, +将这些颜色方案复制到 \texttt{[formats]} 部分. +在 \menu{Help > Check LaTeX Installation} +中有 \texttt{ini} 文件的具体位置. + +\subsubsection{调用外部 PDF 阅读器} + +\TeX studio 已经内嵌了 PDF 阅读器供用户预览编译结果, +但一些用户喜欢使用外部 PDF 阅读器. +这里以 \href{https://www.sumatrapdfreader.org/free-pdf-reader.html}{SumatraPDF} 为例, +用户直接安装或下载便携版均可, +假定它在本地的位置为 \texttt{<SumatraPDFROOT>}, +而 \TeX studio 在本地的位置是 \texttt{<TeXstudioROOT>}. +打开 \menu{Options > Configure TeXstudio} 窗口, +在 \menu{Build > User commands} 中添加 +\begin{lstlisting} + "<SumatraPDFROOT>\SumatraPDF.exe" -reuse-instance -forward-search ?c:rme" @ -inverse-search "<TeXstudioROOT>\texstudio.exe %%f -line %%l" "?m.pdf" +\end{lstlisting} +将其命名为 \texttt{user0:sumatrapdf}. +接下来, 在 \menu{Build > Build \& View} 中将 +\texttt{txs:///compile | txs:///view} 改为 +\texttt{txs:///compile | txs:///user0}. +最后, 在 \menu{Menus} 中将 \texttt{\&View} 的命令由 +\texttt{txs:///view} 改为 \texttt{txs:///user0}. +完成以上设置后, +关闭窗口. +这时, +用户使用快捷键 \keys{F5} 和 \keys{F7} 均可打开 SumatraPDF 并且实现了正向搜索. +如果有人喜欢在编译时添加参数 \texttt{--outdir=temp}, +那么可以将 \texttt{user0:sumatrapdf} 改为 +\begin{lstlisting} + "<SumatraPDFROOT>\SumatraPDF.exe" -reuse-instance -forward-search ?c:rme" @ -inverse-search "<TeXstudioROOT>\texstudio.exe %%f -line %%l" "?r)temp\?m.pdf" +\end{lstlisting} + +如果以上设置没能正确实现正反向搜索, +那么可以将 \texttt{user0:sumatrapdf} 改为 +\begin{lstlisting} + dde:///"<SumatraPDFROOT>\SumatraPDF.exe":SUMATRA/control/[ForwardSearch("?m.pdf",?c:rme",@,0,0,1)] +\end{lstlisting} +其他不变. +而后用 SumatraPDF 打开生成的 PDF 文件, +在 \menu{Settings > Options > Set inverse search command line} 中输入 +\begin{lstlisting} + "<TeXstudioROOT>\texstudio.exe" "%f" -line %l +\end{lstlisting} +至此完成了逆向搜索, +双击 PDF 文件便可回到 \TeX studio 中对应代码的行首. + +\section{Ubuntu 20.04 系统} + +简化起见, 这里只介绍如何使用 \TeX studio. +根据官网推荐, 我们安装源内的 \TeX studio. +安装前可参照 \ref{subsec:ubuntu:xelatexfail}~节的介绍换源以增速. + +在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language = bash] + sudo apt install texstudio +\end{lstlisting} +即可安装 \TeX studio. +注意安装过程中会产生一些依赖, 它们包括了源内的 \TeX{} live 包, 如 \texttt{tex-common}, \texttt{texlive-base}, \texttt{texlive-binaries}, \texttt{texlive-latex-base} 和 \texttt{texlive-latex-recommended}. +用户需要卸载它们. + +当然用户也可以使用 +\href{https://code.launchpad.net/~sunderme/+archive/ubuntu/texstudio}{PPA} +来安装 \TeX studio. +以此在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language = bash] + sudo add-apt-repository ppa:sunderme/texstudio + sudo apt-get update + sudo apt-get install texstudio +\end{lstlisting} + +安装完毕后, +用户可以在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language = bash] + texstudio main.tex +\end{lstlisting} +使用 \TeX studio 编辑文档. +也可直接双击 \texttt{main.tex} 文件. + +注意, 在双击打开时, 用户需要在 +\menu{Options > Configure TeXstudio} 中点击 +\menu{Show Advanced Options}, +接下来在 \menu{Build > Build Options > Commands (\${}PATH)} +中添加路径, +默认安装时为 +\begin{lstlisting} + /usr/local/texlive/2020/bin/x86_64-linux +\end{lstlisting} + +其他设置可参考前文, 这里不再赘述. + +\section{macOS} + +这里介绍两款 macOS 下的编辑器: +\TeX Shop 和 \TeX studio. + +\subsection{\TeX Shop} + +Mac\TeX{} 自带 \TeX Shop 编辑器 (注意不要与其他自带的程序混淆), +通常在安装完毕后便可立即使用. +通过编辑器打开 \texttt{main.tex}, +将排版程序 (工具栏上面左数第二个下拉菜单) 由默认的 \menu{LaTeX} 切换到 +\menu{pdflatexmk}, +再点击旁边的排版 \menu{排版} (\menu{Typeset}), +待编译完成后会弹出 PDF 预览界面. + +编译中文文档, 通常需要将排版程序切换到 \menu{XeLaTeX}. +注意可能需要多次编译以生成正确的交叉引用等内容. + +\subsection{\TeX studio} + +如果希望使用 \TeX studio, 也可以通过 Homebrew 安装: +\begin{lstlisting}[language=bash] + brew cask install texstudio +\end{lstlisting} +注意因为网络问题可能会下载失败. +这时可能需要从其他途径获得安装包并手工安装, 此处不再赘述. +其他设置与 Windows 系统中大致相仿. + +\subsubsection{无法显示文字} + +\TeX studio 在 macOS 下有可能无法显示文字, +这是其他系统下目前没有发现的问题. +具体解决方法见% +\href{https://zhuanlan.zhihu.com/p/80728204}{李阿玲在知乎的文章}. + +\section{Windows Subsystem for Linux} + +若使用 \TeX studio, +则需要将 \texttt{bash.exe} 及其绝对路径写入编译命令中. +使用 +\href{https://www.voidtools.com/zh-cn/}{everything} +搜索时会发现多个 \texttt{bash.exe}, +这里我们选择在路径 +\texttt{C:\textbackslash Windows\textbackslash WinSxS...} +下的 \texttt{bash.exe}. +若该路径下仍有多个 \texttt{bash.exe}, +则挑选与 +\texttt{C:\textbackslash Windows\textbackslash System32} +同等大小的. + +下面给出一个例子. +仿照前述建立用户自定义命令的方法, +在 +\menu{Options > Configure TeXstudio > Build > User commands} +中, +填写名称 +\texttt{User4:bash} +和功能\footnote{这里省略了中间路径, 用户根据自己的情形进行补充即可} +\begin{lstlisting} + "C:\Windows\WinSxS\...\bash.exe" -i -c "latexmk -xelatex -synctex=1 -interaction=nonstopmode -halt-on-error -file-line-error ?me)" +\end{lstlisting} +点击 \menu{OK}. +接下来打开 \menu{Options > Configure TeXstudio > Toolbars}, +在两个下拉菜单中分别选择 \menu{Tools} 和 \menu{All menus}, +在右边找到 \menu{Tools > User > bash} 并将其添加至左端, 点击 \menu{OK}. +这时, 在面板中将添加新的按钮. + +遗憾的是, 由于路径表达方式不同, \TeX studio 无法正常使用正反搜索. +这个问题的一个可选择解决方案是在 WSL 中安装图形界面并使用 X Server, +这样可直接将 \TeX studio 安装至 WSL, +这里不讨论此方案的优劣. + +\section{其他编辑器} + +\href{https://code.visualstudio.com/}{VS Code} 目前已有插件 +\href{https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop}{LaTeX Workshop} +供用户使用. +具体设置方式建议阅读插件手册, +一些网友的教程可以参考, +如 +\href{https://github.com/EthanDeng/vscode-latex}{EthanDeng 的教程}. +另外, +VS Code 的 +\href{https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl}{Remote-WSL} +插件可以帮助用户更方便地使用 WSL. +参考配置文件见附录~\ref{chp:appendix:wsl}. + +\href{https://www.vim.org/}{Vim} 是一款优秀的编辑器, +它的用法较目前常见的编辑器有很大不同, +因此用户上手时容易感觉无所适从, +但熟练掌握用法后, +用户将很容易对其进行定制. +\href{http://vim-latex.sourceforge.net/}{Vim-LaTeX} +尝试提供一套全面的工具来查看、编辑和编译LaTeX文档, +用户可以考虑使用. + +\section{多款编辑器对比参考} + +显然, 能够支持 \LaTeX{} 的编辑器并不局限于本手册所介绍的几款. +表~\ref{tab:editor} 是 \href{https://ddswhu.me/}{ddswhu} 在 \LaTeX{} +小圈子内部对 \LaTeX{} 编辑器所进行的用户体验调查的结果, 比较主观, 仅供参考. +其中 Sublime Text 和 Visual Studio Code 为文本编辑器, +它们需要借助插件才能支持 \LaTeX{} 编译. +对自己网络非常自信的用户也可以参考 +\href{https://en.wikipedia.org/wiki/Comparison_of_TeX_editors}{wikipedia} +上的对比结果. + +\begin{table}[htbp] + \centering + \caption{\LaTeX{} 编辑器对比} + \begin{tabular}{cccccc} + \toprule + & WinEdt & \TeX studio & \TeX works & Sublime Text & VS Code \\ + \cline{5-6} + 插件依赖 & & & & \href{https://latextools.readthedocs.io/en/latest/}{\LaTeX{}Tools} & \href{https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop}{\LaTeX{} Workshop} \\ + \midrule + 主流系统 & Win & 全平台 & Linux/Win & 全平台 & 全平台 \\ + 软件类型 & 商业软件 & 开源软件 & 开源软件 & 商业软件 & 开源软件 \\ + 软件价格 & \href{https://item.taobao.com/item.htm?id=551105790596}{219 元} & 0 & 0 & \href{https://www.sublimehq.com/store/text}{80 美元} & 0 \\ + 授权方式 & 终身/教育 & & & 终身/个人 & \\ + % 附加信息 & 教育版本 & & & 三年更新 & \\ + 代码高亮 & \stars{2.7} & \stars{3.2} & \stars{1.5} & \stars{4.3} & \stars{4.5} \\ + 颜色主题 & \stars{2.3} & \stars{2.2} & \stars{1.0} & \stars{4.0} & \stars{4.0} \\ + 自动补全 & \stars{2.7} & \stars{3.4} & \stars{2.0} & \stars{3.5} & \stars{4.0} \\ + 代码片段 & \stars{2.7} & \stars{2.4} & \stars{0.5} & \stars{3.8} & \stars{4.0} \\ + 辅助输入 & \stars{4.0} & \stars{3.4} & \stars{0.5} & \stars{2.3} & \stars{3.3} \\ + 开发完成 & \stars{4.0} & \stars{3.8} & \stars{4.5} & \stars{3.5} & \stars{4.0} \\ + 推荐指数 & \stars{2.7} & \stars{4.0} & \stars{1.5} & \stars{3.0} & \stars{4.3} \\ + \bottomrule + \end{tabular}% + \label{tab:editor}% +\end{table}% diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/macos.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/macos.tex new file mode 100644 index 00000000000..5cf3089b575 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/macos.tex @@ -0,0 +1,130 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{macOS}\label{chap:macOS} + +\section{安装 Homebrew} + +强烈建议用户使用 \href{https://brew.sh}{Homebrew}. +Homebrew 是一个包管理, 类似 Ubuntu 上面的 \texttt{apt-get}. +安装教程可以在其网站找到, 这里简单列出来: +\begin{lstlisting}[language=bash] + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +\end{lstlisting} +将以上命令在\textsf{终端}\footnote{% + 打开方法为: \keys{\cmdmac + \SPACE}, 输入 terminal 并打开 \menu{终端} 应用}% +执行. +脚本会在执行前暂停, 并说明它将做什么. 依据屏幕指令执行即可. + +中国大陆用户可以更改镜像以提高访问速度. 以中国科学技术大学镜像源为例: +\begin{lstlisting}[language=bash] + cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" + git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git + cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask + git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git + echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile + source ~/.bash_profile +\end{lstlisting} +如果是 zsh 用户, 最后两行请替换为 +\begin{lstlisting}[language=bash] + echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc + source ~/.zshrc +\end{lstlisting} + +\subsection{Xcode} + +根据 \href{https://docs.brew.sh/Xcode\#supported-xcode-versions}{Homebrew 网站}的提示\footnote{原文是 Homebrew supports and recommends the latest Xcode and/or Command Line Tools available for your platform}, +推荐用户在安装 Homebrew 前先安装 Xcode. +在\textsf{终端} 执行以下命令即可: +\begin{lstlisting}[language=bash] + xcode-select --install +\end{lstlisting} + +\section{安装 Mac\TeX} + +Mac\TeX{} 是 \TeX{} Live 在 macOS 下的再打包版本, 额外加入了一些辅助程序. 如果已经安装了 Homebrew, +只需在\textsf{终端}执行以下命令即可完成安装: +\begin{lstlisting}[language=bash] + brew cask install mactex +\end{lstlisting} +如有输入密码等提示, 请根据屏幕指示操作.至于环境变量等繁琐细节, Homebrew 会自动进行处理, +无须用户干预. + +完整的 Mac\TeX{} 会比较大. 如果磁盘空间实在紧张, 也可以考虑安装 Basic\TeX: +\begin{lstlisting}[language=bash] + brew cask install basictex +\end{lstlisting} +安装完成后 Basic\TeX{} 依然会缺很多包, 手动安装会比较麻烦, 所以不推荐没有经验的用户尝试. + +\section{卸载 Mac\TeX} + +如果用户借助 Homebrew cask 安装了 Mac\TeX, +那么卸载工作可能会稍显麻烦. +这里引用 \href{https://github.com/Homebrew/homebrew-cask/issues/32073}{Github} 上的讨论. +用户可以根据这里的内容卸载 Mac\TeX. + +\section{跨版本升级 Mac\TeX} + +跨版本升级 (Mac\TeX{} 的版本与 \TeX{} Live 保持一致), 可在\textsf{终端}借助 Homebrew 完成: +\begin{lstlisting}[language=bash] + brew update + brew cask upgrade mactex +\end{lstlisting} + +\section{升级宏包} + +升级宏包依旧可以使用 \texttt{tlmgr}. +使用方法与 \ref{sec:ubuntu:update}~节类似, 这里不再重复. +一般来说, 也需要使用 \texttt{sudo} 获取管理员权限后才能完成安装. + +\section{安装宏包} + +安装 CTAN 中的宏包方法与 \ref{sec:ubuntu:installpackage}~节一致. + +\section{调出宏包手册} + +调出宏包手册方法与 \ref{sec:ubuntu:texdoc}~节一致. + +\section{编译文件} + +假设已经用 TextEdit.app 或其他文本编辑器编写以下示例 \texttt{main.tex}% +\footnote{注意建立最小示例前先确定工作路径}, +内容为 +\begin{lstlisting}[language = {[LaTeX]TeX}] + \documentclass{article} + \begin{document} + Hello \LaTeX{} World! + \end{document} +\end{lstlisting} +接下来在\textsf{终端}中执行 +\begin{lstlisting}[language=bash] + pdflatex main +\end{lstlisting} +等待系统完成编译过程. +待编译完成后, 可看到在工作路径中生成了 \texttt{main.pdf} +文件和其他同名的辅助文件 \texttt{main.aux} 与 \texttt{main.log}. +可以打开 \texttt{main.pdf} 查看内容. + +对于中文文档, 可以编写以下最小示例% +\footnote{注意使用 UTF-8 编码}% +\begin{lstlisting}[language={[LaTeX]TeX}] + \documentclass[UTF8]{ctexart} + \begin{document} + 你好 \LaTeX{} 世界! + \end{document} +\end{lstlisting} +保存并退出. +接下来在\textsf{终端}中进入工作路径, +执行 +\begin{lstlisting}[language=bash] + xelatex main +\end{lstlisting} +等待系统完成编译过程. +\texttt{xelatex} 可调用系统字体, +为系统安装字体的方法请参考 +\href{https://support.apple.com/en-us/HT201749}{How to install and remove fonts on your Mac}. +安装完成后, 刷新字体缓存. +注意到此时 \texttt{xelatex} 只能通过文件名来调用发行版预装的字体, +解决此问题的方法请参考% +\href{https://zhuanlan.zhihu.com/p/59774395}{慕子的文章}. + +编译命令的相关参数, 这里不再赘述. diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/overleaf.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/overleaf.tex new file mode 100644 index 00000000000..f574470cc63 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/overleaf.tex @@ -0,0 +1,97 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{Overleaf} + +在特定场合, +有些用户并不需要也没条件在本地安装发行版, +因此这里额外补充 \href{www.overleaf.com}{Overleaf} 的相关内容. + +\section{注册 Overleaf} + +Overleaf 是全球范围内首屈一指的在线 \LaTeX{} 编辑平台. +它为每位用户提供了 Ubuntu 系统下的 \TeX{} Live. +它优秀的协作功能、丰富的模板仓库已吸引全球科研工作者成为它的用户. +Overleaf 提供了包括% +\href{https://cn.overleaf.com}{中文}% +在内的多种语言供用户使用. +2020年1月23日, +\href{https://www.overleaf.com/blog/tex-live-2019-upgrade-january-2020}{它将后台的 \TeX{} Live 升级为 2019 版本}, +同时, +\href{https://www.overleaf.com/blog/new-feature-select-your-tex-live-compiler-version}{Overleaf 还允许用户自主选择项目中的 \TeX{} Live 版本}. + +目前 Overleaf 允许用户% +\href{https://www.overleaf.com/learn/latex/Chinese}{使用中文}, +并为用户预先准备了一些% +\href{https://www.overleaf.com/learn/latex/Questions/What_OTF/TTF_fonts_are_supported_via_fontspec%3F#Fonts_for_CJK}{中文字体}. +这些中文字体可通过% +\href{https://www.overleaf.com/latex/templates/using-the-ctex-package-on-overleaf-zai-overleafping-tai-shang-shi-yong-ctex/gndvpvsmjcqx}{C\TeX{} 宏集}% +调用. +特别推荐用户使用% +\href{https://www.overleaf.com/latex/examples/demonstration-of-noto-serif-cjk-and-noto-sans-cjk-fonts/sgrwgcddtqsq}{思源宋体和思源黑体}% +这两种开源中文字体. + + +遗憾的是, +国内网络环境会对 Overleaf 所使用的 reCaptcha 造成影响. +这也使得很多用户在直接注册 Overleaf 时就遇到了问题. + +目前, +比较好的替代方案是借助 \href{https://orcid.org}{ORCID} 来进行注册. +目前使用国内网络访问 ORCID 还比较流畅. +用户, 尤其是科研工作者, 可以先注册一个 ORCID 账号. +未来投稿时, +可将 ORCID 账号与自己的期刊网站账号进行绑定. +同时, +用户也可逐步将自己所发表论文列在 ORCID 网站以便管理. + +\section{使用 Overleaf} + +用户通过 ORCID 注册 Overleaf 后便可进入自己的项目列表页面进行使用. + +新建项目是用户首先使用的功能. +Overleaf 提供了多种渠道为用户新建项目: +可以通过 Overleaf 中的模板, +也可以通过上传本地的 \textsf{zip} 压缩文件包. + +新建项目后, +用户便可进入编辑界面. +在编辑界面用户需要先在左上角 \menu{Menu} 中选择合适的编译命令. +由于默认字体和文件编码等原因, +强烈建议用户在处理中文文档时使用 \texttt{XeLaTeX}. +编写文档后, +用户可通过鼠标点击按钮进行编译, +也可使用快捷键 \keys{ctrl + enter}. + +用户编写的文件会保存在网站. +编写完成后, +用户只需点击 \menu{Menu} 旁的箭头回到项目列表. +这时可以看到新增项目右侧有四个图标, +它们分别是 \menu{Copy}、\menu{Download}、\menu{Archive} 和 \menu{Trash}. +用户可根据自己的需求点击合适的图标. + +\section{升级项目} + +Overleaf 将后台 \TeX{} Live 升级为 2019 版本后, +用户新建项目默认使用 \TeX{} Live 2019, +而老项目还是使用 \TeX{} Live 的老版本. +如果用户打算使用 \TeX{} Live 2019, +只需将项目复制一个新的副本, +即点击 \menu{Copy}. +这样创建的副本便可以使用 \TeX{} Live 2019. +如果用户是从 Github 上面导入的项目, +建议再次导入. + +\section{学习与帮助} + +Overleaf 的% +\href{https://www.overleaf.com/latex/templates}{模板}和% +\href{https://www.overleaf.com/learn}{文档}% +对全网公开, +用户可以自行学习. +另外 Overleaf 有着专业的技术支援团队, +用户可发送邮件至 \href{mailto:support@overleaf.com}% +{\ttfamily support@overleaf.com} +咨询使用过程中遇到的问题, +在邮件中请注意文明用语. +部分问题会超出免费服务的范畴, +用户需谨记这点.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/preface.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/preface.tex new file mode 100644 index 00000000000..f425be3213b --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/preface.tex @@ -0,0 +1,48 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter*{前言} + +在 QQ 群 91940767、478023327 和 640633524 中, +经常有群友咨询如何安装 \LaTeX. +实际上, +用户安装的是 \LaTeX{} 的\textbf{发行版}和相关的\textbf{编辑器}. +本文将介绍在\textbf{不存在其他 \LaTeX{} 发行版 (如 C\TeX{} 套装) 的前提下}, +在 Windows 10、Ubuntu 20.04 和 macOS 系统中安装 +\TeX{}~Live (macOS 中介绍 Mac\TeX)、升级宏包、编译简易文档等相关操作, +并多以介绍命令行操作为主. +有关 MiK\TeX{} 的安装, +可以参考 \href{https://camusecao.top/1970-01-01-/MiKTeX/}{MiK\TeX{} 的基本使用}. + +本文还将简要介绍几款常见编辑器的使用方法, +其他编辑器如 \href{https://code.visualstudio.com/}{VS Code}, +\href{https://www.vim.org/}{Vim}, +用户可自行了解它们的使用方法. + +除在本地安装 \LaTeX{} 发行版和编辑器之外, +本文还将额外补充使用 \href{http://www.overleaf.com}{Overleaf} 的相关内容. + +本文所涉及到的代码需结合上下文说明, 不能简单地复制粘贴. 红色文字都是可点的超链接, 可直接跳转. +\menu{菜单} 表示软件菜单. \keys{k} 表示键盘按键. +建议用户阅读 \href{https://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf}{texlive-zh-cn} +和 \href{http://mirrors.ctan.org/info/lshort/chinese/lshort-zh-cn.pdf}{lshort-zh-cn} +以更全面地了解基础内容. + +必须声明的是, +即便你已经通读本手册和上面提到的两本书, +有很大概率还会碰到很多问题. +这时我希望用户可以按照正确方式提问, +例如提供\textbf{最小工作示例}, +并在论坛上面留下你的问题和相应解答以方便后来者. + +本文大部分内容是个人过去一段时间的使用总结, 其中难免有不甚合理或晦涩难懂的部分. +若用户在阅读本文档的过程中有任何意见和建议, +请发\href{mailto:ranwang.osbert@outlook.com}{邮件}或在 +\href{https://github.com/OsbertWang/install-latex-zh-cn/}{GitHub} 中提 issue. + +本手册发布后, +\href{https://github.com/EthanDeng}{Dongsheng Deng}, +\href{https://github.com/muzimuzhi}{muzimuzhi}, +\href{https://github.com/stone-zeng}{Xiangdong Zeng} +对本手册提出了很好的建议, 并提供了帮助, +其中, 有关 macOS 的内容最初由 Xiangdong Zeng 草拟完成. +在此一并感谢. diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/ubuntu.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/ubuntu.tex new file mode 100644 index 00000000000..2f8d67ba6b3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/ubuntu.tex @@ -0,0 +1,368 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{Ubuntu 20.04 系统} + +\section{安装 \TeX{} Live} + +这里只阐述如何用镜像安装. +为使用户顺利使用 \TeX{} Live 2020, +建议用户首先卸载从源内安装的 \TeX{} Live 的相关包, +具体方法见 \ref{sec:ubuntu:uninstall}~节. + +下载 +\href{https://mirrors.ctan.org/systems/texlive/Images/texlive2020.iso}{iso 镜像文件} +的方法见 \ref{sec:windows:install}~节. +下载完毕后, 打开 \textsf{Terminal} 窗口验证 MD5 值, +即执行以下命令 +\begin{lstlisting}[language = bash] + cd ~/Downloads + md5sum texlive2020.iso +\end{lstlisting} +若显示 +\begin{lstlisting} + a31c500c7830d901363c5fa0e65cc18d texlive2020.iso +\end{lstlisting} +则镜像文件下载正确. +同样可验证 SHA512 值, +执行 +\begin{lstlisting}[language = bash] + cd ~/Downloads + sha512sum texlive2020.iso +\end{lstlisting} +正确的返回结果为 +\begin{lstlisting}[language=bash,literate={a}{a}{1} {b}{b}{1} {c}{c}{1} {d}{d}{1} {e}{e}{1} {f}{f}{1}] + 7c94bbcff5318e540dc0b03010896185d8985bcc2c2ac11906e831ec583fd574bf9720fce5efc29470c80bafe12f42ddaa392b96c460a27eda94f93c12e7b57d texlive2020.iso +\end{lstlisting} + +将下载的光盘镜像进行挂载 +\begin{lstlisting}[language = bash] + sudo mkdir /mnt/texlive + sudo mount ./texlive2020.iso /mnt/texlive +\end{lstlisting} +接下来执行 +\begin{lstlisting}[language = bash] + sudo /mnt/texlive/install-tl +\end{lstlisting} +进行安装. +在屏幕上应该能见到以下内容 +\begin{lstlisting} + ======================> TeX Live installation procedure <===================== + + ======> Letters/digits in <angle brackets> indicate <======= + ======> menu items for actions or customizations <======= + + Detected platform: GNU/Linux on x86_64 + + <B> set binary platforms: 1 out of 6 + + <S> set installation scheme: scheme-full + + <C> set installation collections: + 40 collections out of 41, disk space required: 6516 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 + [X] after install, set CTAN as source for package updates + + <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 + + Enter command: +\end{lstlisting} +点击键盘 \keys{I} 进行默认安装. +如果用户对于 Ubuntu 系统比较了解, +可以根据提示, +更改安装设置, +如安装路径等. +为简化起见, +以下内容我们均认为用户采用默认安装. +安装完毕后, 将挂载的光盘镜像弹出并删除文件夹 +\begin{lstlisting}[language = bash] + sudo umount /mnt/texlive + sudo rm /mnt/texlive +\end{lstlisting} + +安装完成后, 用户需要设置环境变量. +继续在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language = bash] + gedit ~/.bashrc +\end{lstlisting} +在打开的文件末尾添加 +\begin{lstlisting} + # Add TeX Live to the PATH, MANPATH, INFOPATH + export PATH=/usr/local/texlive/2020/bin/x86_64-linux:$PATH + export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH + export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH +\end{lstlisting} +并保存退出. +这时再打开 \textsf{Terminal} 执行 +\begin{lstlisting}[language=bash] + tex -v +\end{lstlisting} +若显示 +\begin{lstlisting} + TeX 3.14159265 (TeX Live 2020) + kpathsea version 6.3.2 + Copyright 2020 D.E. Knuth. + There is NO warranty. Redistribution of this software is + covered by the terms of both the TeX copyright and + the Lesser GNU General Public License. + For more information about these matters, see the file + named COPYING and the TeX source. + Primary author of TeX: D.E. Knuth. +\end{lstlisting} +即为安装成功. + +接下来处理字体. +在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language=bash] + sudo cp /usr/local/texlive/2020/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf +\end{lstlisting} +将配置文件复制到系统, +然后继续执行 +\begin{lstlisting}[language=bash] + sudo fc-cache -fsv +\end{lstlisting} +刷新字体缓存. +这样一来, \TeX{} Live 中的字体才能够被正确调用. +更多内容请参考 \href{https://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf}{texlive-zh-cn}. + +如果用户更改了安装路径, +要注意将 +\begin{lstlisting} + /usr/local/texlive/2020/ +\end{lstlisting} +在各处替换. + +\section{卸载 \TeX{} Live}\label{sec:ubuntu:uninstall} + +如果要卸载从源内安装的 \TeX{} Live, 个人比较推荐使用 synaptic package manager. +\textsf{terminal} 中执行 +\begin{lstlisting}[language = bash] + sudo apt-get install synaptic +\end{lstlisting} +即可安装. +安装后打开, 搜索 \textsf{texlive} 即可看到与之相关的包, 右键标记以删除即可. +当然, 用户也可以直接使用 +\begin{lstlisting}[language = bash] + dpkg -l | grep 'TeX Live' +\end{lstlisting} +找到相应的包名 \texttt{<package name>}, 之后使用类似 +\begin{lstlisting}[language = bash] + sudo apt-get remove --purge <package name> +\end{lstlisting} +的命令删除各个包. +删除时系统会提示使用 +\begin{lstlisting}[language = bash] + sudo apt-get autoremove <package name> +\end{lstlisting} +来删除相应的依赖包. + +如果是从光盘镜像安装, +直接删除文件夹即可. +先在\textsf{terminal} 中执行 +\begin{lstlisting}[language = bash] + kpsewhich -var-value TEXMFROOT +\end{lstlisting} +来查询安装路径, +进而通过 \texttt{sudo rm -rf} 命令进行删除. +默认安装的用户直接运行 +\begin{lstlisting}[language = bash] + sudo rm -rf /usr/local/texlive/2020 + rm -rf ~/.texlive2020 +\end{lstlisting} +当然删除后还要清理掉环境变量. + +\section{跨版本升级 \TeX{} Live}\label{sec:ubuntu:version} + +在 \href{https://www.tug.org/texlive/upgrade.html}{tug.org} +网站上提供了相应的方法. +但网站也声明: +默认情况下, +请通过执行新安装来获取新版本的 \TeX{} Live% +\footnote{原文是: By default, +please get the new TL by doing a new installation instead of proceeding here}. + +\section{升级宏包}\label{sec:ubuntu:update} + +首次升级前, +在 \textsf{terminal} 中执行 +\begin{lstlisting}[language = bash] + sudo visudo +\end{lstlisting} +将 +\begin{lstlisting} + /usr/local/texlive/2020/bin/x86_64-linux: +\end{lstlisting} +添加在 \texttt{secure\_path} 中% +\footnote{这里只讨论默认安装的情况}. +然后依次 \keys{\ctrl + X}, \keys{Y}, \keys{\enter} 保存退出. + +接下来在 \textsf{terminal} 中执行 +\begin{lstlisting}[language = bash] + sudo tlmgr option repository ctan +\end{lstlisting} +让系统自动选择源, +同样可以使用大陆地区的源升级, +详情见附录~\ref{chp:appendix:mirror}. +执行命令 +\begin{lstlisting}[language = bash] + sudo tlmgr update --list +\end{lstlisting} +可查看目前源上可升级的宏包都有哪些. +高级用户可以根据自己的需求选择升级特定宏包. +建议初级用户执行 +\begin{lstlisting}[language = bash] + sudo tlmgr update --self --all +\end{lstlisting} +同时升级 \texttt{tlmgr} 本身和全部宏包. + +\section{安装宏包}\label{sec:ubuntu:installpackage} + +Ubuntu 20.04 下安装宏包的要求与 Windows 10 下没有多少区别, 只需注意权限, 例如 +\begin{lstlisting}[language = bash] + sudo tlmgr install mcmthesis +\end{lstlisting} +即安装了 mcmthesis. + +\section{调出宏包手册}\label{sec:ubuntu:texdoc} + +与 Windows 10 类似, +当正确安装后, +用户可以调出宏包手册以查阅相应内容. +例如在 \textsf{terminal} 中执行 +\begin{lstlisting}[language=bash] + texdoc texlive-zh-cn +\end{lstlisting} +或 +\begin{lstlisting}[language=bash] + texdoc lshort-zh-cn +\end{lstlisting} +就可分别调出 \texttt{texlive-zh-cn.pdf} 和 \texttt{lshort-zh-cn.pdf}. + +\section{编译文件} + +首先, 用户需要在工作路径建立一个 \texttt{tex} 文件. +在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language = bash] + mkdir ~/Documents/work-latex + cd ~/Documents/work-latex/ + gedit main.tex +\end{lstlisting} +在打开的文件输入一个最小示例 +\begin{lstlisting}[language = {[LaTeX]TeX}] + \documentclass{article} + \begin{document} + Hello \LaTeX{} World! + \end{document} +\end{lstlisting} +保存并退出. +接下来执行 +\begin{lstlisting} + pdflatex main +\end{lstlisting} +等待系统完成编译过程. +待编译完成后, +我们即可看到在 \texttt{\~{}/Documents/work-latex} 中出现了 +\texttt{main.pdf} 文件和其他同名的辅助文件 \texttt{main.aux} 与 +\texttt{main.log}. +执行 +\begin{lstlisting}[language=bash] + evince main.pdf +\end{lstlisting} +即可打开 \texttt{pdf} 文件. + +对于中文文档, 可以在 \texttt{gedit} 中编写以下最小示例% +\footnote{gedit 默认使用 UTF-8 编码}% +\begin{lstlisting}[language={[LaTeX]TeX}] + \documentclass[UTF8]{ctexart} + \begin{document} + 你好 \LaTeX{} 世界! + \end{document} +\end{lstlisting} +保存并退出. +接下来执行 +\begin{lstlisting}[language=bash] + xelatex main +\end{lstlisting} +等待系统完成编译过程. +\texttt{xelatex} 可以使用系统内安装的字体, +安装字体的方法可参考附录~\ref{chp:appendix:wsl}. + +编译命令可添加参数, 这里与 \ref{sec:windows:compile}~节中的情形一致. + +\subsection{无法使用 \texttt{xelatex} 命令}\label{subsec:ubuntu:xelatexfail} + +有些用户反映安装完毕后无法使用 \texttt{xelatex} 命令. +这或许是因为缺失 libfontconfig , 用户可在命令行中执行 +\begin{lstlisting}[language=bash] + sudo apt-get install libfontconfig1 +\end{lstlisting} +进行安装. + +为提升安装速度, 可考虑更换 Ubuntu 源, 例如更换至清华大学. +在 \textsf{Terminal} 中执行 +\begin{lstlisting}[language = bash] + sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak +\end{lstlisting} +备份 \texttt{sources.list} 文件. +接下来执行 +\begin{lstlisting}[language = bash] + sudo gedit /etc/apt/sources.list +\end{lstlisting} +将文件替换为以下内容% +\footnote{本段文字可至% + \href{https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/}{清华大学镜像网站}% + 获取} +\begin{lstlisting} + # 默认注释了源码镜像以提高 apt update 速度, 如有需要可自行取消注释 + deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse + # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse + deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse + # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse + deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse + # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse + deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse + # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse + + # 预发布软件源, 不建议启用 + # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse + # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse +\end{lstlisting} +然后执行 +\begin{lstlisting}[language = bash] + sudo apt-get update && sudo apt-get upgrade +\end{lstlisting} +换源并更新. +若更改错误, +可执行 +\begin{lstlisting}[language=bash] + sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list +\end{lstlisting} +恢复文件. diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/windows.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/windows.tex new file mode 100644 index 00000000000..7c45b7c99e5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/windows.tex @@ -0,0 +1,470 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{Windows 10 系统} + +\section{安装 \TeX{} Live}\label{sec:windows:install} + +在安装 \TeX{} Live 之前, +在文件夹菜单栏 \menu{查看 > 显示/隐藏} 中选择 \menu{文件扩展名}. + +用户可以从最近的 CTAN 源\footnote{这里所谓的最近, 其实是由系统判定的, 实际上系统可能会误判}下载 \TeX{} Live 的 +\href{https://mirrors.ctan.org/systems/texlive/Images/texlive2020.iso}{iso 镜像文件}, +也可以找大陆地区的源自行下载\footnote{新版本发布时, 各镜像网站同步的进度会有不同}. +通过大陆地区的源下载 iso 文件的方法请参考附录~\ref{chp:appendix:mirror}. + +假设镜像文件被下载到本地后, +其存放路径为 \texttt{X:\textbackslash Y}% +\footnote{这里, \texttt{X} 表示盘符, +如 \texttt{C}、\texttt{D}、\texttt{E} 等; +\texttt{Y} 表示文件夹; +默认路径名称为不带空格的英文}. +下载完毕后, 用户打开 \textsf{cmd} 窗口% +\footnote{点击 \keys{\faWindows}, +输入 \textsf{cmd}, +点击 \keys{\enter}; +或在任意文件夹中按 \keys{\ctrl + L}, +输入 \textsf{cmd}, +点击 \keys{\enter}}, +执行 +\begin{lstlisting}[language = bash] + echo %path:;=&echo.% +\end{lstlisting} +查看环境变量. +若 \texttt{C:\textbackslash Windows\textbackslash system32} +不在结果中\footnote{这里默认系统盘为\textsf{C}盘}, +则关闭 \textsf{cmd} 窗口, +将 \texttt{C:\textbackslash Windows\textbackslash system32} +添加到环境变量中\footnote{在 \menu{桌面 > 此电脑 > 属性 > 高级系统设置 > 环境变量 > 系统变量 > Path} 中添加}. +\textbf{根据以往经验, 安装过 C\TeX{} 套装的用户往往会有} \texttt{system32} \textbf{丢失的问题}. +另外, 如果环境变量中有 \texttt{mingw} 或 \texttt{jdk} 相关的内容, +也请暂时删除\footnote{具体原因参见 +\href{https://tex.stackexchange.com/questions/445086/error-installing-latest-version-of-tex-live-on-windows-10}{stackexchange} +的解释, 待安装结束后, 再将 \texttt{mingw} 或 \texttt{jdk} 环境变量添加至 \TeX{} Live 的环境变量之后}. +同时国内常见的 2345 好压也会对安装构成影响, +建议删除它并在安装 \TeX{} Live 后更换其他同类软件% +\footnote{推荐 \href{http://www.winrar.com.cn/}{WinRAR} +或 \href{https://www.7-zip.org/}{7-Zip}}. + +下面我们要确保下载到的 iso 文件没有损坏, 一种常用做法是检查其 MD5 值. +当然, 如果确信自己下载到的文件没有问题, 也可以跳过这一步. +打开 \textsf{cmd} 窗口依次执行以下代码 +\begin{lstlisting}[language = bash] + cd /d X:\Y + certutil -hashfile texlive2020.iso md5 +\end{lstlisting} +若系统显示 +\begin{lstlisting} + MD5 的 texlive2020.iso 哈希: + a31c500c7830d901363c5fa0e65cc18d + CertUtil: -hashfile 命令成功完成 +\end{lstlisting} +则表明下载的镜像文件正常. +除 MD5 值外, +还可检查 SHA512 值. +依然是在 \textsf{cmd} 执行 +\begin{lstlisting}[language = bash] + cd /d X:\Y + certutil -hashfile texlive2020.iso sha512 +\end{lstlisting} +若系统显示 +\begin{lstlisting}[language=bash,literate={a}{a}{1} {b}{b}{1} {c}{c}{1} {d}{d}{1} {e}{e}{1} {f}{f}{1}] + SHA512 的 texlive2020.iso 哈希: + 7c94bbcff5318e540dc0b03010896185d8985bcc2c2ac11906e831ec583fd574bf9720fce5efc29470c80bafe12f42ddaa392b96c460a27eda94f93c12e7b57d + CertUtil: -hashfile 命令成功完成 +\end{lstlisting} +即为验证成功. + + +接下来开始安装. +推荐用户先手动建立 \TeX{} Live 的安装路径 (文件夹) 再进行安装, +注意路径的名称是\textbf{不带空格的英文}, +默认路径为 \texttt{C:\textbackslash texlive\textbackslash 2020}. +将镜像文件挂载至虚拟光驱\footnote{Windows 10 默认双击镜像文件便可加载; +受某些压缩软件影响双击失效时, +可通过文件夹菜单栏 +\menu{主页 > 打开 > Windows 资源管理器} 加载; +第三方虚拟光驱软件可考虑 WinCDEmu 或 UltraISO; +不鼓励解压缩镜像文件}. +假设加载后的路径为 \texttt{Z:\textbackslash}. +在卸载了国内第三方安全软件的前提下, +% 以管理员身份打开 \textsf{cmd} 窗口并执行% +% \footnote{点击 \keys{\faWindows}, +% 输入 \textsf{cmd}, +% 点击 \keys{\ctrl + \shift + \enter}} +打开 \textsf{cmd} 窗口并执行 +% \begin{lstlisting}[language = bash] +% cd /d Z: +% \end{lstlisting} +% 切换路径. +% 接下来执行 +\begin{lstlisting}[language = bash] + Z:\install-tl-windows.bat --no-gui +\end{lstlisting} +即可看到如下结果 +\begin{lstlisting} + =====================> TeX Live installation procedure <===================== + + ======> Letters/digits in <angle brackets> indicate <======= + ======> menu items for actions or customizations <======= + + Detected platform: Windows + + <B> set binary platforms: 1 out of 6 + + <S> set installation scheme: scheme-full + + <C> set installation collections: + 41 collections out of 41, disk space required: 6702 MB + + <D> set directories: + TEXDIR (the main TeX directory): + C:/texlive/2020 + TEXMFLOCAL (directory for site-wide local files): + C:/texlive/texmf-local + TEXMFSYSVAR (directory for variable and automatically generated data): + C:/texlive/2020/texmf-var + TEXMFSYSCONFIG (directory for local config): + C:/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 + [X] adjust search path + [1] add menu items, shortcuts, etc. + [1] update file associations + [X] install TeXworks front end + [X] after install, set CTAN as source for package updates + + <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 + + Enter command: +\end{lstlisting} +这时, 用户可可直接按键盘 \keys{I} 在默认路径中直接安装 \TeX{} Live, +也可按键盘 \keys{D} 来更改安装路径. +按 \keys{D} 后, 用户可看到 +\begin{lstlisting} + ============================================================================== + Directories customization: + + <1> TEXDIR: C:/texlive/2020 + main tree: C:/texlive/2020/texmf-dist + + <2> TEXMFLOCAL: C:/texlive/texmf-local + <3> TEXMFSYSVAR: C:/texlive/2020/texmf-var + <4> TEXMFSYSCONFIG: C:/texlive/2020/texmf-config + + <5> TEXMFVAR: ~/.texlive2020/texmf-var + <6> TEXMFCONFIG: ~/.texlive2020/texmf-config + <7> TEXMFHOME: ~/texmf + + Note: ~ will expand to %USERPROFILE% + + Actions: + <R> return to main menu + <Q> quit + + Enter command: +\end{lstlisting} +这时按键盘 \keys{1}, 将看到 +\begin{lstlisting} + New value for TEXDIR [C:/texlive/2020]: +\end{lstlisting} +这时可更改路径, 如 \texttt{D:/texlive/2020}. +接下来, 按键盘 \keys{R} 即可回到初始的安装界面. +用户可通过阅读英文执行其他操作, 这里不再赘述. +至此, 用户只需耐心等待安装完成, 并且不要点击 \textsf{cmd} 窗口% +\footnote{Windows 10 默认采取快速编辑模式, 一旦点击 \textsf{cmd} 窗口, +将显示``选择命令提示符''而导致进程暂停}. +安装完成后, 关闭再打开 \textsf{cmd} 窗口% +\footnote{正常安装 \TeX{} Live 后, 环境变量会变化, +关闭原 \textsf{cmd} 窗口再重新打开才能获取新的环境变量}, +执行 +\begin{lstlisting}[language = bash] + tex -v +\end{lstlisting} +显示 +\begin{lstlisting} + TeX 3.14159265 (TeX Live 2020/W32TeX) + kpathsea version 6.3.2 + Copyright 2020 D.E. Knuth. + There is NO warranty. Redistribution of this software is + covered by the terms of both the TeX copyright and + the Lesser GNU General Public License. + For more information about these matters, see the file + named COPYING and the TeX source. + Primary author of TeX: D.E. Knuth. +\end{lstlisting} +即可认为安装顺利完成% +\footnote{若未能正确显示结果, 则可能是因为环境变量未改变, +用户可手动添加 \texttt{<TEXDIR>\textbackslash bin\textbackslash win32} 至环境变量, +\texttt{<TEXDIR>} 需与你方才的安装路径一致}. +弹出前面加载的光盘镜像, +安装到此结束. + +\subsection{下载镜像一直不成功的处理办法} + +目前发现有些用户使用某些浏览器时无法正常下载镜像文件. +这时, +用户可以选择使用 \href{https://eternallybored.org/misc/wget/}{wget} 对镜像进行下载. +具体用法是: +将 \textsf{wget} 所在目录添加到环境变量中. +打开 \textsf{cmd} 窗口执行以下代码 +\begin{lstlisting}[language = bash] + wget http://mirrors.ctan.org/systems/texlive/Images/texlive2020.iso +\end{lstlisting} +即可下载最近的镜像. +类似地, +也可以指定国内的源进行下载, +例如选择清华大学镜像 +\begin{lstlisting}[language = bash] + wget https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2020.iso +\end{lstlisting} +其他国内镜像只需要将链接替换即可, +链接和方法请参考附录~\ref{chp:appendix:mirror}. + +\subsection{需要管理员权限的处理办法} + +有些用户反馈安装过程中需要管理员权限. +以管理员身份打开 \textsf{cmd} 窗口的方法是点击 \keys{\faWindows}, +输入 \textsf{cmd}, +按 \keys{\ctrl + \shift + \enter} 三个键. +一般而言, +在系统盘内直接安装 \TeX{} Live 会碰到此类问题, +因此鼓励用户在安装前先手动建立安装路径. +直接使用管理员身份打开 \textsf{cmd} 窗口进行安装可能会对以后的升级造成影响. + +\section{卸载 \TeX{} Live} + +在跨版本升级 \TeX{} Live 时, 通常需要卸载旧版 \TeX{} Live. +在命令行执行 +\begin{lstlisting}[language=bash] + kpsewhich -var-value TEXMFROOT +\end{lstlisting} +可以查看 \texttt{TEXMFROOT} 的值, +该值即为 \TeX{} Live 的安装路径% +\footnote{% + 除这里提供的 \texttt{TEXMFROOT}, 还有很多其他变量, 可在 + \href{https://www.tug.org/texlive/doc/texlive-zh-cn/texlive-zh-cn.pdf}{texlive-zh-cn} + 第 2.3 节处找到 +}. +接下来, +用户只需执行% +\footnote{双击或在 \texttt{cmd} 中运行}% +安装路径中的卸载批处理文件即可实现卸载, 如默认安装时执行 +\begin{lstlisting}[language=bash] + C:\texlive\2020\tlpkg\installer\uninst.bat +\end{lstlisting} +结束以上步骤后, +手动删除用户文件夹中的 \texttt{.texlive2020}. +如果用户安装 \TeX{} Live 时需要管理员权限, +那么在卸载时同样需要管理员权限. + +\subsection{手动卸载} + +如果执行批处理文件 \texttt{uninst.bat} 出错, +用户也可手动删除安装文件夹, +之后再清理 \TeX{} Live 的环境变量, +并且清理注册表 +\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} + + +\section{跨版本升级 \TeX{} Live} + +目前在 \href{https://www.tug.org/texlive/upgrade.html}{tug.org} +上面提供的说法是: +Windows 没有类似 Unix 的升级程序, +需要进行新安装% +\footnote{原文是: There is no comparable upgrade procedure for Windows. +Doing a new installation is necessary.}. + +\section{升级宏包}\label{sec:windows:update} + +安装完成后, 用户可以升级宏包以获得更好的使用体验. +下面将介绍使用命令行升级宏包的方法. +打开 \textsf{cmd} 窗口, 首先执行下面命令指定升级使用的镜像源. +\texttt{ctan} 表示系统在升级时将自动寻求最近的源进行下载. +\begin{lstlisting}[language=bash] + tlmgr option repository ctan +\end{lstlisting} +用户同样可以指定其他的镜像源, +方法见附录~\ref{chp:appendix:mirror}. + +接下来, 用户执行命令 +\begin{lstlisting}[language=bash] + tlmgr update --list +\end{lstlisting} +可查看目前源上可升级的宏包都有哪些. +高级用户可以根据自己的需求选择升级特定宏包. +建议初级用户直接升级全部宏包. +用户只需执行 +\begin{lstlisting}[language=bash] + tlmgr update --self --all +\end{lstlisting} +同时升级 \texttt{tlmgr} 本身和全部宏包. + +\subsection{\texttt{tlmgr} 本身无法成功升级} + +遇到这种情况时, 用户需自行下载 +\href{https://mirrors.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.exe}{update-tlmgr-latest.exe}, +然后再执行升级命令即可% +\footnote{这里依旧让系统自动选择镜像源, +用户可以自行选择国内镜像以加快下载速度}. + +\subsection{升级到一半停止} + +这种情况下, 用户需要执行另外一个命令继续升级 +\begin{lstlisting} + tlmgr update --reinstall-forcibly-removed --all +\end{lstlisting} + +\section{安装宏包} + +在默认状态下, 用户将完整安装 \TeX{} Live, 因此用户极少碰到需要手动安装宏包的情形. +同时, 在 +\href{http://mirrors.ctan.org/info/lshort/chinese/lshort-zh-cn.pdf}{lshort-zh-cn} +中也明确提到, \textbf{如非万不得已, 尽量不要手动安装宏包}. +因此在这里我只介绍从源处安装宏包的命令. +假设用户想安装 \texttt{mcmthesis} 宏包, 只需在 \textsf{cmd} 执行 +\begin{lstlisting}[language=bash] + tlmgr install mcmthesis +\end{lstlisting} +需要注意的是, 用户一定要清楚所要安装的宏包名称, 并且在安装宏包前先确保镜像源设置正确. + +\section{调出宏包手册} + +当正确安装后, +用户可以调出宏包手册以查阅相应内容. +例如在 \textsf{cmd} 执行 +\begin{lstlisting}[language=bash] + texdoc texlive-zh-cn +\end{lstlisting} +或 +\begin{lstlisting}[language=bash] + texdoc lshort-zh-cn +\end{lstlisting} +就可分别调出 \texttt{texlive-zh-cn.pdf} 和 \texttt{lshort-zh-cn.pdf}, +这两本手册中都有讲解安装的相关内容, +建议用户阅读. + +\section{编译文档}\label{sec:windows:compile} + +升级宏包完成后, 用户可以编译文档. +这里依旧使用命令行来完成这一过程. + +首先, 用户需要在指定位置\footnote{以下称工作路径}建立一个 \texttt{tex} 文件: +\begin{lstlisting}[language = bash] + mkdir D:\work-latex + cd /d D:\work-latex + notepad main.tex +\end{lstlisting} +第1行表示创建一个工作路径 \texttt{D:\textbackslash work-latex}, +第2行表示进入工作路径, 第3行表示用记事本打开 \texttt{main.tex} 文件, +若文件不存在, 系统将询问用户是否创建该文件% +\footnote{Windows 10 较新版本可能对中文名友好一些, +但这里不建议用户使用中文命名工作路径和文件名}. +在打开的记事本中编写一个最小示例 +\begin{lstlisting}[language={[LaTeX]TeX}] + \documentclass{article} + \begin{document} + Hello \LaTeX{} World! + \end{document} +\end{lstlisting} +保存并退出. +接下来执行 +\begin{lstlisting}[language=bash] + pdflatex main +\end{lstlisting} +等待系统完成编译过程. +待编译完成后, 我们即可看到在 \texttt{D:\textbackslash work-latex} +中出现了 \texttt{main.pdf} 文件和其他同名的辅助文件 +\texttt{main.aux} 与 \texttt{main.log}. + +对于中文文档, 可以在记事本中编写以下最小示例% +\footnote{自 Windows 10 1903 版本开始, 记事本默认使用 UTF-8 编码; +若是之前的 Windows 10 版本, 请使用其他编辑器并规定文档编码为 UTF-8}% +\begin{lstlisting}[language={[LaTeX]TeX}] + \documentclass[UTF8]{ctexart} + \begin{document} + 你好 \LaTeX{} 世界! + \end{document} +\end{lstlisting} +保存并退出. +接下来执行 +\begin{lstlisting}[language=bash] + xelatex main +\end{lstlisting} +等待系统完成编译过程. +\texttt{xelatex} 编译命令配合 UTF-8 编码和 \texttt{ctex} +宏集已经是\textbf{目前主流的中文处理手段}. +\texttt{xelatex} 可以使用系统内安装的字体, +用户在安装字体时需右键字体文件选择\textbf{为所有用户安装}. + +总结一下, 在使用 \LaTeX{} 时, 用户首先要在工作路径% +\footnote{建议不同的工程放入不同的工作路径}% +中建立一个完整的 \texttt{tex} 文件% +\footnote{该文件必须包含 \texttt{\textbackslash documentclass}, +\texttt{\textbackslash begin\{document\}} 和 +\texttt{\textbackslash end\{document\}}, +这里不讨论包含子文件的情况, +文件名需为不含空格的英文}. +当 \texttt{tex} 文件内容确定后, 再保存文件并使用编译命令% +\footnote{目前常用的编译命令为 \texttt{pdflatex} 和 \texttt{xelatex}}, +将 \texttt{tex} 文件编译成 \texttt{pdf} 文件. + +编译命令有很多可选参数, 如用户能够从 \texttt{pdf} 文件跳回 \texttt{tex} 文件, +便是因为执行编译时添加了参数 +\begin{lstlisting}[language=bash] + pdflatex -synctex=1 main +\end{lstlisting} +此外还有很多其他参数, 用户若感兴趣, 可自行阅读手册. + +在很多时候, 我个人更倾向于使用 \texttt{latexmk} 来编译 \texttt{tex} 文档, +如执行 +\begin{lstlisting}[language=bash] + latexmk -pdf -synctex=1 -interaction=nonstopmode main +\end{lstlisting} +意味着使用 +\begin{lstlisting}[language=bash] + pdflatex -synctex=1 -interaction=nonstopmode main +\end{lstlisting} +来编译文档 \texttt{main.tex}, 并在有需要时完成其他步骤% +\footnote{如使用 \texttt{bibtex} 或 \texttt{biblatex} 处理参考文献时需要多次编译, +详情见相关文档}. + +\subsection{\LaTeXe 版本不匹配导致 \texttt{xelatex} 失败} + +使用 \texttt{xelatex} 编译文档, +系统有时会提示目前 \LaTeXe 的版本低于某宏包的要求版本. +这种情况是由于 \textsf{fmt} 文件未能更新所导致. +此时可考虑在命令行运行 +\begin{lstlisting}[language=bash] + fmtutil-user --byfmt xelatex +\end{lstlisting} +待结束后再用 \texttt{xelatex} 编译文档. +更多内容参考 +\href{https://github.com/CTeX-org/forum/issues/70}{github 上的讨论}. + +另外也可考虑重装 \texttt{xetex}. +在命令行执行 +\begin{lstlisting}[language=bash] + sudo tlmgr install --reinstall xetex +\end{lstlisting} diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/wsl.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/wsl.tex new file mode 100644 index 00000000000..cd6f823363a --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/chapter/wsl.tex @@ -0,0 +1,350 @@ +% !TeX root = ../install-latex-guide-zh-cn.tex + +\chapter{Windows Subsystem for Linux} + +目前微软推出了 Windows Subsystem for Linux (WSL) 供开发人员使用. +在这里简要介绍如何在 WSL 中安装 \TeX{} Live. +我选择的是微软商店中的 Ubuntu. +此篇安装教程仅供参考. +这里称 WSL 中使用的命令行为 \textsf{bash}. +\textbf{不建议}对操作系统了解不多的用户阅读本章内容. + +\section{安装 \TeX{} Live} + +在主系统% +\footnote{在 Windows 10 中直接进行的操作即为在主系统中的操作}% +中下载 +\href{https://mirrors.ctan.org/systems/texlive/Images/texlive2020.iso}{iso 镜像文件}, +可选择国内源以加快下载速度. +下载完毕后, 在 \textsf{cmd} 中验证文件是否正常. +下载及文件验证方法同 \ref{sec:windows:install}~节. + +在正式安装前, +用户需要在 \textsf{bash} 中执行 +\begin{lstlisting}[language=bash] + sudo apt-get install libfontconfig1 + sudo apt-get install ttf-mscorefonts-installer + sudo apt-get install fontconfig +\end{lstlisting} +这些命令是为了处理日后使用中可能出现的字体问题. +为避免安装速度过慢, +可仿照 \ref{subsec:ubuntu:xelatexfail}~节更改文件 \texttt{sources.list}. +注意 WSL 中无法启动 \textsf{gedit}, +因此需要将其替换为 \textsf{vim}, +即 +\begin{lstlisting}[language=bash] + sudo vim /etc/apt/sources.list +\end{lstlisting} +不熟悉 \textsf{vim} 的用户, +可参考 \ref{sec:no-vim}~节. + +接下来, 在主系统中将镜像挂载, +例如挂载到 \texttt{X:\textbackslash}, +而后进入 \textsf{bash} 并执行如下命令 +\begin{lstlisting}[language = bash] + sudo mkdir /mnt/x + sudo mount -t drvfs X: /mnt/x +\end{lstlisting} +如此便可在 \textsf{bash} 中找到挂载的光盘镜像. +之后执行 +\begin{lstlisting}[language = bash] + sudo /mnt/x/install-tl +\end{lstlisting} +进行安装. +在屏幕上应该能见到以下内容 +\begin{lstlisting} + ======================> TeX Live installation procedure <===================== + + ======> Letters/digits in <angle brackets> indicate <======= + ======> menu items for actions or customizations <======= + + Detected platform: GNU/Linux on x86_64 + + <B> set binary platforms: 1 out of 6 + + <S> set installation scheme: scheme-full + + <C> set installation collections: + 40 collections out of 41, disk space required: 6516 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 + [X] after install, set CTAN as source for package updates + + <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 + + Enter command: +\end{lstlisting} +用户直接点击 \keys{I} 使用默认配置安装. +如果用户对于 WSL 比较了解, 可以根据提示, 更改安装设置. +为简化起见, +以下内容均认为用户进行默认安装. +安装完毕后, 需继续在 \textsf{bash} 中执行 +\begin{lstlisting}[language = bash] + sudo umount /mnt/x + sudo rmdir /mnt/x +\end{lstlisting} +弹出已加载的光盘镜像. + +默认安装完成后, 用户需要设置环境变量. +继续在 \textsf{bash} 中执行 +\begin{lstlisting}[language = bash] + vim ~/.bashrc +\end{lstlisting} +在打开的文件末尾添加 +\begin{lstlisting} + # Add TeX Live to the PATH, MANPATH, INFOPATH + export PATH=/usr/local/texlive/2020/bin/x86_64-linux:$PATH + export MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH + export INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH +\end{lstlisting} +并保存退出. +同样, 不熟悉 \textsf{vim} 的用户可参考 \ref{sec:no-vim}~节. +退出 WSL 再进入, 执行 +\begin{lstlisting}[language=bash] + tex -v +\end{lstlisting} +将显示 +\begin{lstlisting} + TeX 3.14159265 (TeX Live 2020) + kpathsea version 6.3.2 + Copyright 2020 D.E. Knuth. + There is NO warranty. Redistribution of this software is + covered by the terms of both the TeX copyright and + the Lesser GNU General Public License. + For more information about these matters, see the file + named COPYING and the TeX source. + Primary author of TeX: D.E. Knuth. +\end{lstlisting} +即为安装成功. + +接下来仿照 Ubuntu 20.04 处理字体. +首先将配置文件复制到系统, +在 \textsf{Terminal} 执行 +\begin{lstlisting}[language=bash] + sudo cp /usr/local/texlive/2020/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf +\end{lstlisting} +然后在 \textsf{Terminal} 执行 +\begin{lstlisting}[language=bash] + sudo fc-cache -fsv +\end{lstlisting} +刷新字体缓存. + +\section{卸载 \TeX{} Live} + +直接删除文件夹即可. +先在 \textsf{bash} 中执行 +\begin{lstlisting}[language = bash] + kpsewhich -var-value TEXMFROOT +\end{lstlisting} +来查询安装路径, +进而通过 \texttt{sudo rm -rf} 进行删除. +默认安装的用户直接运行 +\begin{lstlisting}[language = bash] + sudo rm -rf /usr/local/texlive/2020 + rm -rf ~/.texlive2020 +\end{lstlisting} +当然删除后还要清理掉环境变量. + +\section{跨版本升级 \TeX{} Live} + +WSL 中的方法同 \ref{sec:ubuntu:version}~节. + +\section{升级宏包} + +WSL 中的方法同 \ref{sec:ubuntu:update}~节. + +\section{安装宏包} + +WSL 中的方法同 \ref{sec:ubuntu:installpackage}~节. + +\section{编译文件} + +编译一个最小示例 \texttt{main.tex}. + +在主系统的 \textsf{cmd} 中执行 +\begin{lstlisting}[language=bash] + mkdir D:\work-latex + cd /d D:\work-latex + notepad main.tex +\end{lstlisting} +建立文档, +内容为 +\begin{lstlisting}[language = {[LaTeX]TeX}] + \documentclass{article} + \begin{document} + Hello \LaTeX{} World! + \end{document} +\end{lstlisting} +接下来在 \textsf{cmd} 中执行 +\begin{lstlisting}[language=bash] + bash -i -c "pdflatex main" +\end{lstlisting} +实现编译. + +也可以直接在 WSL 中建立文档并编译, +在 \texttt{bash} 中依次执行 +\begin{lstlisting}[language=bash] + mkdir /mnt/d/work-latex + cd /mnt/d/work-latex + vim main.tex +\end{lstlisting} +建立文档, +内容同上, +然后在 \textsf{bash} 中执行 +\begin{lstlisting}[language=bash] + pdflatex main +\end{lstlisting} +实现编译. + +待编译完成后, 可看到在工作路径中生成了 \texttt{main.pdf} +文件和其他同名的辅助文件 \texttt{main.aux} 与 \texttt{main.log}. +在主系统中可以打开 \texttt{main.pdf} 查看内容. + +对于中文文档, +可以编写以下最小示例% +\footnote{注意使用 UTF-8 编码}% +\begin{lstlisting}[language={[LaTeX]TeX}] + \documentclass[UTF8]{ctexart} + \begin{document} + 你好 \LaTeX{} 世界! + \end{document} +\end{lstlisting} +在 \textsf{cmd} 中执行 +\begin{lstlisting}[language=bash] + bash -i -c "xelatex main" +\end{lstlisting} +或在 \textsf{bash} 中执行 +\begin{lstlisting}[language=bash] + xelatex main +\end{lstlisting} +等待系统完成编译过程. +\texttt{xelatex} 同样可以使用 WSL 内安装的字体% +\footnote{注意主系统中的字体默认不能直接被调用, +如果打算使用主系统中的字体, +见 +\href{https://github.com/OsbertWang/install-latex/issues/14}{github 上的讨论}}, +在 WSL 中安装字体的方法见附录~\ref{chp:appendix:wsl}. + +编译命令可添加参数, 这里与 \ref{sec:windows:compile}~节中的情形一致, 不再赘述. + +\section{尚未圆满解决的问题} + +将 \TeX{} Live 安装至 WSL 仍有悬而未决的问题. +由于 \textsf{bash} 默认是无窗口化的纯命令行, +因此用户无法直接通过命令 \texttt{texdoc} 打开相应的手册. +这里给出几种方法. + +\subsubsection{explorer 浏览} + +先找到手册所在路径, +例如寻找 \texttt{lshort-zh-cn} +\begin{lstlisting}[language=bash] + texdoc -l lshort-zh-cn +\end{lstlisting} +系统会显示 +\begin{lstlisting} + 1 /usr/local/texlive/2020/texmf-dist/doc/latex/lshort-chinese/lshort-zh-cn.pdf + = [zh] The document itself + Enter number of file to view, RET to view 1, anything else to skip: +\end{lstlisting} +这时按其他键 (如 \keys{x}) 退出. +然后分别执行 +\begin{lstlisting}[language=bash] + cd /usr/local/texlive/2020/texmf-dist/doc/latex/lshort-chinese/ + explorer.exe . +\end{lstlisting} +主系统的资源管理器便会打开. +这时用户便可以在主系统中使用 pdf 阅读器打开手册进行阅读. + +\subsubsection{everything 搜索} + +使用 \href{https://www.voidtools.com/zh-cn/}{everything}. +通过 \texttt{texdoc -l} 找到相应文件名, +而后直接搜索. +具体方法这里不再赘述. + +\subsubsection{借助其他工具} + +目前有很多开源的 WSL 辅助程序, +相关讨论见本手册的 \href{https://github.com/OsbertWang/install-latex/issues/13}{issue}. + +\section{不懂 \textsf{vim} 的处理方法}\label{sec:no-vim} + +\textsf{vim} 的使用方法与目前很多流行的编辑器不同, +因此这里给出不用 \textsf{vim} 的处理方法. +该方法借助 \href{https://code.visualstudio.com/}{VS Code} 的 \href{https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl}{Remote-WSL} 插件实现. + +先来更改 \texttt{.bashrc}. +将 \texttt{.bashrc} 备份为 \texttt{.bashrc.bak} +\begin{lstlisting}[language=bash] + cp ~/.bashrc ~/.bashrc.bak +\end{lstlisting} +用 VS Code 打开文档 +\begin{lstlisting}[language=bash] + code ~/.bashrc +\end{lstlisting} +并对其中内容进行更改并保存. +若更改错误, +可以执行 +\begin{lstlisting}[language=bash] + cp ~/.bashrc.bak ~/.bashrc +\end{lstlisting} +恢复文档. + +接下来更改 \texttt{sources.list}. +将 \texttt{sources.list} 备份为 \texttt{sources.list.bak} +\begin{lstlisting}[language=bash] + sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak +\end{lstlisting} +用 VS Code 打开文档 +\begin{lstlisting}[language=bash] + code /etc/apt/sources.list +\end{lstlisting} +并对其中内容进行更改, +并且另存为 +\begin{lstlisting} + ~/sources.list.sav +\end{lstlisting} +在 \textsf{bash} 中执行 +\begin{lstlisting}[language=bash] + sudo cp ~/sources.list.sav /etc/apt/sources.list +\end{lstlisting} +替换文档. +若发现文档有错误, +执行 +\begin{lstlisting}[language=bash] + sudo cp /etc/apt/sources.list.bak /etc/apt/sources.list +\end{lstlisting} +恢复文档. + +使用 VS Code 同样可以编写 \texttt{tex} 文件, +这涉及到如何使用 \LaTeX{} 的编辑器, +这里不做展开.
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/install-latex-guide-zh-cn.pdf b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/install-latex-guide-zh-cn.pdf Binary files differnew file mode 100644 index 00000000000..f7f13da4d7a --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/install-latex-guide-zh-cn.pdf diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/install-latex-guide-zh-cn.tex b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/install-latex-guide-zh-cn.tex new file mode 100644 index 00000000000..8afc83ae524 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/install-latex-guide-zh-cn.tex @@ -0,0 +1,114 @@ +\documentclass[fontset=fandol]{ctexrep} +\usepackage{accsupp} +\usepackage[margin=2.4cm]{geometry} +\usepackage{listings} +\usepackage{xcolor} +\usepackage{fontawesome5} +\usepackage[pdfpagelayout=SinglePage]{hyperref} +\usepackage[os=win,hyperrefcolorlinks]{menukeys} + +\ctexset{ + chapter = { + format = \huge\bfseries\raggedright, + number = \arabic{chapter}, + name = {}, + }, + section/format = \Large\bfseries\raggedright, +} + +\lstset{ + backgroundcolor = \color{lightgray!30}, + keywordstyle = \color{blue}, + stringstyle = \color{brown}, + basicstyle = {\small\ttfamily}, + breaklines = true, + tabsize = 4, + gobble = 2, + numbers = left, + numberstyle = \tiny\emptyaccsupp, + frame = single, + xleftmargin = \ccwd, + numbersep = \ccwd, + columns = fullflexible, +% emphstyle = {\color{blue}\small\ttfamily}, +% emph = {mkdir,rmdir,sudo,mount,umount,rm}, +} + +\newcommand\emptyaccsupp[1]{% + \BeginAccSupp{ActualText={}}#1\EndAccSupp{}% +} + +\renewmenumacro{\menu}[>]{angularmenus} +\renewmenumacro{\keys}[+]{shadowedroundedkeys} + +\title{\bfseries 一份简短的关于 \LaTeX{} 安装的介绍% + \thanks{\url{https://github.com/OsbertWang/install-latex}}% +} +\author{王然% + \thanks{\href{mailto:ranwang.osbert@outlook.com}% + {\ttfamily ranwang.osbert@outlook.com}}% +} +\date{\today} + +\usepackage{booktabs} +\usepackage{tikz} +\usetikzlibrary{shapes.geometric, calc} + +\tikzset{ + score stars/.style={ + % shape + star, star points=5, star point ratio=2.25, scale=0.8, + % color + draw=gray, fill=#1, + % others + inner sep=0.14em, anchor=outer point 3 + } +} + +\newcommand\stars[1]{% + \begin{tikzpicture} + % Draw five stars. For #1 = "2.3", fill the 1st and 2nd stars as gray, + % and fill the 3rd to 5th stars as white. + \foreach \i in {1, ..., 5} { + \pgfmathsetmacro\starcolor{\i<=#1 ? "gray" : "white"} + \node[score stars=\starcolor] (star\i) at (\i*0.8em, 0) {}; + } + % For #1 = "2.3", let \partstar = "3" and \starpart = "0.3". + % Then fill the left 30% part of the 3rd star as gray after clipping. + \pgfmathsetmacro\partstar{#1>int(#1) ? int(#1+1) : 0} + \ifnum\partstar>0 + \pgfmathsetmacro\starpart{#1-(int(#1))} + \coordinate (upper left) + at (star\partstar.outer point 2 |- star\partstar.outer point 1); + \coordinate (upper right) + at (star\partstar.outer point 5 |- star\partstar.outer point 1); + \coordinate (lower right) + at (star\partstar.outer point 5 |- star\partstar.outer point 4); + \clip (upper left) rectangle + ({$ (upper left)!\starpart!(upper right) $} |- lower right); + \node[score stars=gray] at (\partstar*0.8em, 0) {}; + \fi + \end{tikzpicture}% +} + +\begin{document} + +\maketitle +\include{./chapter/preface} + +\tableofcontents + +\include{./chapter/windows} +\include{./chapter/ubuntu} +\include{./chapter/macos} +\include{./chapter/wsl} +\include{./chapter/editor} +\include{./chapter/overleaf} + +\appendix +\include{./appendix/mirror} +\include{./appendix/wsladdition} +\include{./appendix/offline} +\include{./appendix/updateinfo} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/make.bat b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/make.bat new file mode 100755 index 00000000000..1352efe01cd --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/make.bat @@ -0,0 +1,21 @@ +@echo off
+cd %~dp0
+set INSTALLLATEX=install-latex-guide-zh-cn
+set PDF=%INSTALLLATEX%.pdf
+set TEMP=%INSTALLLATEX%.xdv %INSTALLLATEX%.aux %INSTALLLATEX%.log %INSTALLLATEX%.toc %INSTALLLATEX%.out %INSTALLLATEX%.synctex.gz ^
+ .\appendix\*.aux .\chapter\*.aux
+
+if "%1"=="clean" goto clean
+
+set TEX=xelatex
+set MODE=-synctex=1
+set NOPDFMODE=-synctex=1 --no-pdf
+
+%TEX% %NOPDFMODE% %INSTALLLATEX%
+%TEX% %MODE% %INSTALLLATEX%
+exit /B
+
+:clean
+del %TEMP%
+del %PDF%
+exit /B
diff --git a/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/makefile b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/makefile new file mode 100644 index 00000000000..8d5129e6859 --- /dev/null +++ b/Master/texmf-dist/doc/latex/install-latex-guide-zh-cn/makefile @@ -0,0 +1,20 @@ +INSTALLLATEX = install-latex-guide-zh-cn +PDF = $(INSTALLLATEX).pdf +REQUIRE = $(INSTALLLATEX).tex $(wildcard ./chapter/*.tex) $(wildcard ./appendix/*.tex) +TEMP = $(INSTALLLATEX).xdv $(INSTALLLATEX).aux $(INSTALLLATEX).log $(INSTALLLATEX).toc $(INSTALLLATEX).out $(INSTALLLATEX).synctex.gz \ + $(wildcard ./chapter/*.aux) $(wildcard ./appendix/*.aux) + +TEX = xelatex +MODE = -synctex=1 +NOPDFMODE = -synctex=1 --no-pdf + +all: $(PDF) + +$(PDF): $(REQUIRE) + $(TEX) $(NOPDFMODE) $(INSTALLLATEX) + $(TEX) $(MODE) $(INSTALLLATEX) + +clean: + rm $(PDF) $(TEMP) + +.PHONY: all clean
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 0c24eeaf0c1..b45b97d836f 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -386,7 +386,7 @@ my @TLP_working = qw( imfellenglish impnattypo import imsproc imtekda incgraph includernw inconsolata index indextools infwarerr initials inkpaper inline-images inlinebib inlinedef - inputenx inputtrc inriafonts insbox install-latex installfont + inputenx inputtrc inriafonts insbox install-latex-guide-zh-cn installfont intcalc interactiveworkbook interchar interfaces interpreter interval intopdf intro-scientific diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index c3a5e0529ca..114666fd34a 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -2634,7 +2634,7 @@ $standardsource = '(\.(bat|c|drv|dtx|fea|fdd|ins|sfd)' 'hyphenex', '.', # everything 'impatient', 'NULL', # doc package 'impatient-fr', 'NULL', # doc package - 'install-latex', 'NULL', # doc package + 'install-latex-guide-zh-cn','NULL', # doc package 'intro-scientific', 'NULL', # doc package 'js-misc', 'NULL', # no gain in splitting up 'kpfonts', '\.zip', diff --git a/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc b/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc index e045668386e..03b4e743453 100644 --- a/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-langchinese.tlpsrc @@ -16,6 +16,7 @@ depend fandol depend fduthesis depend hyphen-chinese depend impatient-cn +depend install-latex-guide-zh-cn depend latex-notes-zh-cn depend lshort-chinese depend nanicolle diff --git a/Master/tlpkg/tlpsrc/install-latex-guide-zh-cn.tlpsrc b/Master/tlpkg/tlpsrc/install-latex-guide-zh-cn.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/install-latex-guide-zh-cn.tlpsrc |