- 插图,多图并成一排,有大标题有小标题
\begin{figure}[!htp]
\begin{minipage}[t]{0.5\linewidth}%设定图片下字的宽度,在此基础尽量满足图片的长宽
\centering
\includegraphics[height=8cm,width=8cm]{pics/pic1.eps}
\caption*{(a) This is the left picure.}%加*可以去掉默认前缀,作为图片单独的说明
\label{fig:side:a}
\end{minipage}
\begin{minipage}[t]{0.5\linewidth}%需要几张添加即可,注意设定合适的linewidth
\centering
\includegraphics[height=8cm,width=8cm]{pics/pic1.eps}
\caption*{(b)This is the right picture.}
\label{fig:side:b}
\end{minipage}
\caption{This is total name.}%n张图片共享的说明
\end{figure}
- 多图,排成多行多列,有大小标题,需要包
\usepackage{graphicx} \usepackage{subfigure}
\begin{figure}[htb]
\centering
\subfigure[t=0]{
\includegraphics[width=0.3\linewidth]{pics/pic1.eps}}
\hspace{0.01\linewidth}
\subfigure[t=5.86e-4]{
\includegraphics[width=0.3\linewidth]{pics/pic1.eps}}
\hspace{0.01\linewidth}
\subfigure[t=1.46e-3]{
\includegraphics[width=0.3\linewidth]{pics/pic1.eps}}
\vfill
\subfigure[t=2.93e-3]{
\includegraphics[width=0.3\linewidth]{pics/pic1.eps}}
\hspace{0.01\linewidth}
\subfigure[t=6.74e-3]{
\includegraphics[width=0.3\linewidth]{pics/pic1.eps}}
\hspace{0.01\linewidth}
\subfigure[t=1.18e-2]{
\includegraphics[width=0.3\linewidth]{pics/pic1.eps}}
\caption{双弧外摆线演化}\label{sh}
\end{figure}
- 绘制表格,收敛性分析
\begin{table}[!h]
\centering
\caption{圆曲线演化算例结果}
\label{yqxyhsljg}
\begin{tabular}{cclc}
\hline
\hline
\# Resolution & \# Time Steps & \# Error & \# Order \\
\hline
16$\times$16 & 5 & -0.0106 & - \\
32$\times$32 & 10 & -0.0027 & 1.9730 \\
64$\times$64 & 20 & -6.3868$\times 10^{-4}$ & 2.0798 \\
128$\times$128 & 40 & -1.5524$\times10^{-4}$ & 2.0406 \\
256$\times$256 & 80 & -3.8418$\times10^{-5}$ & 2.0146 \\
\hline
\end{tabular}
\end{table}
- 放置图片表格,加htbp参数,表示先here,后top,再bottom,最后p,置于浮动图片处,加感叹号,[!btb]忽略美学标准,使用包
\usepackage{float}
,用H参数,强制放置。 - 插入代码以及美化
\begin{lstlisting}[language=Matlab,keywordstyle=\color{blue!70},commentstyle=\color{red!50!green!50!blue!50},frame=shadowbox, rulesepcolor=\color{red!20!green!20!blue!20}]
\end{lstlisting}
- 优化函数带s.t.的环境写法:
\begin{align*}
&\max\quad z=\sum\limits_{i=1}^m c_i x_i\\
& \begin{array}{r@{\quad}r@{}l@{\quad}l}
s.t.&\sum\limits_{j=1}^m a_{ij} x_j&\leq b_i, &i=1,2,3\ldots,n\\
&x_j&\geq110, &i=1,2,3\ldots,n \\
&x_j&\geq10, &i=1,2,3\ldots,n \\
&x_j&\geq0, &i=1,2,3\ldots,n \\
& x_j&\geq0, &i=1,2,3\ldots,n \\
\end{array} .
\end{align*}
- 分段分区域函数(左大括号)的写法:
\begin{equation}
d(\Gamma,\vec x)=
\left\{
\begin{aligned}
\mathop {\min }\limits_{\vec y \in \Gamma } |\vec x - \vec y| & & &\vec x \in \Gamma_{in}\\
-\mathop {\min }\limits_{\vec y \in \Gamma } |\vec x - \vec y|& & &\vec x \notin \Gamma_{in}\\
\end{aligned}
\right.
\end{equation}
- 连等式分行的写法
\begin{equation*}
\begin{split}
\max _u \min _x[f(x)+u^T(Ax-b)] &= \max _u[\min _x(f(x)+u^TAx)-b^Tu] \\
&=\max _u[-\max _x(-u^TAx-f(x))-b^Tu]\\
&=\max _u[-f^*(-A^Tu)-b^Tu]
\end{split}
\end{equation*}
- 算法描述框
\usepackage[noend]{algpseudocode}
\usepackage{algorithmicx,algorithm}
\begin{algorithm}[H]
\caption{Fast Marching Mothod Algorithm Description} %算法的名字
\hspace*{0.02in} {\bf Input:} %算法的输入, \hspace*{0.02in}用来控制位置,同时利用 \\ 进行换行
input parameters $F, S, Ts,h$\\
\hspace*{0.022in} {\bf Output:} %算法的结果输出
$T$
\begin{algorithmic}[1]
\State \emph{\textbf{Initializing $T$:}}
\State $\forall p \in G\backslash S,T(p)=+\infty$ % \State 后写一般语句
\State \emph{\textbf{Initializing Narrow Band:}}
\For{$p \in S$}
\State $ps$ = Neighbor($p$)
\State $T(ps)=T(p)+h$
\State $Trial \leftarrow ps$
\EndFor
$Alive \leftarrow S$
\State \emph{\textbf{Updating $T$:}}
\While{$Trial \neq \emptyset$} % While语句,需要和EndWhile对应
\State $m=min(Trial)$
\State $Alive \leftarrow m$
\State $ms = Neighbor(m)$
\For{$p \in ms\backslash Alive$}
\State $\{i,j\} = p$
\State $T_1=min(T_{i-1,j},T_{i+1,j})$
\State $T_2=min(T_{i,j-1},T_{i,j+1})$
\If{$|T_1-T_2|<{h}/{F_{ij}}$} % If 语句,需要和EndIf对
\State $t=\frac{T_1+T_2+\sqrt{{2h^2}/{F_{ij}^2}-(T1-T2)^2}}{2}$
\Else
\State $t=min\{T_1,T_2\}+{h}/{F_{ij}}$
\EndIf
\State $T(p)=min\{T(p),t\}$
\State $Trail \leftarrow p$
\EndFor
\EndWhile
\State \Return T
\end{algorithmic}
\end{algorithm}
- 需要复制excel里面的表格,可能需要三个包:
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bigstrut}
- 定义新的定理环境,如引理,命题,等
\newtheorem{lemma}{\textbf{Lemma}}%前一个大括号表示命令名称,后一个表示显示的样子
%两个大括号中间可以加中括号表示继承,最后可以加中括号表示按章还是按节编号
\newtheorem{theorem}{{定理}}[chapter]%重命名定理为中文,采用章编号
\newtheorem{proposition}[theorem]{{命题}}
\newtheorem{property}{{性质}}
\newtheorem{lemma}[theorem]{{引理}}%同theorem,采用章编号
\newtheorem{corollary}[theorem]{{推论}}
\newtheorem{definition}{{定义}}[section]%定义采用节编号
\newtheorem{example}{{例}}[section]
- 定义新的定理环境,英文版
\newtheorem{example}{\textbf{EXAMPLE}}
\newtheorem{lemma}{\textbf{Lemma}}
\newtheorem{theorem}{\textbf{Theorem}}
\newtheorem{proposition}[theorem]{\textbf{Proposition}}
\newtheorem{property}{{Property}}
\newtheorem{corollary}[theorem]{\textbf{Corollary}}
\newtheorem{definition}{\textbf{Definition}}[section]
- 定义和重定义斜杆命令
%\newcommand{新命令}[参数数量][首参数默认值]{定义内容} 重定义类似
\newcommand\cc[3][A]{#1#2#3} %\cc{B}{C}显示:ABC \cc[a]{b}{c}显示:abc 修改默认参数用中括号
\renewcommand\proofname{证明}
\renewcommand{\qed}{\begin{flushright}\rule{3mm}{3mm}\end{flushright}}
\renewcommand{\proof}{\textbf{Proof}}
- 定义和重定义新环境
%跟命令那个是类似的,也是名称、参数个数、首参数默认值,然后开始定义
%\newenvironment{<环境名称>}[参数个数][<首参数默认值>]{<环境前定义>}{<环境后定义>}
%\renewenvironment{<环境名称>}[参数个数][<首参数默认值>]{<环境前定义>}{<环境后定义>}
\newenvironment{proof}{{\noindent\it Proof}\quad}{\hfill $\square$\par}
%\noindent表示proof没有缩进,\it表示proof斜体
%\quad表示proof后面空四个空格,\hfill表示右对齐,\square表示方框,\par表示结尾空一段
\makeatletter \newenvironment{proofq}[1][\proofname]{\par \pushQED{\qed} \normalfont \topsep6\p@\@plus6\p@ \labelsep1em\relax \trivlist \item[\hskip\labelsep\indent \bfseries #1]\ignorespaces }{ \popQED\endtrivlist\@endpefalse } \makeatother
- WinEdt查看文档帮助和DOC文章结构
1、texdoc caption
2、WinEdt善于利用工具条上的gather按钮查看文章结构TOC和标签等等。
3、双击usepackage,查看帮助。
- cls文件几个命令的解析
\newif\ifboolcondition %命令创建一个false状态的逻辑变量,等价于:\new\ifboolcondition \boolconditionfalse。
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}%将每一个未知的选项都传给article类
\DeclareOption{english}{\Chinesefalse}%定义文档类时的选项声明
\AtEndDocument{\end{multicols}}%遇到\end{document}后执行某命令
- 关于字号设置,ctexart只可以设置10pt(五号略小点)、11pt(五号略大点)和12pt(小四号)。
\documentclass[10pt, a4paper]{ctexrep}%改成11pt,12pt可看效果
\begin{document}
字体测试\\
{\zihao{1}一字号}\\
字体测试\\
{\zihao{2}二字号}\\
字体测试\\
{\zihao{3}三字号}\\
字体测试\\
{\zihao{4}四字号}\\
字体测试\\
{\zihao{-4}负(小)四字号}\\
字体测试\\
{\zihao{5}五字号}\\
字体测试\\
\end{document}
- 正确定义定理、引理以及改“proof”为“证明”的姿势:
\newtheorem{theorem}{{定理}}%[chapter]%重命名定理为中文,采用章编号
\newtheorem{proposition}[theorem]{{命题}}
\newtheorem{property}[theorem]{{性质}}
\newtheorem{lemma}[theorem]{{引理}}%同theorem,采用章编号
\newtheorem{corollary}[theorem]{{推论}}
\newtheorem{definition}[theorem]{{定义}}%[section]%定义采用节编号
\newtheorem{example}[theorem]{{例}}%[section]
\renewcommand\proofname{证明}
-
使用
\text
需要\usepackage{amsmath}
。 -
使用 proof 环境需要 amsthm 包。
-
mathscr 字体,需要\usepackage{mathrsfs}。
-
overleaf 里面要想使用中文,首先要
\usepackage{ctex}
,但是似乎自带的 pdflatex 编译器不支持这个,所以要改成 xelatex 编译。 -
当单元格内容太长,需要换行的时候。
\begin{tabular}{{p{0.15\columnwidth}|p{0.85\columnwidth}}}
-
使用
\textbf
没反应,考虑是不是使用的中文字体不支持,而英文和数字可以。解决方案,比如说注释掉 \kaishu 等。xelatex编译加粗楷体为什么会失败?CJK 包处理中文,由于没有粗楷体,粗体命令的效果是采用伪粗体:\documentclass[AutoFakeBold]{beamer}
-
使用 minipage 实现图表的混排
\makeatletter\def\@captype{figure}\makeatother
\begin{minipage}{.45\textwidth}
\centering
\rule{3cm}{2cm}
\caption{The figure caption}
\end{minipage}
\makeatletter\def\@captype{table}\makeatother
\begin{minipage}{.45\textwidth}
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
a & a & a & a & a \\
a & a & a & a & a \\
a & a & a & a & a \\
\hline
\end{tabular}
\caption{The table title}
\end{minipage}
- 有时候图片太多,编译起来就会超级慢,这时候
使用
%\special{dvipdfmx:config z 0} %取消PDF压缩,加快速度,最终版本生成的时候最好把这句话注释掉,否则,文件很大
进行免压缩编译,速度会快很多。
-
Beamer 实现计时功能
有时候参加答辩什么的,有严格的时间控制,能不能添加计时模块呢?可以用 tdclock。以修改 metro 主题模板为例。- 添加包 tdclock
\usepackage[timeinterval=1]{tdclock}
- 在
\begin{document}
下添加\initclock
- 修改 beamerouterthememetropolis.sty 中的
\setbeamertemplate{navigation symbols}
为\setbeamertemplate{navigation symbols}{\resetcrono{RESET}:\quad \crono}
- 使用 PDF latex 编译,否则显示可能会出点问题。
- 添加包 tdclock
-
\pause
可以实现 beamer 的切出效果,跟 PPT 的弹出一样。 -
图表的浮动用
!htb
如果用了p
参数,大图大表可能会独占一页。 -
beamer 实现页面跳转可以使用 hyperref 包,用法如下:
\usepackage{hyperref} \hyperlink{lb}{\beamerskipbutton{skip}} \hyperlink{back}{\hspace{3cm}} \hyperlink{lb}{\beamerbutton{link}} \begin{frame}[label=lb]