LaTeX 学习笔记
参考博客:
https://www.cnblogs.com/cmi-sh-love/p/latex-xue-xiji-chu-zhi-shi.html
https://www.jianshu.com/p/0f3d4bb20712
https://www.cnblogs.com/yifdu25/p/8330652.html
https://blog.csdn.net/onemorepoint/article/details/86157954
pdflatex与xelatex
http://www.latexstudio.net/archives/462.htmlTIKZ
LaTex符号大全(LaTeX_Symbols)
https://blog.csdn.net/weixin_43848614/article/details/117126250
文章目录
在word中轻松将mathtype公式转换成latex
选定你要转换的公式,也可以全选
“Alt + \”即可实现转换
这时你把选定的文字粘贴到latex中即可。
继续按 “Alt + \”,可将word中的代码转化为mathtype公式
${{\log }_{2}}x\text{+}1$
数学式行文规范
数学排式规范
数学式很长时,应该怎么排版
数学式在正文文字中的排版形式往往被分为另 行居中排和串文排版两种公式排版形式。
• 串文排版指的是在排版中数学式的一侧或两侧 排有正文文字的位置设计形式。
在使用串文排版的时候,串文中的数学式子与正文的文字之间应留不小于1个字宽度的空白。
•居中排版就如其字面意思所示的那样,数学式子 相对正文来说,独占一行,并且在这种排版形式 中,数学式子的位置大多数位于所占行的中间, 而该行的其他位置则不进行任何的文字排版。
无法识别中文
识别中文
\documentclass{ctexart}
\documentclass{ctexart}
\begin{document}
Hello,你好
\end{document}
LaTex中多行注释方法
https://blog.csdn.net/fandroid/article/details/45217133
解决方法:
- 单行注释:直接加入%即可;
- 多行注释:使用\usepackage{verbatim}宏包,然后在待注释的部分上加入
\begin{comment} … \end{comment}
,那么中间的部分即被注释掉; - 使用\iffalse …. \fi ,那么中间被包含的部分就被注释掉了;
\iffalse
\documentclass{minimal}
\begin{document}
Hi,
\end{document}
\fi
\documentclass{ctexart}
\begin{document}
Hello,你好
\end{document}
使用不同中文字体
\documentclass{ctexart}
\begin{document}
Hello,你好\\ % \\ 换一行; 注首字段默认空两格
\songti 中文测试\\ %宋体
\kaishu 中文测试\\ %楷书
\fangsong 中文测试\\ %仿宋
\youyuan 中文测试\\ %幼圆
\lishu 中文测试\\ %隶书
\heiti 中文测试\\ %黑体
\yahei 中文测试\\ %雅黑
\end{document}
cmd命令查找系统提供的字体
fc-list
导言区
设置默认英文字体:
setmianfont{}
设置中日韩默认字体
setCJKmianfont{}
方正姚体
参考文献
\begin{thebibliography}{99}
\end{thebibliography}
你是说latex吗?
\begin{thebibliography}{99}
\bibitem{oula}
F. Oula. A fancy paper title. IEEE Transactions on Image Processing, 34(10), pp:1234-2345.
\bibitem{gauss}
F. Gauss. A fancy paper title. IEEE Transactions on Image Processing, 34(10), pp:1234-2345.
\end{thebibliography}
这段命令可以导入
标记引用 (Make citations). 当你在文档中想使用引用时, 插入 LaTeX 命令
\cite{引用文章名称}
\cite{oula}
\documentclass{minimal}
\begin{document}
\title{符号}
\% \# \{ \} \~{} \& \$ \textbackslash \\% \~{}空了一格,防止重叠
different %英文中的练字现象
\end{document}
带编号的公式
xelatex - v 更新
字体说明作用于后续文本, {}设置分组,确定字体范围
给定了模板无需排版,直接写内容
% 4 字体字号设置
%\iffalse
% 导言区
\documentclass{article}
\usepackage{ctex}
\title{\heiti 我的第一个文档 MY Frist Document}
\author{\heiti 何为 HaoWeixl}
\date{\today}
% 正文区(文稿区)
\begin{document}
%字体族设置(罗马字体、无衬线字体,打字机字体)
\textrm{Roman Family} %设置{}内的字体
\sffamily you are ok
\rmfamily Roman Family %声明后续字体为罗马字体
{\ttfamily you are ok }%设置{}内的字体
% 字体系列设置(粗细、宽度)
\textmd{Medium Series} \textbf{Boldface Series}
{\mdseries Medium Series} {\bfseries Boldface Series}\\
% 中文字体
{\songti 宋体} \quad {\heiti 黑体} \quad {\fangsong 仿宋} \quad {\kaishu 楷书}
中文字体的\textbf{粗体} \textit{斜体}\\
% 字体大小声明的设置
\end{document}
chapter产生带章节的大纲
需要输入空格时: \quad 一个当前字体的宽度
latex的Table参数
/begin{itemize}
/end{itemize}
经常会看到Table或者Figure后面加上[htb],其中h表示here, t –top, b-bottom,即表格在文中的位置。那么[htb]是按照其顺序排列进行选择,即h, t ,b顺序。
/begin{figure}[htb!]
调整表格列高、行高及大小。可以使用:
/begin{table} /renewcommand{/arraystretch}{1.5} //调整行高到原来1.5倍
/begin{table} /addtolength{/tabcolsep}{-2pt} //减少列宽-2pt
/begin{table} /small //缩小表格尺寸到最小
表格的对齐及边框。此处,l表示left, r表示right, c表示center。上面表示表共有5列,列中文字分别是左、右、右、右、中对齐。
/begin{tabular}{|l||r|r|r|c|}
图片居中
方法1:
\centerline{\includegraphics[width=12cm]{KaribaDam}}
方法2:
\begin{figure}[htbp]
\centering
\includegraphics[width=12cm]{KaribaDam}
\caption{Kariba Dam}
\label{fig-KaribaDam}
\end{figure}
分点论述
\begin{enumerate}
\item In the phase of modeling, we don’t consider extreme conditions on the river, like
waterfalls, water cutoff seasons. Because these conditions require extremely big
data. They are even unnecessary for in real life dams have dynamic strategies to
handle them. We will discuss emergency water flow situations in another Section.
\item Other existing dams are ignored. They are not as big as Kariba Dam. Few data
about other dams on the river are accessible, especially thier effects on runoff of
the river and slope of its hydraulic grade line. This assumption is flexible because
it only affects the input data of the river, but not our model.
\item We simplifies the water flow into an open-channel flow. Open-channel flow has a
free surface. Based on this assumption, we are able to estimate the average velocity
of the river’s water flow.
\end{enumerate}
段首顶格
\noindent
图片并排
\begin{figure}[htbp]
\subfigure[1]{
\begin{minipage}{6cm}
\includegraphics[width=8cm]{1}
\end{minipage}
}
\subfigure[2]{
\begin{minipage}{6cm}
\includegraphics[width=8cm]{2}
\end{minipage}
}
\end{figure}
表格背景色
用到的包:
\documentclass[12pt]{article}
\usepackage{textcomp,booktabs}
\usepackage[usenames,dvipsnames]{color}
\usepackage{colortbl}
\definecolor{mygray}{gray}{.9}
\definecolor{mypink}{rgb}{.99,.91,.95}
\definecolor{mycyan}{cmyk}{.3,0,0,0}
\parindent=0pt
\parskip=3ex
\begin{document}
\centering
样式1:
\begin{tabular}{>{\sf }lll} %
\toprule
& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}
& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum & 900 & 24.3 \\
\rowcolor{mygray}
Copper & 385 & 24.4 \\
Gold & 130 & 25.6 \\
\rowcolor{mygray}
Steel/Iron & 450 & 25.0 \\
Lead & 130 & 26.8 \\
\rowcolor{mygray}
Mercury & 140 & 28.0 \\
Water & 4190 & 75.4 \\
\rowcolor{mygray}
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}
样式2:
\begin{tabular}{>{\columncolor{mypink}\sf }lll@{}}
\toprule
\rowcolor{white}
& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}
\rowcolor{white}
& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum & 900 & 24.3 \\
Copper & 385 & 24.4 \\
Gold & 130 & 25.6 \\
Steel/Iron & 450 & 25.0 \\
Lead & 130 & 26.8 \\
Mercury & 140 & 28.0 \\
Water & 4190 & 75.4 \\
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}
样式3:
\begin{tabular}{@{}>{\sf }lll@{}}
\toprule
& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}
& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum & 900 & 24.3 \\
Copper & 385 & 24.4 \\
Gold & 130 & 25.6 \\
Steel/Iron & 450 & 25.0 \\
Lead & 130 & 26.8 \\
Mercury & 140 & 28.0 \\
Water & 4190 & 75.4 \\
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}}
饼图
\usepackage{tikz}
%--------------------------------------------------
\newcommand{\pie}[1]{
\begin{tikzpicture}[scale=3]
\newcounter{Cnta} \newcounter{Cntb}
\foreach \p/\t/\c in {#1}{
\setcounter{Cnta}{\value{Cntb}}
\addtocounter{Cntb}{\p}
\pgfmathparse{\theCnta/100*360} \let\Astart\pgfmathresult
\pgfmathparse{\theCntb/100*360} \let\Aend\pgfmathresult
% \let\Astart\theCnta/100*360
% \let\Aend\theCntb/100*360
\pgfmathparse{0.5*\Astart+0.5*\Aend} \let\midangle\pgfmathresult
% slice
\draw[thick,draw=white,fill=\c!70] (0,0) -- (\Astart:1) arc (\Astart:\Aend:1) -- cycle;
% outer label
\node[label=\midangle:\textcolor{\c}{\t}] at (\midangle:1) {};
% inner label
\pgfmathparse{min((\Aend-\Astart-10)/110*(-0.3),0)}
\let\temp\pgfmathresult
\pgfmathparse{max(\temp,-0.5) + 0.8}
\let\innerpos\pgfmathresult
\node at (\midangle:\innerpos) {\textcolor{white}{\p\%}};
}
\end{tikzpicture}
}
%--------------------------------------------------
%\pie{20/类型 A/black, 4/苹果 B/green, 11/type C/red, 49/type D/blue, 16/other/orange}