diff options
Diffstat (limited to 'info/install-latex-guide-zh-cn/chapter/editor.tex')
-rw-r--r-- | info/install-latex-guide-zh-cn/chapter/editor.tex | 144 |
1 files changed, 91 insertions, 53 deletions
diff --git a/info/install-latex-guide-zh-cn/chapter/editor.tex b/info/install-latex-guide-zh-cn/chapter/editor.tex index 41febd5d44..6883681938 100644 --- a/info/install-latex-guide-zh-cn/chapter/editor.tex +++ b/info/install-latex-guide-zh-cn/chapter/editor.tex @@ -2,7 +2,7 @@ \chapter{使用编辑器} -\section{Windows 10 系统} +\section{Windows 11 系统} 在实际操作中, 用户会发觉使用记事本编写 \texttt{tex} 文件十分不便, 因此很多用户都将其他编辑器作为自己的首选. @@ -44,8 +44,8 @@ 让用户误以为是乱码. 用户可在 \menu{编辑 > 首选项 > 编辑器默认配置} 和 \menu{格式 > 字体} 处进行更改. -Windows 10 中字体列表见% -\href{https://docs.microsoft.com/en-us/typography/fonts/windows_10_font_list}{这里}. +Windows 11 中字体列表见% +\href{https://docs.microsoft.com/en-us/typography/fonts/windows_11_font_list}{这里}. \subsubsection{自动补全} @@ -180,10 +180,6 @@ Windows 10 中字体列表见% 在使用 \TeX studio 前, 用户一定要查询\textbf{环境变量}中是否有 \texttt{system32}. 具体方法在前面已有说明, 此处不再赘述. -此外, -根据 \href{https://github.com/texstudio-org/texstudio/issues/1773}{Github 上的讨论}, -Windows 10 21H1 (64bit) 上 \TeX studio Qt6 版本存在一些问题, -因此目前推荐使用 Qt5 版本. 以下有关 \TeX studio 的用法介绍, 还请用户提前在 \menu{Options > configure TeXstudio} 中勾选 \menu{Show Advanced Options}. @@ -409,7 +405,7 @@ Windows 10 21H1 (64bit) 上 \TeX studio Qt6 版本存在一些问题, 至此完成了逆向搜索, 双击 PDF 文件便可回到 \TeX studio 中对应代码的行首. -\section{Ubuntu 20.04 系统} +\section{Ubuntu 22.04 系统} 简化起见, 这里只介绍如何使用 \TeX studio. 根据官网推荐, 我们安装源内的 \TeX studio. @@ -453,7 +449,7 @@ Windows 10 21H1 (64bit) 上 \TeX studio Qt6 版本存在一些问题, \end{lstlisting} 即完成换源. 有时地址太多而逐个换太麻烦, -可以直接使用如下命令直接替换\footnote{参见 \url{https://mogeko.me/2018/035/}} +可以直接使用如下命令直接替换\footnote{参见 \url{https://mogeko.me/posts/zh-cn/035/}} \begin{lstlisting}[language = bash] sudo find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i.bak -r 's#deb(-src)?\s*http(s)?://ppa.launchpad.net#deb\1 https\2://launchpad.proxy.ustclug.org#ig' {} \; \end{lstlisting} @@ -513,57 +509,99 @@ Mac\TeX{} 自带 \TeX Shop 编辑器 (注意不要与其他自带的程序混淆 具体解决方法见% \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{这里省略了中间路径, 用户根据自己的情形进行补充即可} +\section{Windows Subsystem for Linux}\label{sec:editor:wsl} + +目前建议使用 +\href{https://code.visualstudio.com/}{VS Code} +配合 +\href{https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl}{WSL} +和 +\href{https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop}{\LaTeX{} Workshop} +来编写文档. +具体设置方式建议阅读插件手册, +一些网友的教程可以参考, +如 +\href{https://github.com/EthanDeng/vscode-latex}{EthanDeng 的教程}. +以下配置为个人自用, +仅供参考, +其中注释的部分是调用外部 SumatraPDF 阅读器的配置, +用户可参考 +\href{https://github.com/OsbertWang/latex-editor-sumatrapdf}{latex-editor-sumatrapdf} +来了解更多内容. + \begin{lstlisting} - "C:\Windows\WinSxS\...\bash.exe" -i -c "latexmk -xelatex -synctex=1 -interaction=nonstopmode -halt-on-error -file-line-error ?me)" + "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", + "-xelatex", + "%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} -点击 \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, -这里不讨论此方案的优劣. +实际配置时, +用户需要结合自身安装情况更换 \texttt{<SumatraPDFROOT>} 和 \texttt{<VSCodeROOT>}, +即 SumatraPDF 和 VS Code 各自的安装路径. \section{其他编辑器} -\href{https://code.visualstudio.com/}{VS Code} 目前已有插件 +在 \ref{sec:editor:wsl} 中介绍的 +\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}. +支持 \LaTeX 编译. +用户可以根据自己的实际需求、使用习惯和个人能力, +自行决定是否使用. \href{https://www.vim.org/}{Vim} 是一款优秀的编辑器, 它的用法较目前常见的编辑器有很大不同, |