LaTeX 中文模版代码

有些初使用 LaTeX \LaTeX{}LATEX 进行中文写作的作者,总是会遇到不能正确利用 LaTeX \LaTeX{}LATEX 编译中文文档的问题。这里总结出一个模板或方法,来帮助这些作者方便进行 LaTeX \LaTeX{}LATEX 中文写作。

使用 LaTeX \LaTeX{}LATEX 编写中文文档步骤

具体步骤如下:

  • 添加如下代码;
  • 使用 XeLaTeX 编译执行。

(注意:生成目录需要编译两次)

LaTeX \LaTeX{}LATEX 源代码

具体 LaTeX \LaTeX{}LATEX 代码(.tex文件)如下:

\documentclass{article}

\usepackage{geometry}

\geometry{a4paper}

%\usepackage[UTF8, heading = false, scheme = plain]{ctex}%格式

\usepackage{ctex}

%\usepackage{authblk} %添加机构 安装preprint后可用

\usepackage{graphicx} %添加图片

\usepackage{amsthm}

\usepackage{amsmath}

\renewcommand{\vec}[1]{\boldsymbol{#1}} % 生产粗体向量,而不是带箭头的向量

\usepackage{amssymb}

\usepackage{booktabs} % excel导出的大表格

\usepackage{hyperref}

%\newtheorem{definition}{Definition} %英文

%\newtheorem{theorem}{Theorem}

\newtheorem{definition}{定义} %中文

\newtheorem{lemma}{引理}

\newtheorem{theorem}{定理}

%\newenvironment{proof}{{\noindent\it 证明}\quad}{\hfill □ \square□\par}

\DeclareMathOperator{\Ima}{Im}%定义新符号

\DeclareMathOperator{\Rank}{rank}%定义求秩算子

\title{计算机视觉的数学基础}

\author{徐金中 \\ Email: \href{mailto:jinzhongxu@csu.ac.cn}{jinzhongxu@csu.ac.cn}}

%\affil{中国科学院} 
%需要把上面的\usepackage{authblk}取消注释

%date{}

\begin{document}

\maketitle

%\tableofcontents

%\newpage

%\listoffigures

%\newpage

\section{卷积网络和微积分}

%\begin{figure}[ht] %htbp

%\centering

%\includegraphics[scale=0.6]{ai.png}

%\caption{this is a figure demo}

%\label{fig:label}

%\end{figure}

\begin{equation}\label{fft}
	F(\omega) = \mathcal{F}[f(t)] = \int_{-\infty}^{\infty} f(t)e^{-i\omega t} \mathrm{d}t
\end{equation}

\section{损失函数和最优化}

\begin{equation*}
	\theta^{\star} = \underset{\theta \in \Theta}{\arg \min} J(\theta) + \lambda \|\theta\|^2
\end{equation*} 

\end{document}

PDF 文档

编译的PDF(.pdf 文件)如下:
在这里插入图片描述

编译器

建议使用 MikTex + TeXstudio 作为编译器。

更多知识分享

访问我的个人网站 J. Xu,获取更多知识,包括数学分析、计算机技术、Linux、Python、计算机视觉等。


版权声明:本文为xujinzh原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。