latex常用技巧总结

关于使用latex的一些小总结

常用的在线latex

  • relatex
  • overleaf

    sharelatex在2018年的后面阶段会和overleaf合并,构成overleaf v2版本!!!!


常用的latex排版

图片排版

\usepackage{subfig}
\usepackage{float}
\usepackage{graphicx}

\begin{figure}[htbp]%[h], [t], [b] or [p] - here, top, bottom and on a separate page, respectively
    \centering
    \begin{minipage}[t]{0.25\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
        \centering
        \includegraphics[width=2cm]{figures/figure1/0.png}
        \caption*{(a)}%加*可以去掉默认前缀,作为图片单独的说明
        \label{fig1_a}
    \end{minipage}
    \begin{minipage}[t]{0.25\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
        \centering
        \includegraphics[width=2cm]{figures/figure1/1.png}
        \caption*{(b)}%加*可以去掉默认前缀,作为图片单独的说明
        \label{fig1_b}
    \end{minipage}
    \begin{minipage}[t]{0.25\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
        \centering
        \includegraphics[width=2cm]{figures/figure1/2.png}
        \caption*{(c)}%加*可以去掉默认前缀,作为图片单独的说明
        \label{fig1_d}
    \end{minipage}
    \\
    \begin{minipage}[t]{0.25\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
        \centering
        \includegraphics[width=2cm]{figures/figure1/3.png}
        \caption*{(d)}%加*可以去掉默认前缀,作为图片单独的说明
        \label{fig1_e}
    \end{minipage}
    \begin{minipage}[t]{0.25\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
        \centering
        \includegraphics[width=2cm]{figures/figure1/4.png}
        \caption*{(e)}%加*可以去掉默认前缀,作为图片单独的说明
        \label{fig1_f}
    \end{minipage}
    \begin{minipage}[t]{0.25\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
        \centering
        \includegraphics[width=2cm]{figures/figure1/5.png}
        \caption*{(f)}%加*可以去掉默认前缀,作为图片单独的说明
        \label{fig_h}
    \end{minipage}
    \caption{Your caption here}% 此处添加的caption内容表示整张图片的标注信息
    \label{fig1}
\end{figure} 

表格使用

% \\代表换行, &代表对齐

\begin{table}[!htbp] % [h], [t], [b] or [p] - here, top, bottom and on a separate page, respectively
\small	%设置字体大小
\begin{tabular}{c c c}	%设置表格列数和排列方式:c:center, l:left, r:right
\toprule % 上方水平线
& \multicolumn{2}{c}{Metrics} \\ \cmidrule(l){2-3} % 合并多列
Params & P & S\\ % Column names row
\midrule % 表格内部水平线
W16\_D2\_B6 & 1	& 1\\ % 内容 row 1
W16\_D3\_B6 & 2	& 2\\ % 内容 row 2
W16\_D4\_B6 & 3	& 3\\ % 内容 row 3
W16\_D2\_B8 & 4	& 4\\ % 内容 row 4
W16\_D2\_B10 & 5 & 5\\ % 内容 row 5
W16\_D2\_B12 & 6 & 6\\ % 内容 row 7
W32\_D2\_B6 & 6	& 6\\ % 内容 row 8
W64\_D2\_B6 & {\color{red}7} & {\color{red}7}\\ % 内容 row 9
\bottomrule % Bottom horizontal line
\end{tabular}
\caption{Your caption here.}% 表格标注信息
\label{table1}
\end{table}

加入链接

\usagepackage{hyperref}

\url{link here}

使用公式

\usagepackage{amsmath}

\begin{equation}
	you equation here                 % 写数学公式
	\label{unique label here}         % 为公式构建唯一标签,方便引用
\end{equation}

latex双栏和单栏排版

使用latex模板的时候经常看见有两种排版模式,一种是双栏排版,另外一种是但栏排版,但是在插图的时候,我们很经长需要在双栏排版的情况下添加单栏目排版的效果,可以使用如下操作:

% 一般的插图排版
\begin{figure}
\end{figure}

% 插图的双栏目排版下的单栏目(占据整个page的宽度的排版方式)
\begin{figure*}		% 只需要在标签的末尾添加*符号就可以使用在双栏目排版下的图片单栏目排版
\end{figure*}

文本加粗和变换颜色

\usagepackage{color}
{\color{red}text}       % red可以替换成其他任意颜色,text换成你想要的文本内容
\textbf{text}           % text换成你想要的文本内容

latex链接

猜你喜欢

转载自blog.csdn.net/nnUyi/article/details/81059622