LatexPractice
TexLive
通过图形化界面安装Tex Live
wget -c https://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip
unzip install-tl.zip
cd到解压目录
note: 该图形化界面可以选择镜像源
sudo ./install-tl -gui
添加环境变量
配置latex环境
export MANPATH=${MAT_PATH}:"/usr/local/texlive/2022/texmf-dist/doc/man"
export INFOPATH=${INFOPATH}:"/usr/local/texlive/2022/texmf-dist/doc/info"
export PATH=${PATH}:"/usr/local/texlive/2022/bin/x86_64-linux"
备注
注意避免同时apt安装texlive,否则会有版本冲突问题,导致某些包无法找到
WorkFlow
生成aux文件
pdflatex <file.tex>
指定编译产物导出的路径(需要该文件夹已创建 / 文件名需要放在命令行option的后面)
pdflatex -output-directory=build template.tex
aux文件包含了latex文件(.tex)的cite等argument和相关的元信息(比如tex文件需要哪些参考文献,这些参考文献,latex文件中的顺序,导入参考文献的参考位置)
tex中的文献索引暂时用
?
来替代(reference will show?
for now)

生成bbl文件
bibtex根据aux的元信息,从bib文件中提取相关的参考文献并进行格式化,生成bbl文件
可加可不加.aux后缀
bibtex <file>
相关日志信息可参考.blg文件
编译诊断顺序,可参考details
增加reference
pdflatex -output-directory=build template.tex
增加citation
pdflatex -output-directory=build template.tex
CompileTool
Biber
安装(TexLive安装了即有Biber)

Latexmk
查看编译选项
latexmk -h
latexmk -showextraoptions
Grammar
公式对齐
\begin{aligned}
a + b + c &= d \
e + f &= g
\end{aligned}
公式编号
% 注意加*在equation后不生成公式编号
\begin{equation}
a+b=\gamma\label{eq}
\end{equation}
图片插入
% 需要特定格式的图片,不是所有图片格式都能用
% width项用于调整图片大小
\begin{figure}[htbp]
\includegraphics[width=7cm]{elbow_robot_arm.png}
\caption{肘型机械臂}
\end{figure}
% 触发单栏
\begin{figure*}[htbp]
\centerline{\includegraphics[width=1.0\textwidth]{可相对路径}}
\caption{...}\label{...}
\end{figure*}
文本颜色
\usepackage{xcolor}
\begin{document}
This is a sample text in black.
\textcolor{blue}{This is a sample text in blue.}
\end{document}
文本居中
\centerline{$r=x_4^2+y_4^2$}
字体大小
字体类型
表格
chktex标准倾向于在表格中不添加竖线
\begin{table}[htb]
\centering
\caption{This is a table caption}\label{tab:ref}
\begin{tabular}{llllllll}
\toprule
Tag type & NDEF & Secure messaging & SDM & Random ID & Digital Sig. & Authentication & Memory access protection \\
\midrule
NT4H2421Gx & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark \\
NTAG21x & \checkmark & & & & \checkmark & & \checkmark \\
NTAG210 & & & & & \checkmark & & \\
\bottomrule
\end{tabular}
\end{table}
构建引用
\bibliographystyle{IEEEtran}
\bibliography{<.bst文件名>}
IDE
Jetbrain
Textify
for Jetbrain; 使用内置pdf需要再下一个pdf viewer插件
特性
实战
Texstudio
Vscode
LaTeX Workshop
Chktex
语法检查工具;安装tex live后自带

Delete this space to maintain correct pagereferences.
\caption{Eg} \label{fig:eg} % wrong
\caption{Eg}\label{fig:eg} % true
格式化
安装tex live后自带,ctrl+shirt+I触发
Code Spell Checker
词汇补全和正确性校验
LTeX
latex/ markdown的文本语法检查器
同步pdf和latex文本的位置
根据pdf定位到latex的位置:ctrl+点击pdf某个位置
根据latex位置定位到pdf的位置:命令行SyncTeX
Practice
IEEE中文模板
Incompatible Problem
Option clash error
IEEE
关键词
\begin{IEEEkeywords}
Dynamic trajectory planning, MPC, obstacle avoidance.
\end{IEEEkeywords}
贡献分段
\begin{enumerate}
\item ...
\item ...
\end{enumerate}
Package
导入svg文件
前提:安装inkscape
sudo add-apt-repository ppa:inkscape.dev/stable
sudo apt update
sudo apt install inkscape
\documentclass{article}
\usepackage{svg}
\begin{document}
\begin{figure}
\centering
\includesvg[width=0.6\columnwidth](<...>.svg)
\end{figure}
\end{document}
插入pdf文件
\documentclass[a4paper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages={1,2}]{example.pdf}
\end{document}
伪代码库
\usepackage{algorithm} % http://ctan.org/pkg/algorithms
\usepackage{algpseudocode} % http://ctan.org/pkg/algorithmicx
文本高亮
\usepackage{soul}
\hl{...}
Plugin
CTEX
支持中文的拓展插件
格式化
latexindent
latexindent a.tex -o b.tex