LaTeX学习笔记
使用网页版的LaTeX(可能要FQ).
https://www.overleaf.com/8126478vdhwbxxyjkch#/28695502/
1 \documentclass[a4paper]{article} 2 3 %% Language and font encodings 4 \usepackage[english]{babel} 5 \usepackage[utf8x]{inputenc} 6 \usepackage[T1]{fontenc} 7 8 %% Sets page size and margins 9 \usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry} 10 11 %% Useful packages 12 \usepackage{amsmath} 13 \usepackage{graphicx} 14 \usepackage[colorinlistoftodos]{todonotes} 15 \usepackage[colorlinks=true, allcolors=blue]{hyperref} 16 17 \title{ACM} 18 \author{Douzi} 19 20 \begin{document} 21 \maketitle 22 23 \begin{abstract} 24 Your abstract. 25 \end{abstract} 26 27 \section{Introduction} 28 29 Your introduction goes here! Some examples of commonly used commands and features are listed below, to help you get started. If you have a question, please use the help menu (``?'') on the top bar to search for help or ask us a question. 30 31 \section{Some examples to get started} 32 33 \subsection{How to add Comments} 34 35 Comments can be added to your project by clicking on the comment icon in the toolbar above. % * <john.hammersley@gmail.com> 2014-09-03T09:54:16.211Z: 36 % 37 % Here's an example comment! 38 % 39 % ^ <1281561801@qq.com> 2017-02-11T06:22:46.997Z. 40 To reply to a comment, simply click the reply button in the lower right corner of the comment, and you can close them when you're done. 41 42 \subsection{How to include Figures} 43 44 First you have to upload the image file from your computer using the upload link the project menu. Then use the includegraphics command to include it in your document. Use the figure environment and the caption command to add a number and a caption to your figure. See the code for Figure \ref{fig:frog} in this section for an example. 45 46 \begin{figure} 47 \centering 48 \includegraphics[width=0.3\textwidth]{frog.jpg} 49 \caption{\label{fig:frog}This frog was uploaded via the project menu.} 50 \end{figure} 51 52 \subsection{How to add Tables} 53 54 Use the table and tabular commands for basic tables --- see Table~\ref{tab:widgets}, for example. 55 56 \begin{table} 57 \centering 58 \begin{tabular}{l|r} 59 Item & Quantity \\\hline 60 Widgets & 42 \\ 61 Gadgets & 13 62 \end{tabular} 63 \caption{\label{tab:widgets}An example table.} 64 \end{table} 65 66 \subsection{How to write Mathematics} 67 68 \LaTeX{} is great at typesetting mathematics. Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let 69 \[S_n = \frac{X_1 + X_2 + \cdots + X_n}{n} 70 = \frac{1}{n}\sum_{i}^{n} X_i\] 71 denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$. 72 73 74 \subsection{How to create Sections and Subsections} 75 76 Use section and subsections to organize your document. Simply use the section and subsection buttons in the toolbar to create them, and we'll handle all the formatting and numbering automatically. 77 78 \subsection{How to add Lists} 79 80 You can make lists with automatic numbering \dots 81 82 \begin{enumerate} 83 \item Like this, 84 \item and like this. 85 \end{enumerate} 86 \dots or bullet points \dots 87 \begin{itemize} 88 \item Like this, 89 \item and like this. 90 \end{itemize} 91 92 \subsection{How to add Citations and a References List} 93 94 You can upload a \verb|.bib| file containing your BibTeX entries, created with JabRef; or import your \href{https://www.overleaf.com/blog/184}{Mendeley}, CiteULike or Zotero library as a \verb|.bib| file. You can then cite entries from it, like this: \cite{greenwade93}. Just remember to specify a bibliography style, as well as the filename of the \verb|.bib|. 95 96 You can find a \href{https://www.overleaf.com/help/97-how-to-include-a-bibliography-using-bibtex}{video tutorial here} to learn more about BibTeX. 97 98 We hope you find Overleaf useful, and please let us know if you have any feedback using the help menu above --- or use the contact form at \url{https://www.overleaf.com/contact}! 99 100 \bibliographystyle{alpha} 101 \bibliography{sample} 102 103 \end{document}
1.第一个文档
打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。
\documentclass{article}
\begin{document}
hello,
world
\end{document}
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeTeX,并点击编译。如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。
2.标题、作者和注释
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。
\documentclass{article}
\author{My
Name}
\title{The
Title}
\begin{document}
\maketitle
hello,
world % This is comment
\end{document}
3.章节和段落
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。
\documentclass{article}
\author{Dou zi}
\title{Welcome to LaTex World !}
\begin{document}
\maketitle
\section{Hello China} China is in East Asia. %%大标题{} + 段落
\subsection{Hello Beijing} Beijing is center of China %%子标题 + 段落
\subsubsection{Hello DongCheng District}
\paragraph{Tian'anmen Square}is in the center of Beijing
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square
\subsection{Hello Guangzhou}
\paragraph{Sun Yat-sen University} is the best university in Guangzhou.
\end{document}
4.加入目录
建立一个新文档,将以下内容复制进入文档中,保存
\documentclass{article}
\begin{document}
\tableofcontents
\section{Hello China} China is in East Asia.
\subsection{Hello Beijing} Beijing is the capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Hello Tian'sanmen Square}is in the center of Beijing
\subparagraph{Hello Chairman Mao} is in the center of Tian'sanmen Square
\end{document}
5.换行
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。
\documentclass{article}
\begin{document}
Beijing is
the
capital
of China.
New York
is
the
capital
of
America.
Amsterdam
is \\ the capital \\ %% “\\”:是顶格换行,空一行:是对齐换行
of
Netherlands.
\end{document}
6.数学公式
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\begin{document}
The Netton's second law is F=ma.
The Newton's second law is $F=ma$.
The Newton's second law is
$$F = ma$$
The Newton's second law is
\[F=ma\]
Greek Letters $\eta$ and $\mu$
Fraction $\frac{a}{b}$
Power $a^b$
Subscipt $a_b$
Derivate $\frac{\partial y}{\partial t} $
Vector $\vec{n}$
Blod $\mathbf{n}$
To time differential $\dot{F}$
\end{document}
8.简单表格
\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|}
a & b \\
c & d\\
\end{tabular}
\begin{tabular}{|c|c|}
\hline
a & b \\
\hline
c & d\\
\hline
\end{tabular}
\begin{center}
\begin{tabular}{|c|c|}
\hline
a & b \\ \hline
c & d\\
\hline
\end{tabular}
\end{center}
\end{document}