编写文档

Hello

% 【导言区】
\documentclass[UTF8]{ctexart}
% ctexart ctexrep ctexbook ctexbeamer
% article report  book     beamer     letter

%% 文档信息
\title{\heiti 这是标题}
\author{\kaishu 作者}
\date{\today}

% 【正文区】
\begin{document}
    \maketitle
    \clearpage
    正文内容
\end{document}

Font

\documentclass[UTF8]{ctexrep}

\usepackage{ulem}  % 下划线
\usepackage{color} % 字体颜色
% 自定义颜色
\definecolor{ColorName1}{rgb}{0.5,0.8,0.5}
\definecolor{ColorName2}{RGB}{230,125,230}

% 空格默认间距
% \spaceskip=0.2em

\begin{document}
\chapter{Font}


\section{Font Family}
\par Default
\par \textrm{Roman Family}{\rmfamily Roman Family}
\par \textsf{Sans Serif Family}{\sffamily Sans Serif Family}
\par \texttt{Typewriter Family}{\ttfamily Typewriter Family}
\par {\songti 宋体}
\par {\fangsong 仿宋}
\par {\heiti 黑体}
\par {\kaishu 楷体}


\section{Font Shape}
\par Default
\par \textbf{Boldface}{\bfseries Boldface}
\par \textit{Italic}\emph{Italic}{\itshape Italic}
\par \underline{Underline}
\par \uline{uline}\uuline{uuline}\uwave{uwave}\sout{sout}\xout{xout}\dashuline{dashuline}\dotuline{dotuline}
\par $H_2O$$CaCO_3$$E=mc^2$
\par \textmd{Medium}{\mdseries Medium}
\par \textup{Upright}{\upshape Upright}
\par \textsl{Slanted}{\slshape Slanted}
\par \textsc{SmallCaps}{\scshape SmallCaps}


\section{Font Size}

\subsection{General}
\par
{\tiny}
{\scriptsize}
{\footnotesize}
{\small}
{\normalsize} % 由文档类参数控制
{\large}
{\Large}
{\LARGE}
{\huge}
{\Huge}

\subsection{Ctex}
\par
{\zihao{-6}}
{\zihao{6}}
{\zihao{-5}}
{\zihao{5}}
{\zihao{-4}}
{\zihao{4}}
{\zihao{-3}}
{\zihao{3}}
{\zihao{-2}}
{\zihao{2}}
{\zihao{-1}}
{\zihao{1}}
{\zihao{-0}}
{\zihao{0}}


\section{Font Color}

\subsection{Foreground}
\par
\textcolor{black}{text}
\textcolor{white}{text}
\textcolor{red}{text}
\textcolor{green}{text}
\textcolor{blue}{text}
\textcolor{yellow}{text}
\textcolor{cyan}{text}
\textcolor{magenta}{text}
{\color{magenta} text}
\par
\textcolor[rgb]{0.7,0.6,0.3}{rgb}
\textcolor[RGB]{22,200,33}{RGB}
\par
\textcolor{ColorName1}{自定义颜色1}
\textcolor{ColorName2}{自定义颜色2}

\subsection{Background}
\par
\colorbox{yellow}{yellow}
\colorbox{ColorName1}{ColorName1}
\colorbox{ColorName2}{ColorName2}
\par
\colorbox[rgb]{0.4,0.4,0.7}{rgb}
\colorbox[RGB]{200,32,68}{RGB}


\section{Space}

\par ()             无空格
\par (\thinspace)   空格1/6em
\par (\enspace)     空格1/2em
\par (\quad)        空格1em
\par (\qquad)       空格2em
\par (\ )           空格
\par (~)            硬空格
\par ({\kern -1em})     自定义 kern -1
\par ({\kern 1em})      自定义 kern +1
\par ({\hskip -1em})    自定义 hskip -1
\par ({\hskip 1em})     自定义 hskip +1
\par (\hspace{-1em})    自定义 hspace -1
\par (\hspace{1em})     自定义 hspace +1
\par (\hphantom{abc})   占位符 hphantom abc
\par (\hfill)           弹性长度(撑满整个空间)


\section{Symbol}

\subsection{控制符}
\$\#、\%、\&、\{、\}、\_、
\textbackslash\^{}\~{}

\subsection{排版符}
\S\P\dag\ddag\copyright\pounds

\subsection{标志符}
\TeX{}、LaTeX{}、LaTeXe{}

\subsection{引号}
`abc'、``abc''

\subsection{连字符}
\par -
\par --
\par ---

\subsection{非英文字符}
\par \oe\OE
\par \ae\AE
\par \aa\AA
\par \o\O
\par \l\L
\par \ss\SS
\par !`、?`

\subsection{重音}
\par \`o
\par \'o
\par \^o
\par \~o
\par \=o
\par \.o
\par \''o


\end{document}

Paragraph

\documentclass[UTF8]{ctexrep}

%% 页边距
\usepackage{geometry}

\geometry{a4paper,left=3.18cm,right=3.18cm,top=2.54cm,bottom=2.54cm}
%% 设置默认行间距
\linespread{1.5}

\begin{document}

%
\chapter{Chapter}
\section{Section}
\subsection{Subsection}
\subsubsection{Subsubsection}
\paragraph{Paragraph}
\subparagraph{Subparagraph}

%
\clearpage
\par 段落1
\par 段落2
\newline 换行不缩进
\\ 换行不缩进
\par{段落3}

\end{document}

Equation

\documentclass[UTF8]{ctexrep}

\begin{document}

\par
左侧内容$f(x)=Ax^2+Bx+C$右侧内容

\par
左侧内容$$E=mc^2$$右侧内容

\par
左侧内容\begin{equation}
    AB^2=BC^2+AC^2
\end{equation}右侧内容

\end{document}

Import

\documentclass[UTF8]{ctexrep}

% 用于导入 eps、pdf、jpg、png、bmp
\usepackage{graphicx}
\graphicspath{{enclosure/}}

\begin{document}
\section{import}

\subsection{导入JPG}
\par
\includegraphics[scale=0.5]{file.png}
\par
\includegraphics[width=0.3\textwidth,angle=90]{file.png}
\includegraphics[height=0.3\textwidth]{file.png}

\subsection{导入PDF}
\includegraphics[scale=20]{file.pdf}

\end{document}

Table

\documentclass[UTF8]{ctexrep}

\begin{document}

\par demo1

\begin{tabular}{l c c c r}
        姓名 & 数学 & 语文 & 英语 & 备注
    \\  张三 & 45 & 58 & 66 & 请等待补考通知
    \\  李四 & 56 & 78 & 44 & 成绩一般
    \\  王五 & 99 & 98 & 95 & 成绩优异
    \end{tabular}

\par demo2

\begin{tabular}{l|c c c |r}
    \hline
    姓名 & 数学 & 语文 & 英语 & 备注
\\  张三 & 45 & 58 & 66 & 请等待补考通知
\\  李四 & 56 & 78 & 44 & 成绩一般
\\  王五 & 99 & 98 & 95 & 成绩优异
\\  \hline
\end{tabular}

\par demo3

\begin{tabular}{l||c c c||r}
    \hline \hline
    姓名 & 数学 & 语文 & 英语 & 备注
\\  张三 & 45 & 58 & 66 & 请等待补考通知
\\  李四 & 56 & 78 & 44 & 成绩一般
\\  王五 & 99 & 98 & 95 & 成绩优异
\\  \hline \hline
\end{tabular}

\par demo4

\begin{tabular}{l|c|c|c|p{2cm}}
    姓名 & 数学 & 语文 & 英语 & 备注
\\  张三 & 45 & 58 & 66 & 请等待补考通知
\\  李四 & 56 & 78 & 44 & 成绩一般
\\  王五 & 99 & 98 & 95 & 成绩优异
\end{tabular}

\end{document}