Latex常用
2019-02-22 本文已影响0人
微雨旧时歌丶
-
基本包
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{listings}
\usepackage{pythonhighlight}
\usepackage{xcolor}
- 加图片
\begin{figure}[h]%%图
\centering %插入的图片居中表示
\includegraphics[width=0.8\linewidth, trim=0 0 0 0,clip]{flowchart} %插入的图,包括JPG,PNG,PDF,EPS等,放在源文件目录下
\caption{Schematic diagram of query answering} %图片的名称
\label{fig:flow} %标签,用作引用
\end{figure}
- 双图片
\begin{figure*}[h]
\centering
\subfigure[Station numbers of different countries]{\includegraphics[width=0.48\textwidth]{barplot0221}}
\subfigure[The ratios of the searched to the totals]{\includegraphics[width=0.48\textwidth]{barplot_ratio_0222}}
\caption{Extraction results}
\label{fig:results}
\end{figure*}
- 列表
\begin{enumerate}
\item
\item
\end{enumerate}
- 伪代码(算法)
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{amsmath}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
%使用
\begin{algorithm}
\caption{Explain semantics of notes}
\begin{algorithmic}[1] %每行显示行号
\Require {Text content of a footnote.}
\Ensure {An interpreted note.}
\State {Divide note into sentences by detecting ";", "()" and ".".}
\For {\textbf{each} sentence}
\State {Detect the \emph{"month" words}.}
\State {Explain the semantics after the last \emph{"month" word}.}
\If {"-" is the previous word of the last \emph{"month" word}}
\State {Construct the date interval.}
\EndIf
\If {\emph{qualifiers} before the first \emph{"month" word}}
\State {Explain the qualifier.}
\EndIf
\If {\emph{signs for weekdays} before the first \emph{"month" word}}
\State {Explain the signs.}
\EndIf
\EndFor
\State \Return{An interpreted note.}
\end{algorithmic}
\end{algorithm}
- 代码段
\usepackage{listings}
\usepackage{xcolor}
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\lstset{
columns=fixed,
numbers=left, % 在左侧显示行号
numberstyle=\tiny\color{gray}, % 设定行号格式
frame=none, % 不显示背景边框
backgroundcolor=\color[RGB]{245,245,244}, % 设定背景颜色
keywordstyle=\color[RGB]{40,40,255}, % 设定关键字颜色
numberstyle=\footnotesize\color{darkgray},
commentstyle=\it\color[RGB]{0,96,96}, % 设置代码注释的格式
stringstyle=\rmfamily\slshape\color[RGB]{128,0,0}, % 设置字符串格式
showstringspaces=false, % 不显示字符串中的空格
language=python, % 设置语言
}
%使用
\begin{lstlisting}
% 代码段
\end{lstlisting}