- 以下是本人的快捷使用方法。
在线latex编辑
在线latex不需要配置任何环境,导入压缩包直接使用。但是会出现偶尔掉线,经常重新连接。
- 国外overleaf(缺点是限速,有时候进不去)
- 国内overleaf(可以随时访问,邮箱注册即可使用)上面有在线的模板可以直接入门练习 了解结构
做好的表格快速转latex(tablesgenerator)
-
在线转换表格为latex code,无需下载 。最大支持500行20列的表格
-
可导入CSV文件,也可直接粘贴数
-
可自定义表格框线、字体、颜色、居中排列等等 界面简洁,操作方便,速度快
-
未标注箭头的框 有2个选择 一个是给第一行和最后一行加粗 另外一个是粗细一样
-
如果想跨栏 占据 在table后面加* 即table*
公式快速转latex(Mathpix)
- Mathpix 自行安装,可以直接截图、手写公式等一系列转化为latex代码
- Latexlive
写好的公式直接转Latex
算法伪代码模板
- 使用之前先导入对应的包
%这种形式需要在前面 导入包(第二代)
\usepackage{algorithm}
\usepackage{algpseudocode}
%或者替换为\usepackage{algorithmic},就是第一代了,
%但是关键字全部是大写形式,比如 \State 改为 \STATE
%将官方的 require 和 ensure 关键字换成我们常用的 input 和 output
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
%排版代码为
\begin{algorithm}[h]
\caption{Gradient substitution MI-FGSM($GSMI-FGSM$)}
\label{alg::conjugateGradient}
\begin{algorithmic}[1]
\Require
Real-time task set $S_H$
\Require
Real-time task set $S_H$
\Require
Real-time task set $S_H$
\Require
Real-time task set $S_H$
\Ensure
The schedulability of $S_H$
\State $D=0$;
\For {${\tau _i}:{S_H}$} %For循环结构
\State $D = D+C_i/D_i$;
\EndFor
\If {$D > n$}
\State return false;
\Else
\State return true;
\EndIf
\end{algorithmic}
\end{algorithm}
- 输出结果如下:
- 模板2
%将官方的 require 和 ensure 关键字换成我们常用的 input 和 output
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
%排版代码为
\begin{algorithm}[h]
\caption{Gradient substitution MI-FGSM($GSMI-FGSM$)}
\label{alg::conjugateGradient}
\begin{algorithmic}[1]
\Require $A$ classifier $f$ with parameters $\theta$ , loss function $J$
\Require A raw example $x$ with ground-truth label $y$
\Require The magnitude of perturbation $\varepsilon $; number of iteration $T$ and decay factor$\mu $
\Require The factor $\beta $ for the upper bound of neighborhood
and number of example $N$ for variance tuning
\Ensure An adversarial example $x^{adv} $
\State $\alpha=\epsilon / T$
\State $g_0=0 ; G_0=0 ; x_0^{a d v}=x$
\For {$t=0 \rightarrow T-1$} %For循环结构
\State Calculate the gradient $\hat{g}_{t+1}=\nabla_{x_{t}^{a d v}} J\left(x_{t}^{a d v}, y ; \theta\right)$
\State Update ${g}_{t+1}$ by gradient substitution based momentum
\begin{equation}
\label{m_g}
g_{t+1}=\mu \cdot g_{t}+\frac{\hat{g}_{t+1}+v_{t}}{\left\|\hat{g}_{t+1}+v_{t}\right\|_{1}}
\end{equation}
\State Update ${G}_{t+1}$ by sampling $N $examples in the neighborhood of $x$:
\begin{equation}
\label{m_g}
G(x)=\frac{1}{N-2}\left(\sum_{i=1}^{N} \nabla_{x^{i}} J\left(x^{i}, y ; \theta\right)-\nabla_{x^{i}} J\left(x^{i}, y ; \theta\right)_{\max }-\nabla_{x^{i}} J\left(x^{i}, y ; \theta\right)_{\min }\right)
\end{equation}
\State Update $x_{t+1}^{a d v}$ by applying the sign of gradient
\begin{equation}
\label{m_g}
x_{t+1}^{a d v}=\operatorname{Clip}_{x}^{\epsilon}\left\{x_{t}^{a d v}+\alpha \cdot \operatorname{sign}\left(g_{t+1}\right)\right\}
\end{equation}
\EndFor
\If {$D > n$}
\State return false;
\Else
\State return true;
\EndIf
\end{algorithmic}
\end{algorithm}