配置wsl和latex使用
本文最后更新于:8 个月前
wsl
事实上配置wsl按照这个来最好https://docs.microsoft.com/en-us/windows/wsl
###配置账号
microsof的文档会提供不同版本的Ubuntu来使用,直接用是最方便快捷的. 下好Ubuntu后配置账号信息,这里本来我懒得设密码,不过不设密码是不行的,请设一个简单的密码,因为会经常需要输入.这里补充一个修改密码的方法:"Open PowerShell and enter the root of your default WSL distribution using the command: wsl -u root.If you need to update the forgotten password on a distribution that is not your default, use the command: wsl -d Debian -u root, replacing Debian with the name of your targeted distribution."不过我不是说了选简单的密码吗,怎么还会忘…
###注意长更新
我今天遇到了一个因为没更新sources.list全都失效结果无法下载软件的问题.可以通过下面两条命令来直接手动改,至于改成什么,找镜像站吧.
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
sudo emacs(vim) /etc/apt/sources.list
或者直接sudo apt update && sudo apt upgrade
话说这两个不确定,总之如果出现sudo apt install时出现404Not Found等问题可以第一种是可行的,不过最好试试第二种
file storage
liunx:
\wsl$<DistroName>\home<UserName>\Project
windows:
mnt/c/Users/
通常来讲你用那个系统的工具就放在哪里最快.
starting directory
建议看官方原文
latex语法
$…$ ...
就是latex语言. $$…$$ 作用为$…$加上新开一行并置中.
注意...
是不能有汉语的,那么如果想在一串latex语言中插入汉字呢? 可以用\mbox{…} ...
表示汉字. 注意mbox会将花括号内容强制用文本模式输出,因此常常会导致排版问题.
\frac{}{} 分号
\leq 小于等于号
… 这些语法随便搜一下就有了
\verb 用纯文本形式输出,写代码的时候,用lstlisting的效果很差劲.
\begin{verbatim}
\end{verbatim}
文献引用
编译main.tex文件的步骤,具体环境下的实现可能有所差异,可参考链接
xelatex main
bibtex main
xelatex main
xelatex main
参考资料:https://www.overleaf.com/learn/latex/Bibliography_management_with_bibtex#Bibliography:just_a_list_of.5Cbibitems
超链接
usepackage{hyperref},注意该package通常最后一个添加
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
参考资料:https://www.overleaf.com/learn/latex/Hyperlinks#Introduction
参考文献
默认采用IEEEtrran格式,该格式能自动按照引用顺序排序,并且各个文献的fields也会自动排序,相当于不需要考虑顺序问题,实现一辈子一个bib文件.
\cite{
\bibliographystyle{IEEEtran}
\bibliography{<bib文件名,无需拓展名>}
gnuplot的使用
使用gnuplot picture.gp来得到picture.tex文件. picture.gp的格式参考
set terminal latex
set output “picture.tex”
更多细节可以参考文章《LATEX and the Gnuplot Plotting Program》
通过\input{picture}导入目标tex文件可以实现目标.
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!