LATEX常用语法

来源:互联网 发布:电脑画图软件 编辑:程序博客网 时间:2024/06/06 01:16

1、多行公式编辑,编号居中:

\begin{equation}\label{eqn:1}\begin{split}\min_{\substack{X}} loss(X)+\alpha R(X),\end{split}\end{equation}\begin{equation}\begin{split}&\min_{\substack{\beta}} \|\beta\|_0 \\ &s.t. X \beta = y \label{eq2}.\end{split}\end{equation}

2、范数:

\|\beta\|_1:β-1范数。

3、上标和下标:

R^{n \times m}:上标。\|\beta\|_1:下标。

4、论文句子间插入公式或者表达式

$n \ll m$:n << m。

5、公式的引用:

\label{eq3}(\ref{eq3})

6、在运算符下添加表达式:

\begin{equation}   \sum_{\substack{k_0,k_1,\dots>0 \\ k_0+k_1+\dots=n}} F(k_i)\end{equation}

7、表格:

\begin{table}[htbp]\caption{Table Type Styles}\begin{center}\begin{tabular}{|c|c|c|c|}\hline\textbf{Table}&\multicolumn{3}{|c|}{\textbf{Table Column Head}} \\\cline{2-4}\textbf{Head} & \textbf{\textit{Table column subhead}}& \textbf{\textit{Subhead}}& \textbf{\textit{Subhead}} \\\hlinecopy& More table copy$^{\mathrm{a}}$& &  \\\hline\multicolumn{4}{l}{$^{\mathrm{a}}$Sample of a Table footnote.}\end{tabular}\label{tab1}\end{center}\end{table}

8、插入图片:

\begin{figure}[htbp]\centerline{\includegraphics{fig1.png}}\caption{Example of a figure caption.}\label{fig}\end{figure}

9、在指定位置插入图片(有时候图片会在最上方):

\usepackage{float}\usepackage{graphix}\begin {figure}[H]\centering\includegraphics[width=7cm]{endpoint.eps}\caption{Endpoint detection}\end {figure}

10、列表:

(无序):\begin{itemize}\item \item \item \end{itemize}(有序):\begin{enumerate}  \item javascript  \item html  \item css\end{enumerate}

11、居中:

(1)\begin{center}  pid = fork()    \end{center}(2)\centering

12、换行与换页:

\par:用在需要换行的内容前面,将之后的内容进行换行操作。\\:用在每一行的末尾,之后的内容便会出现在新的一行。\newpage:换页。

13、分式:

\frac{1}{2

14、各种求和:

(1)上下位置,独立公式情形:\begin{equation*}p = \sum_{n=1}^Na_n\end{equation*}(2)行间公式情形:\begin{equation*}p = \sum_{n=1}^Na_n\end{equation*}通过\limits\nolimits可以改变缺省值。其中行间公式缺省使用\nolimits 而独立公式缺省使用\limits。如果要改变缺省规则,就要在符号后面、上下限之前加入上面的两个命令。(3)比如在独立公式前加\nolimits限制,如下所示:\begin{equation*}p = \sum\nolimits_{n=1}^Na_n\end{equation*}(4)在行间前加\limits限制,如下所示:$p = \sum\limits_{n=1}^Na_n$

15、伪代码流程图:

\begin{algorithm}[h]\renewcommand{\algorithmicrequire}{\textbf{Input:}}\renewcommand\algorithmicensure {\textbf{Output:} }  \caption{Multiplicative Update Rule for NMF}\label{alg::NMF}\begin{algorithmic}[1]\REQUIRE   $V$: decomposed matrix;  $MaxIter$: the number of iterations;\ENSURE   $W,H$\STATE initial W and H non negative;\FOR{$i=1:MaxIter$}  \STATE Update row elements of the H matrix $H_{[i,j]} \leftarrow H_{[i,j]}\frac{(W^TV)_{[i,j]}}{(W^TWH)_{[i,j]}}$;  \STATE Update column elements of the W matrix $W_{[i,j]} \leftarrow W_{[i,j]}\frac{(VH^T)_{[i,j]}}{(WHH^T)_{[i,j]}}$;  \IF { W and H are stable}    \STATE $end$;  \ENDIF\ENDFOR\end{algorithmic}\end{algorithm}  

16、把下标放置到正下方:

如果是数学符号,那么直接用\limits命令放在正下方,如:$ \sum\limits_{i=1} $若是普通符号,那么要用\mathop先转成数学符号再用\limits,如:$ \mathop{a}\limits_{i=1} $
原创粉丝点击