ubuntu vscode latex 中外语言支持

中文字体支持

ubuntu中文字体需要从windows的字体库中拷过来,或者网上下载
以下仅介绍中文字体,其他类似

1.创建字体目录

ubuntu的字体存放在 /usr/share/fonts/ 目录下

$ sudo mkdir -p /usr/share/fonts/windows

2.拷贝windows字体文件

windows字体文件存放在C:\windows\Fonts 目录下,可以临时拷到U盘,然后复制到ubuntu

$ sudo cp ~/path/to/fonts /usr/share/fonts/winFonts/

3.安装字体

$ cd /usr/share/fonts/windows
$ sudo mkfontscale  #(创建字体的fonts.scale文件,它用来控制字体旋转缩放)
$ sudo mkfontdir  #(创建字体的fonts.dir文件,它用来控制字体粗斜体产生)
$ sudo fc-cache -fv  #(建立字体缓存信息,也就是让系统认识字体)

4.修改字体(可选)

$ sudo apt-get install unity-tweak-tool
$ unity-tweak-tool # 打开后在Fonts中修改

ubuntu vscode latex

1.ubuntu安装latex

$ sudo apt-get install texlive-xetex

其他参考Here

2.vscode配置latex

vscode extensions搜索 latex ,安装 latex workshop 扩展包
选择 File->Preferences->Settings搜索 latex,用下面的配置替换右侧的配置:

{
  "latex-workshop.latex.toolchain": [ { "command": "xelatex","args": [ "%DOC%" ] } ] }

Example

\documentclass{article}
\usepackage[a4paper,left=1in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{xeCJK} %调用 xeCJK 宏包
\setCJKmainfont{Simsun} %设置 CJK 主字体为 Simsun (宋体)

\begin{document}

\tableofcontents

\begin{abstract}
这是在文件的开头的介绍文字.本文的主要话题的简短说明.
\end{abstract}

\section{ 前言 }
在该第一部分中的一些额外的元素可以被添加。巴贝尔包将采取的翻译服务.

\section{关于数学部分}
在本节中的一些数学会使用数学模型含中文字符显示。

\end{document}

由上可知只需要加两行就可以正常显示中文了:

\usepackage{xeCJK} %调用 xeCJK 宏包
\setCJKmainfont{Simsun} %设置 CJK 主字体为 Simsun (宋体)

References

latex简单介绍: https://liam0205.me/2014/09/08/latex-introduction/
latex详细参考sharelatex文档: https://www.sharelatex.com/learn

相关文章

目录前言一、创建Hadoop用户二、更新apt和安装Vim编辑器三、...
原文连接:https://www.cnblogs.com/yasmi/p/5192694.html ...
电脑重启后,打开VirtualBox,发现一直用的虚拟机莫名的消失...
参见:https://blog.csdn.net/weixin_38883338/article/deta...
Ubuntu 18.04 LTS 已切换到 Netplan 来配置网络接口。Netpla...
介绍每个 Web 服务都可以通过特定的 URL 在 Internet 上访问...