文章目录
@[TOC]1. 页面设置2. [更改数学公式的字体](//01/06/5e12865f2a5bd/)3. 表格设置图表并排、图和表放在同一列4. 添加代码块5. 常见错误6. [添加标题](/question/386123139/answer/1144768121)7. 插入图片或表格(图表)latex插入jupyter notebook代码分式正常显示,不要压缩变小一些符号
1. 页面设置
LaTeX 中更改单个页面页边距:/s/blog_531bb7630101832g.htmlLaTeX 页眉页脚的设置:/tsingke/p/5247575.html去掉当前页面左上角的页码: 载入fancyhdr
宏包 在要去掉的页面使用\thispagestyle{empty}
居中底部添加页码\页脚\pagestyle{fancy} % 选用 fancy style\renewcommand{\headrulewidth}{0pt} % 页眉与正文之间的水平线粗细——去掉页眉
latex左下角注释:latex如何在左下角显示一些注释文字
4.设置字号、行距:
【Latex】Latex调整行间距
latex字体与行距
以:小四号、1.5倍行距为例
\usepackage{setspace} % 导入设置行距的包\renewcommand{\baselinestretch}{1.5} % 设置1.5倍行距\begin{document}\zihao{-4}% 设置小四号字体...正文\end{document}
中文下划线不换行的问题:
%改用如下的下划线命令\usepackage{ulem}\uline{中文字}
想要宋体加粗但是,加粗字体默认是黑体的问题
\usepackage{ctex}\setCJKfamilyfont{zhsong}[AutoFakeBold = {2.17}]{SimSun}\renewcommand*{\songti}{\CJKfamily{zhsong}}\begin{document}\textbf{\songti 想要宋体加粗}\end{document
禁止图表浮动,固定图表
把[!htbp]
改为[H]
即可
\begin{table}[H]...\end{table}
2. 更改数学公式的字体
只需要开头导入这些包
%更改公式字体\usepackage{amsmath}\usepackage{amssymb}\usepackage{mathptmx}\usepackage{bm}
3. 表格设置
三线表、表格怎么设置宽度?
p{2cm} # 左对齐p{2cm}<\centering # 居中对齐p{2cm}<\raggedleft # 右对齐
表格宽度的设置方法二(推荐):/Rained_99/article/details/79389189
Latex表格和图片,表格和表格间距变小:/question/324205328/answer/686481315
表格上下垂直间距过小过短:
在表格里加入这一行\renewcommand\arraystretch{n}
\begin{table}[!htbp]\renewcommand\arraystretch{1.3} % 设置1.3倍行距...\end{table}
表格斜线表头:
\diagbox{特征}{类别}
需要在引言区导入包
\usepackage{diagbox}
\diagbox[width=9em, trim=l]{特征}{类别} # width调整长度 trim调整偏移...吧
4. 表格换行:p{2cm}设置宽度,然后就会自动换行了。
.
6.\multirow
报错Redefining CJKfamily 'zhsong'(SimSun).
^^I^^I^^I\multirow Undefined control sequence.
Overfull \hbox (6.59052pt too wide)
Latex Table 合并行/列详解
\usepackage{multirow} % 记得加载包\multirow{n}{*}{text} % 需要加上中间那个{*},不加的话不会通过编译% PS: \cline{2-3} 第2-3列画横线
图表并排、图和表放在同一列
\makeatletter\def\@captype{table}\makeatother\begin{minipage}[b]{.45\textwidth}\centering\caption{混淆矩阵}\label{混淆矩阵}\begin{tabular}{cc|c|c}\toprule[0.1em]&& \multicolumn{2}{c}{测试值} \\&& 购买 & 不购买 \\\hline\multirow{2}{*}{真实值} & 购买 & 105098& 261792\\\cline{2-4}& 不购买 & 6316 & 1619 \\\bottomrule[0.1em]\end{tabular}\end{minipage}\hfill\makeatletter\def\@captype{figure}\makeatother\begin{minipage}{.45\textwidth}\centering\includegraphics[width=2.5in]{../ROC曲线.png} % 该图片要放在当前目录下\caption{ROC曲线}\label{ROC曲线}\end{minipage}
ps:如果表格太大的话,可以在\centering
后面添加\normalsize
,使表格的字体大小变正常
\qquad
\begin{align}
报错:/qq_22498427/article/details/89304991
Package amsmath error: Erroneous nesting of equation structures; (amsmath) trying to recover with aligned...
4. 添加代码块
\usepackage{listings, xcolor, caption,color}\lstset{language = Python,backgroundcolor = \color{lightgray!15}, % 背景色:淡黄basicstyle = \small\ttfamily, % 基本样式 + 小号字体rulesepcolor= \color{gray}, % 代码块边框颜色breaklines = true, % 代码过长则换行numbers = left, % 行号在左侧显示numberstyle = \small,% 行号字体keywordstyle = \color[RGB]{70,130,180}, % 关键字颜色commentstyle =\color[RGB]{0,121,121}, % 注释颜色stringstyle = \color{gray!110},% 字符串颜色%frame = shadowbox, % 用(带影子效果)方框框住代码块showspaces = false, % 不显示空格columns = fixed,% 字间距固定%escapeinside={<@}{@>} % 特殊自定分隔符:<@可以自己加颜色@>morekeywords = {acf,scan,title,plot,windowsFonts,vector,paste,pchisq},% 自加新的关键字(必须前后都是空格)deletendkeywords = {compile} % 删除内定关键字;删除错误标记的关键字用deletekeywords删!}\begin{lstlisting}[title=第1题R语言代码]# 导入数据x = scan('../../ppt和作业/第二次作业第一题数据.txt')x <- ts(x, start=c(2000,1),frequency=12)# 公司销售量时序图 TNM = windowsFonts(TNM = windowsFont("Times New Roman"))par(mfrow=c(2,1))plot(x, type='o', col='4', family="TNM", ylab='Sales Numbers', main='Timing chart of number of units sold by the company', ylim=c(0,400))# 公司销售量样本自相关图acf(x, family="TNM", main='')title(main='Sample autocorrelation graph of the number of units sold by the company',family="TNM")# 纯随机性检验for(i in 1:2) print(Box.test(x, lag=i*5,type='Ljung-Box'))\end{lstlisting}
5. 常见错误
表格的末尾是否缺少了换行\\
表格开头{ccc}
是不是个数写少了公式环境中的align
要写成aligned
文件是否未保存到正确路径,导致图片路径报错6. 添加标题
\part*{ 在ATOM中使用 \LaTeX 撰写文章 }\centerline{\bf 我是作者}
7. 插入图片或表格(图表)
插入图片:
\begin{figure}[!htbp]\centering\includegraphics[width=4in]{../images/代码时序图.png}\caption{output_7_0} % 图标题\end{figure}
插入表格(三线表):
\begin{table}[!htbp]\centering\caption{模型汇总}\label{模型汇总4.9}\begin{tabular}{cccc}\toprule[0.1em] % 上粗线负相关系数$R$ &决定系数$R^2$ &调整的$R^2$ &回归标准误差的估计值$Se$\\\midrule % 中细线0.839&0.705 & 0.699 &1.577 \\\bottomrule[0.1em] % 下粗线\end{tabular}\end{table}
latex插入jupyter notebook代码
移步至:/Caiqiudan/article/details/117910793
分式正常显示,不要压缩变小
使用$\dfrac{}{}$
即可
一些符号
贝叶斯 核函数 :\propot