看前说明
说明:这篇文章介绍了latex的基本使用,基本覆盖了latex入门的知识点,由本人自己学习研究整理出来,不可被他人拿来进行不当的商用等等,违者必究。大家利用下面完整的latex文档,在编译器中编译,对比latex文档和生成文件之间的关系进行学习。
\documentclass{article}%文档类型
\usepackage[utf8]{inputenc}%编码类型
\usepackage[UTF8]{ctex}%支持中文
% 设置页面的环境,a4纸张大小,左右上下边距信息
\usepackage[a4paper,left=10mm,right=10mm,top=15mm,bottom=15mm]{geometry}
\usepackage{xcolor}
\usepackage{pifont}
%%以上都属于整体的设置,对初期学习的同学可以直接引用,等后面对LaTeX有一定了解了,可以根据自身需求更改
\usepackage[colorlinks,linkcolor=red]{hyperref}%超链接宏包
\usepackage{graphicx}%照片宏包
\usepackage{verbatim}
\usepackage{amssymb}%数学字体与符号宏包。注意此宏包已经包括了 amsfonts,不要重复使用
\usepackage{amsmath}%数学公式宏包
\title{青凌的云帆}
\author{青凌}
\date{march 2023}
%%标注明题目作者时间,但在文章中不会直接显示。正文中只有使用了\maketitle后才会出现插入的内容。
\begin{document}%文章的开篇,放正式文档
\maketitle%正文中只有使用了\maketitle后才会出现插入的内容(前面的题目作者时间)。
\section{写在前面}%一级标题
\noindent%取消首行缩进
\ding{172}LaTeX公式编辑器:%\ding{172}表序号1
\url{https://www.latexlive.com/}\\%超链接
\ding{173}LaTeX宏包文档:%\ding{173}表序号2
\url{https://ctan.org/pkg/:H}\\%超链接
\ding{174}LaTeX公式扫描器:%\ding{174}表序号3
\url{https://mathpix.com/}\\%超链接
\ding{175}表格编辑器:
\url{https://www.tablesgenerator.com/}\\
\ding{176}LaTeX宏包文档:
\url{https://ctan.org/pkg/:H}\\%超链接
\ding{177}LaTeX数学公式官方文档:
\url{https://math.meta.stackexchange.com/}\\%超链接
\ding{178}全希腊字母表:
\url{https://cloud.tencent.com/}|、
\ding{179}最全文档:
\url{https://latexstudio.net/}
\section{工具}%一级标题
\subsection{Texstudio} %二级标题
相关文档:\url{https://zhuanlan.zhihu.com/p/138586028}
\subsection{VScode} %二级标题
相关文档:\url{https://zhuanlan.zhihu.com/p/166523064}
\subsection{在线工具Overleaf} %二级标题
网页链接:\url{https://www.overleaf.com/project}
\section{排版部分}
\subsection{目录}%二级标题
\tableofcontents%生成目录
\subsection{标题}%二级标题
\section{一级标题}
\subsection{二级标题}
\subsubsection{三级标题}
\subsection{第一句话}%二级标题
\LaTeX
\section{摘要}
\begin{abstract}
这里是放摘要部分的
\end{abstract}
\section{首行缩进}
\noindent {欢迎来到青凌的云帆}
欢迎来到青凌的云帆%新的一段
\section{中文支持}
\iffalse
% -- coding: UTF-8 --
\usepackage[UTF8]{ctex}
\fi
%%\ifalse ...\if表多行注释
\section{快捷键}%一级标题
\subsection{常用快捷键} %二级标题
\noindent%取消首行缩进
\ding{172}Ctrl+B:粗体\\
\ding{173}Ctrl+I:斜体\\
\ding{174}Ctrl+Z:撤销\\
\ding{175}Ctrl+F:查找和替换\\
\ding{176}Ctrl+Home:到文档顶部\\
\ding{177}Ctrl+End:到文档底部\\
\ding{178}Ctrl+S:保存\\
\subsection{全部快捷键}
相关文档:\url{https://www.lianxh.cn/news/1175c7e5d0ee0.html}
\section{换行}
\noindent
换行\\
换行\\[1em]
换行\\[2em]
换行\\[8pt]
换行\\[16pt]
换行
\section{换段}
\ding{172}%源代码空一段表示换段
\ding{173}\par
\section{文档类型}
\noindent%取消首行缩进
\\documentclass {article}\\%文档类型 开篇那里著名的文档类型
\ding{172}短文:article\\
\ding{173}长文:report\\
\ding{174}书籍:book\\
\section{宏包}
%\usepackage{宏包}引用宏包
\noindent%取消首行缩进
ctex:中文支持\\
amsmath:latex数学公式支持\\
graphicx:插入图片\\
algorithm和algorithmic:算法排版\\
listings:插入代码块\\
LaTeX宏包文档:\url{https://ctan.org/pkg/:H}\\%超链接
\section{编译器}
\noindent%取消首行缩进
pdfLaTeX(默认)\\
LaTeX\\
XeLaTeX(支持中文)\\
LuLaTeX\\
\section{注释}
\subsection{单行注释}
\noindent\ding{172}\%注释内容\\
\ding{173}CTRL+/%%overleaf支持
\subsection{多行注释}
\ding{172}
\iffalse
注释内容
\fi
\ding{173}
\begin{comment}%需要应用宏包verbatim
注释内容
\end{comment}
\section{英文引号}
%第一种和第二钟编译出来的字符很官方,官方可见第三种和第四种
\noindent
'huangzhen'\\
"huangzhen"\\
`huangzhen'\\
``huangzhen"\\
\section{间距}
\noindent
a\qquad b\\
a\quad b\\
a\qquad b\\
a\ b\\
ab
\section{参考文献}
This is the main context \cite{knuth}.
\begin{thebibliography}{9}
\bibitem{knuth}%参考文献标签
D.K(1986),\textit{The Tex Book},A.P
\end{thebibliography}
\section{字体形式大小颜色}
\subsection{形式}
{\songti 宋体}
{\heiti 黑体}
{\fangsong 仿宋}
{\kaishu 楷书}
{\bf 粗体}
{\it 斜体}
{\sl 斜体}
\subsection{大小}
\textbf{粗体}\\
\textit{斜体}\\
\textsl{斜体}\\
{\tiny Hello} \\
{\scriptsize Hello} \\
{\footnotesize Hello} \\
{\small Hello} \\
{\normalsize Hello} \\
{\large Hello} \\
{\Large Hello} \\
{\LARGE Hello}
\subsection{颜色}
%字体颜色
\textcolor{green}{绿色} % textcolor+颜色
\color{orange}{橙色} % color+颜色
\textcolor[rgb]{0,1,0}{绿色} % textcolor+rgb
\color[rgb]{1,0,0}{红色} % color+rgb
\color[rgb]{0,0,0}{黑色} % color+rgb
% 使用底色
\colorbox{red}{\color{black}红底黑字}
\fcolorbox{red}{green}{红框绿底} % 框色+背景色
\section{引用、脚注}%\footnote{text}表脚注
下雨天\footnote{《下雨天》是梁心颐演唱的一首歌曲,由梁心颐填词,张杰谱曲,洪敬尧编曲。收录于南拳妈妈2008年7月25日发行的专辑《优の良曲南搞小孩》中}开头写道:
\begin{quote}%表引用
{\kaishu 怎样的雨 怎样的夜,怎样的我能让你更想念,雨要多大,天要多黑 才能够有你的体贴}
\end{quote}
\section{新一页}
新的一页
\newpage
新的一页
\section{照片}
\iffalse
常用选项[htbp]是浮动格式:
h:当前位置
t:顶部
b:底部
p:浮动页
\fi
\begin{figure*}[htp]% htbp代表照片浮动位置 %下面使用的是相对路径
\centering
\includegraphics[width=0.5\textwidth]{"1.jpg"}%宽度标签可以用数值\textwidth表示宽度占文章篇幅的宽度
\caption{深技大的风景}
\end{figure*}
\begin{figure*}[htbp]% htbp代表照片浮动位置
\centering
\includegraphics[width=3.4cm]{"1.jpg"}%宽度标签也可以直接用多少cm
\caption{深技大的风景}
\end{figure*}
\section{表格}
因为表格编辑比较复杂,推荐使用表格编辑器:\url{https://www.tablesgenerator.com/}
\begin{table}[htbp] % htbp代表表格浮动位置
\centering
\caption{表格}
\begin{tabular}{|c|c|c|} %c表示每一个表格,|表中间是否有间隔
\hline % 一条水平线
a & b & c \\ % \\为换行符
\hline
1 & 2 & 3 \\
\hline
\end{tabular}
\end{table}
\section{数学公式}
\noindent
LaTeX数学公式官方文档:\url{https://math.meta.stackexchange.com/}\\%超链接
LaTeX公式编辑器:\url{https://www.latexlive.com/}\\%超链接
LaTeX公式扫描器:\url{https://mathpix.com/}\\%超链接
\subsection{行内公式和行间公式}
行内公式:这是一个类似$1+1=2$的题目\\
行间公式:
$$
1+1=2
$$
\subsection{公式间换行}
$$
\begin{gathered}
1+1=2\\
1+2=3
\end{gathered}
$$
\subsection{标号}
自动标号:
\begin{equation}%中间不能有空行
3+4=7
\end{equation}
手动标号
\begin{equation}
7=4+3
\tag{5}
\end{equation}
\subsection{希腊字符}
例如:
$$
\begin{gathered}
\Delta,\Lambda\\
\phi,\varphi\\
\epsilon,\varepsilon\\
\end{gathered}
$$
全希腊字母表:\url{https://cloud.tencent.com/}
\subsection{上下标}
例如:
$$
\begin{gathered}
a^2,a_1\\
x^{y+z},p_{ij},p_ij\\
\end{gathered}
$$
\subsection{斜体与直立体}
例如:
$$
\begin{gathered}
x_i,x_{\rm i},x_{\text i}\\
\text{A B},{\rm A B}\\
\text A B,\rm A B\\
{\rm A} B,\\
\text {e},\text{i}
\end{gathered}
$$
\subsection{分式}
$$
\begin{gathered}
\frac {1}{2},\frac 1 2,\\
\frac 1 {x+y},\\
\frac {\frac 1 x +1}{y+1}\\
\frac {\dfrac 1 x +1}{y+1}\\
\end{gathered}
$$
\subsection{根式}
$$
\begin{gathered}
\sqrt 2 ,\sqrt {x+y},\sqrt[3]x\\
\end{gathered}
$$
\subsection{普通运算符}
$$
\begin{gathered}
+-\\
\times,\cdot,\div\\
\pm,\mp\\
><,\ge,\le,\gg,\ll,\ne,\approx,\equiv\\
\cap,\cup,\in,\notin,\subseteq,\supseteq\\
\forall ,\exists\\
不存在,因为,所以
\mathbb R\\
\mathcal F\\
\cdots,\vdots,\ddots\\
\infty,\partial,\nabla,\propto\\
\sin, \sec \cosh\\
\log_2 x,\ln x,\lg x\\
\lim_{x \to 0}\frac {x}{\sin x}\\
\lim\limits_{x \to 0}\frac {x}{\sin x}\\
\max x\\
\text{MSE}(x)\\
\end{gathered}
$$
\subsection{大型运算符}
$$
\begin{gathered}
\sum ,\prod\\
\sum_i,\sum_{i=0}^N\\
\frac {\sum_{i=1}^n x_i}{\prod_{i=1}^nx_i}\\
\frac {\sum\limits_{i=1}^n x_i}{\prod\limits_{i=1}^nx_i}\\
\int ,\iint ,\iiint,\oint\\
\int _{-\infty}^0 f(x) \,\text dx\\
\end{gathered}
$$
\subsection{箭头}
$$
\begin{gathered}
\leftarrow ,\Rightarrow,\Leftrightarrow,\longleftarrow
\end{gathered}
$$
\subsection{帽子}
$$
\begin{gathered}
\vec x,\overrightarrow {AB}\\
\bar x ,\overline {AB}\\
\end{gathered}
$$
\subsection{括号和定界符}
$$
\begin{gathered}
([])\{\}\\
\lceil,\rceil,\lfloor,\rfloor,||\\
\end{gathered}
$$
\end{document}
下面是编译后生成的文档