latex学习之图表和公式
一、数学公式输入
1 使用mathtype
首先mathtpye中要设置为latex代码,如下图。设置后,在mathtype中输入的公式复制后可变为代码粘贴到texstudio中。

例如:输出为行列式方程
\[\left( \begin{array}{l}1\;\;4\;\;6\\2\;\;7\;\;8\\3\;\;8\;\;0\end{array} \right)\left( \begin{array}{l}{x_1}\\{x_2}\\{x_3}\end{array} \right) = \left( \begin{array}{l}2\\3\\4\end{array} \right)\]
\[\left( \begin{array}{l}1\;\;4\;\;6\\2\;\;7\;\;8\\3\;\;8\;\;0\end{array} \right)\left( \begin{array}{l}{x_1}\\{x_2}\\{x_3}\end{array} \right) = \left( \begin{array}{l}2\\3\\4\end{array} \right) \eqno (2)\]
加入\eqno (2)为公式编号,其他不晓得一堆什么东西,这就不用学代码了哈哈哈哈哈哈
2 下面是一些标签符号
% 定理 \begin{Theorem} \end{Theorem}
% 引理 \begin{Lemma} \end{Lemma}
% 证明 \begin{proof} \end{proof}
这一part暂时没啥要写的了
二、插入图表
1 图片
插入一张图片
\begin{figure}[h]
\small
\centering %居中
\includegraphics[width=8cm]{example-image-a} %宽度高度 图片a
\caption{The name of figure}
\label{fig:aa} %标题
\end{figure}
成功了嘿嘿

插入并列图片
需要的宏包是:\usepackage{subfigure},要放在引言部分。
使用方法是\subfigure[单个图片的名称]{\includegraphics[图片参数]{文件夹中图片名称}}
代码:
\begin{figure}[h]
\centering
\subfigure[1]{
\includegraphics[width=0.45\textwidth]{1} }
\subfigure[2]{
\includegraphics[width=0.45\textwidth]{2}}
\caption{The price terms}
\label{The price terms}
\end{figure}
又成功了嘿嘿

2 表格
普通环境tabular
\begin{tabular}{|l|c|r|} # |l|c|r|:第一列居左第二列居中第三列居右,四条竖线代表表格框架的四条竖线
\hline #画第一条横线
指标1&指标2&指标3\\ #每一列用&隔开,最后以\\结尾
\hline #画第二条横线
居左&居中&居右\\
\hline #画第三条横线
\end{tabular}
三线表
\begin{center}
\begin{spacing}{1.1}
%longtable的意思是 这个表格可以跨页
\begin{longtable}{p{.1\textwidth}p{.7\textwidth}m{.3\textwidth}}
\caption{description}
\label{table1}
\toprule %第一行线
%表示第一列占1.5cm 第二列占6cm 第三列占2cm 的距离 并且这几个字都是居中对齐
\multicolumn{1}{m{1.5cm}}{\centering Symbol} & \multicolumn{1}{m{6cm}}{\centering Definition} & \multicolumn{1}{m{2cm}}{ Unit} \\
\midrule %第二行线
$V$ & index & -- \\
$X$ & The & -- \\
$Y$ & The & -- \\
$Z$ & The & -- \\
\bottomrule %第三行线
\end{longtable}
\end{spacing}
\end{center}

更复杂的
\begin{table*}[]
\scriptsize
\centering
\caption{Optimized results of the circular arch for different slenderness and opening angles}
\label{Tab03}
\begin{tabular}{cccccccccc}
\toprule
\multirow{2}{*}{Opening angle} & \multicolumn{3}{c}{$R/r=10$} & \multicolumn{3}{c}{$R/r=25$} & \multicolumn{3}{c}{$R/r=50$} \\
\cmidrule(r){2-4} \cmidrule(r){5-7} \cmidrule(r){8-10}
& $\omega_{1} (\%)$ & $r_{{\rm min}}/r_0$ & $r_{{\rm max}}/r_0$
& $\omega_{1} (\%)$ & $r_{{\rm min}}/r_0$ & $r_{{\rm max}}/r_0$
& $\omega_{1} (\%)$ & $r_{{\rm min}}/r_0$ & $r_{{\rm max}}/r_0$ \\
\midrule
$\varphi=60^{\circ} $ &3.920 & 0.793 & 1.355 & 5.243 & 0.558 & 1.122 & 6.694 & 0.503 & 1.133 \\
$\varphi=90^{\circ} $ &4.061 & 0.660 & 1.106 & 7.242 & 0.500 & 1.136 & 8.060 & 0.501 & 1.140 \\
$\varphi=120^{\circ} $ &6.480 & 0.558 & 1.127 & 9.011 & 0.500 & 1.145 & 9.535 & 0.500 & 1.147 \\
$\varphi=150^{\circ} $ &8.756 & 0.500 & 1.142 & 10.763 & 0.500 & 1.153 & 11.126 & 0.500 & 1.155 \\
\bottomrule
\end{tabular}
\end{table*}

实在是太太太太太太麻烦了,所以还是excel转latex表吧。
用excel2latex ,下载见这篇https://blog.csdn.net/LF21011501/article/details/89684798

代码直接复制过去会很丑,还需要调整。

把上方代码cc换成p{2cm}p{3cm}l,即
\begin{tabular}{p{2cm}p{3cm}l} #设置列的宽度

图表学到这里!
三、字体字号
Latex 设置字体大小命令由小到大依次为:
\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge