300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 论文排版LaTeX学习笔记

论文排版LaTeX学习笔记

时间:2020-03-02 22:51:19

相关推荐

论文排版LaTeX学习笔记

LaTeX学习笔记

欲善其工必利其器文本对齐方式中文包和字体格式字体颜色目录和标题空格和引号图片和表格图片加载图片并列图片右置表格导入大量数据csv文件格式exp1exp2浮动体数学公式基本运算矩阵表示联合数学公式补充添加~^在符号上部添加文本在符号下部添加文本≥和≤号公式加粗文献的引用newcommand命令代码块

欲善其工必利其器

在线LaTeX文档编辑线上版overleaf

在菜单中将Compiler参数设置为XeLaTeX格式,

这样就可以在源代码中添加\usepackage[UTF8]{ctex}导入中文包,就可以输出中文源代码。

文本对齐方式

戳这里

中文包和字体格式

%导言区\documentclass{article}%表示book,letter,report类,可以添加参数来进行分栏处理[twocolumn]\usepackage[UTF8]{ctex}%中文包XeLaTeX\newcommand\degree{^\circ}%导入角度中的度符号°\title{我的第一个LaTeX文件}%标题\author{小贤}%作者\date{\today}%日期%征正文区 有且仅有一个document环境\begin{document}\maketitle%(letter类中没有这个命令)表示显示输出title,author,date等信息源文件中一个或多个连续的空行在显示时只有一个空行。%$$符号的简单说明$f(x)=g(x)$是我定义的一个函数(单是行内模式,双是行间模式,):$$f(x)=3x^2+x+1$$定义一个带编号的数学模式equation:\begin{equation}\angle C=90 \degree\end{equation}以下是英文字体设置:{\rmfamily 这时罗马字体,没有大括号的话就一下文字全是该字体,知道遇见其他文字字体声明:English}{\sffamily 无衬线字体:English}{\ttfamily 打字机字体:English}字体系列设置:{\mdseries 中等字体宽度:English}{\bfseries 宽字体宽度:English}字体形状设置:{\upshape 直立型字体:English}{\itshape 斜体:English}{\slshape 伪斜体:English}{\scshape 将小写字母转化成小型大写:English}中文字体:{\songti 宋体}\quad{\heiti 黑体}\quad{\fangsong 仿宋}\quad {\kaiti 楷体}{\tiny 大小}{\footnotesize 大小}{\small 大小}{\scriptisize 大小}{\normalsize 大小} {\large 大小}{\Large 大小}{\huge 大小}{\Huge 大小}% 字号代号详见\zihao{-0} 大小\end{document}

字体颜色

\documentclass{article}\usepackage[UTF8]{ctex}\usepackage{color}\begin{document}{\color{red}{时间是让人痴狂的东西}}\end{document}

目录和标题

%导言区\documentclass{article}%表示book,letter,report类\usepackage[UTF8]{ctex}%中文包XeLaTeX\title{我的第一个LaTeX}%关于标题的位置大小等其他参数详见texdoc ctex文档中的参数ctexset,将自定义参数放在导言区中进行全参数设定\begin{document}\maketitle%\chapter{第一章}参数表示第一章,下有分成若干小节%只有在book编辑时存在该参数\documentclass{book}% 显示目录\tableofcontents% 新起一页进行内容书写% \clearpage\section{引言}文本内容不管是否在section中,都不受section限制,我们可以用 双斜杠 来进行换行,但是不换段\\双斜杠换行 \par par来进行换段(注意par参数后面一定要有空格)\section{结果}\subsection{数据}%子标题\subsubsection{数据1}%孙子标题\subsubsection{数据2}\section{致谢}\end{document}

空格和引号

图片和表格

图片加载

%导言区\documentclass{article}%表示book,letter,report类\usepackage[UTF8]{ctex}%中文包XeLaTeX\usepackage{graphicx}%引用的包\graphicspath{{picture/}}% 图片搜索相对路径,可以多个用逗号分隔。\begin{document}% 文件名可以不添加后缀\includegraphics[scale=0.1]{a}%整体按照比例变成0.1\includegraphics[height=4cm]{a.jpg}\\%指定高度\includegraphics[width=4cm]{b.jpg}\\%指定宽度\includegraphics[height=0.2\textheight]{a.jpg}\\%指定相对高度\includegraphics[width=0.5\textwidth]{a.jpg}%指定相对宽度\includegraphics[angle=45,height=0.2\textheight]{a.jpg}%添加旋转角度和相对高度,多个参数要用逗号分隔\end{document}

图片并列

\documentclass{article}%表示book,letter,report类\usepackage[UTF8]{ctex}%中文包XeLaTeX\usepackage{multirow}\usepackage{graphicx}\usepackage{subfigure}\begin{document}\begin{figure*}[htb]\centering\subfigure[图一]{\includegraphics[width=0.5\textwidth]{picture/a.jpg}\label{这个图的第a个}} \subfigure[图二]{\includegraphics[width=0.44\textwidth]{picture/a.jpg}} \\\subfigure[图三]{\includegraphics[width=0.5\textwidth]{picture/a.jpg}} \subfigure[图四]{\includegraphics[width=0.44\textwidth]{picture/a.jpg}} \\\caption{四图}\label{fig:data_distribution}\vspace{0.2in}\end{figure*}图\ref{fig:data_distribution}\\图\ref{这个图的第a个}\end{document}

图片右置

\documentclass{article}%表示book,letter,report类\usepackage[UTF8]{ctex}%中文包XeLaTeX\usepackage{wrapfig}\usepackage{graphicx}%引用的包\graphicspath{{picture/}}% 图片搜索相对路径,可以多个用逗号分隔。\begin{document}\begin{wrapfigure}[8]{r}{12.5em} % 纵向8行,图片靠右,宽度12.5em\begin{center}\includegraphics[scale=0.1]{a}\caption{}\label{fig:01.31}\end{center}\end{wrapfigure}暮然回首那人却在灯火阑珊处\end{document}

表格

导入大量数据csv文件格式

轮子:给入数据自动生成表格LaTeX代码

在tablesgenerator中选择Import CSV file 选择文件就可以了

exp1

%导言区\documentclass{article}%表示book,letter,report类\usepackage[UTF8]{ctex}%中文包XeLaTeX\usepackage{graphicx}%引用的包\graphicspath{{picture/}}% 图片搜索相对路径,可以多个用逗号分隔。\begin{document}\begin{tabular}{|l|c|r||p{1.5cm}|}%lcr分别对应左中右对齐方式,|表示线,几个|就是几个线条\hline%和|相同不过这是横向学生姓名& 语文成绩 & 数学成绩&英语\\\hline \hline小明& 32 & 34 & 55 \\\hline小刚& 35 & 36 & 45 \\\hline\end{tabular}\end{document}

exp2

\documentclass{article}%表示book,letter,report类\usepackage[UTF8]{ctex}%中文包XeLaTeX\usepackage{multirow}\begin{document}\begin{tabular}{|c|c|c|}\hline%\multirow和\multicolumn中第一个参数表示行列/第二个参数为属性设置(居正纵线)第三个参数内容\multirow{2}{*}{3} & \multicolumn{2}{c|}{4} \\\cline{2-3}%自定义长度横线,和tabular对应& 5 & 6 \\\hline7 & \multicolumn{2}{|c|}{8}\\\hline \end{tabular}\end{document}

浮动体

\documentclass{article}\usepackage[UTF8]{ctex}\usepackage{graphicx}\graphicspath{{picture/}}\begin{document}p1长相见图\ref{my_pic1}所示 % ref交叉引用图片或表格的label,返回图编号\begin{figure}[htbp]%h:此处 t:顶部 b:底部 p:独立一页优先级是先后顺序\centering%居中显示\includegraphics[scale=0.1]{a.jpg}%加载图片\caption{小妹吕}%图片名称\label{my_pic1}%图片标签用于交叉引用\end{figure}\\p2见图\ref{my_pic2}\begin{figure}[htbp]\centering\includegraphics[scale=0.1]{b.jpg}\caption{大妹吕}\label{my_pic2}\end{figure}\\成绩单见表\ref{tab_score}所示\begin{table}[htbp]%同图片\centering\begin{tabular}{|l|c|r||p{1.5cm}|}\hline学生姓名& 语文成绩 & 数学成绩&英语\\\hline \hline小明& 32 & 34 & 55 \\\hline小刚& 35 & 36 & 45 \\\hline\end{tabular}\caption{成绩单}\label{tab_score}\end{table}\end{document}

数学公式

牛!自动生成在线平台

别忘了包:\usepackage[namelimits]{amsmath}

基本运算

注:\times是×

\documentclass{article}\usepackage[UTF8]{ctex}\usepackage[namelimits]{amsmath} \begin{document}\section{上下标}%上标$$x^{20} + y^2 = 1$$%下标$$x_0 x_1 x_{2}$$$$x_0^0 + x_1^1 + ... + x_{100}^{100} + ... + x_{x^2 + 1}^{x^2 + 1} = 100$$\section{希腊字母}$$\alpha \delta \gamma \theta \pi \omega \epsilon $$$$\alpha \Delta \Gamma \Theta \Pi \Omega$$\section{数学函数}$$\log \sin \cos \arcsin \ln \sqrt[n]{} $$$$\log^2\alpha_{n} + \arcsin^{-1}\gamma_{m} + \sqrt[3]{\epsilon}= 1$$% 除法:两种写法显示不同$$3/4 + \frac{1}{4} = 1$$\section{自动编号公式}\subsection{不带*号(公式标号)}\begin{equation}x^{2} + y^2 = 1\label{circle}\end{equation}圆的标准方程是公式(\ref{circle})\subsection{带*号(小节号)}\begin{equation*}x^{2} + y^2 = 4 \label{circle2} \end{equation*}\\半径为2的圆方程是公式\ref{circle2}\end{document}

矩阵表示

\documentclass{article}\usepackage[UTF8]{ctex}\usepackage{amsmath} \begin{document}$\begin{matrix}0 & 1\\1 & 0\end{matrix}% 无括号$\par$\begin{pmatrix}0 & 1\\1 & 0 \end{pmatrix}% 小括号$\par$\begin{bmatrix}0 & 1\\1 & 0\end{bmatrix}% 中括号$\par$\begin{Bmatrix}0 & 1\\1 & 0\end{Bmatrix}% 大括号$\par$\begin{vmatrix}0 & 1\\1 & 0\end{vmatrix}% 单竖线括号$\par$\begin{Vmatrix}0 & 1\\1 & 0\end{Vmatrix}%双竖线无括号$\par$A=\begin{bmatrix}a_{11}^2 & \dots & a_{1n}^2\\% 省略号(横纵斜)和下标的使用& \ddots&\vdots\\0 & &a_{nn}^2\end{bmatrix}_{n \times n}$\par$A=\begin{bmatrix}% 嵌套矩阵\begin{matrix}1 & 0\\0 & 1\end{matrix}& \text{\Large 0}\\\text{\Large 0}&\begin{matrix} 1 & 0\\0 & 1\end{matrix}\end{bmatrix}$\end{document}

联合数学公式

\documentclass{article}\usepackage[UTF8]{ctex} \usepackage{amsmath} \usepackage{amssymb}\begin{document}gather多个公式组合\begin{gather}%加*表示不添加编号x^2 + y^2 = 1 \notag \\% \notag会阻止编号x + y = \frac{1}{2}\end{gather}align上下公式对齐\begin{align}%加*表示不添加编号x =& z &x^2 + y^2 &= 1 \\% \notag会阻止编号,每行对应的&就会上下对应起来z + y =& x& x + y &= \frac{1}{2}% 一般只在=左右和两个等式之间使用\end{align}equation-split等式运算过程(align也能实现)%equation中的split一般用于等式运算过程\begin{equation}\begin{split}x &= 1 + 1 +1 \\&=1 + 2\\&=3\end{split}\notag\end{equation}想输入斜杠使用$\backslash$ \parequation-cases数学公式组(数学公式中要写入中文必须使用斜杠text{中文})\begin{equation}D(X)=\begin{cases}1, &\text{若 } x \in \mathbb{Q}\\% &为对其位置,\mathbf为数学格式0, &\text{若 } x \in \mathbf{R}\setminus\mathbf{Q}\end{cases}\end{equation}\end{document}

补充

添加~^

\text{~{x}}_i^2 x˜i2\text{\~{x}}_i^2x˜i2​

\text{^{y}}_iyˆi\text{\^{y}}_iyˆ​i​

在符号上部添加文本

\overset{\text{随便}}{x_i}xi随便\overset{\text{随便}}{x_i}xi​随便​

在符号下部添加文本

\underset{\text{随便}}{X}X随便\underset{\text{随便}}{X}随便X​

≥和≤号

\le\ge≤≥\le\ge≤≥

公式加粗

\usepackage{amsmath}

\mathbf{X}X\mathbf{X}X

\usepackage{bm}

\bm{X}

X\bm{X}X

文献的引用

\documentclass{article}\usepackage[UTF8]{ctex} \usepackage{amsmath} \usepackage{amssymb}\begin{document}引用第\cite{art_2}文献引用第\cite{art_2}文献\begin{thebibliography}{}%\bibitem{art(用于引用文献标志)}人名.\emph{引用内容}[文章类型代号].类别,时间(期):页码\bibitem{art_1}叶于林, 于继伟, 刘显胜,等.\emph{浅析大数据在新冠肺炎疫情防控中的应用}[J]. 科技视界, (22):3.\bibitem{art_2}叶于林, 于继伟, 刘显胜,等.\emph{浅析大数据在新冠肺炎疫情防控中的应用}[J]. 科技视界, (22):3.\end{thebibliography}\end{document}

newcommand命令

\documentclass{article}\usepackage[UTF8]{ctex} \usepackage{amsmath} \usepackage{amssymb}% newcommand就是定义一个\content可以代表后面的内容,相当于#define\newcommand\content{这是一个newcommand命令}%将传入的参数置换进#?中,参数用{}括住\newcommand\mylove[2]{#2 love #1}%相对于上一句多了一个默认参数,第一个默认参数是[真的],调用时可以在前面使用[内容修改]\newcommand\hate[2][真的]{我 #1 讨厌 #2}\begin{document}\content\mylove{小贤}{李一桐}\hate{它}\hate[特别]{它}\end{document}

代码块

MATLAB代码块

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。