各种帮助网站
CTEX在线文档 http://www.ctex.org/OnlineDocuments
代码框架
1 \documentclass[a4paper,12pt]{article} 2 \usepackage[top=2.54cm, bottom=2.54cm, left=3.18cm, right=3.18cm]{geometry} 3 \usepackage{ctex} 4 \usepackage[colorlinks,bookmarksnumbered=true,bookmarksopen=true,CJKbookmarks=true,linkcolor=red,anchorcolor=black,citecolor=black]{hyperref} 5 \usepackage{amsthm} 6 \usepackage{graphicx} 7 \usepackage{amsmath} 8 \usepackage{ccmap} 9 \usepackage{listings} 10 \usepackage{color} 11 \usepackage{bbding} 12 \usepackage{url} 13 \usepackage{movie15} 14 \usepackage{booktabs,longtable} 15 \usepackage{mdwlist} 16 \usepackage{subfigure} 17 \usepackage{pifont} 18 \usepackage{titlesec} 19 \usepackage[labelsep=space]{caption} 20 \usepackage{multirow,paralist} 21 \usepackage[title,titletoc]{appendix} 22 \usepackage[svgnames,x11names]{xcolor} 23 \usepackage[titles,subfigure]{tocloft} 24 25 \def\CU@definezihao#1#2#3{ 26 \def#1{\fontsize{#2}{#3}\selectfont}} 27 28 \CU@definezihao{\zihaochu}{42}{50} 29 \CU@definezihao{\zihaoxiaochu}{36}{44} 30 \CU@definezihao{\zihaoyi}{28}{34} 31 \CU@definezihao{\zihaoer}{22}{26} 32 \CU@definezihao{\zihaoxiaoer}{18}{22} 33 \CU@definezihao{\zihaosan}{15.7}{19} 34 \CU@definezihao{\zihaosi}{14}{17} 35 \CU@definezihao{\zihaoxiaosi}{12}{14} 36 \CU@definezihao{\zihaowu}{10.5}{12} 37 \CU@definezihao{\zihaoxiaowu}{9}{11} 38 \CU@definezihao{\zihaoliu}{7.875}{9} 39 \CU@definezihao{\zihaoqi}{5.25}{6} 40 41 \titleformat{\section}{\zihaosi\bfseries}{$\S\;$\thesection}{1em}{} 42 \titleformat{\subsection}{\zihaoxiaosi\bfseries}{\thesubsection}{1em}{} 43 \titleformat{\subsubsection}{\zihaoxiaosi\bfseries}{\thesubsubsection}{1em}{} 44 45 \renewcommand{\figurename}{\zihaowu{Figure}} 46 47 \makeatletter 48 \newcommand\figcaption{\def\@captype{figure}\caption} 49 \newcommand\tabcaption{\def\@captype{table}\caption} 50 \makeatother 51 52 \usepackage{listings} 53 \lstset{tabsize=4, % 54 frame=single, %把代码用带有阴影的框圈起来 55 keywordstyle=\color[rgb]{0,0,1}, 56 commentstyle=\color[rgb]{0.133,0.545,0.133}, 57 stringstyle=\color[rgb]{0.627,0.126,0.941}, 58 %commentstyle=\color{red!50!green!50!blue!50},% 浅灰色的注释 59 rulesepcolor=\color{red!20!green!20!blue!20},% 代码块边框为淡青色 60 %keywordstyle=\color{blue!90}\bfseries, %代码关键字的颜色为蓝色,粗体 61 showstringspaces=false,% 不显示代码字符串中间的空格标记 62 stringstyle=\ttfamily, % 代码字符串的特殊格式 63 keepspaces=true, % 64 breakindent=22pt, % 65 numbers=left,%左侧显示行号 66 stepnumber=1,% 67 numberstyle=\footnotesize, %行号字体用小号 68 basicstyle=\footnotesize, % 69 showspaces=false, % 70 flexiblecolumns=true, % 71 breaklines=true, % 对过长的代码自动换行 72 breakautoindent=true,% 73 breakindent=4em, % 74 escapebegin=\begin{CJK*}{GBK}{hei},escapeend=\end{CJK*}, 75 aboveskip=1em, %代码块边框 76 %% added by http://bbs.ctex.org/viewthread.php?tid=53451 77 fontadjust, 78 captionpos=t, 79 framextopmargin=2pt,framexbottommargin=2pt,abovecaptionskip=-3pt,belowcaptionskip=3pt, 80 xleftmargin=4em,xrightmargin=4em, % 设定listing左右的空白 81 texcl=true, 82 % 设定中文冲突,断行,列模式,数学环境输入,listing数字的样式 83 extendedchars=false,columns=flexible,mathescape=true 84 % numbersep=-1em 85 } 86 \pagestyle{headings} 87 \begin{document} 88 \title{题目} 89 \author{作者} 90 \maketitle 91 \tableofcontents 92 \end{document}
插入图片
无浮动
1 %导言区加以下内容 2 \makeatletter 3 \newcommand\figcaption{\def\@captype{figure}\caption} 4 \newcommand\tabcaption{\def\@captype{table}\caption} 5 \makeatother 6 %导言区结束 7 8 \\[\intextsep] 9 \begin{minipage}{\textwidth} 10 \centering 11 \includegraphics[width=xxx pt]{文件名}% 12 \figcaption{显示的图片名} 13 \label{图片标记} 14 \end{minipage} 15 \\[\intextsep]
浮动
1 \begin{figure} 2 \centering 3 % 需要 \usepackage{graphicx} 4 \includegraphics[width=xxx pt]{文件名}\\ 5 \caption{图片名}\label{标记} 6 \end{figure}
插入表格
可以使用Excel的宏“Excel2LaTeX”将Excel表格转换为TeX表格
设置字体
1 \newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont} 2 \newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont} 3 \newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont} 4 \newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont} 5 \newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont} 6 \newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont} 7 \newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont} 8 \newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont} 9 \newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont} 10 \newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont} 11 \newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont} 12 \newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}
使用示例:
1 \begin{xiaosihao} 2 在这里写字 3 \end{xiaosihao} 4 5 \xiaosihao{在这里写字}
常用
带大括号的公式
1 % 需要 \usepackage{cases}%必须放amsmath下面,否则会冲突 2 $$ 3 dp(i,j)= 4 \begin{cases} 5 dp(i-1,j-1)+1,\ &\ a[i] = b[j]\\ 6 max\{dp(i-1,j),dp(i,j-1)\},\ &\ a[i] \neq b[j] 7 \end{cases} 8 $$