Latex学习

Latex入门

 打开Tex Live 界面

 输入如下代码

texdoc --help

界面会显示Tex Live安装的一些扩展包。

在Tex Live中,输入如下代码,即可显示相关的宏包信息:

tlmgr info amsmath

结果如下图所示:

 TeX Live 命令行工具 tlmgr 的使用示例



% 安装/卸载宏包
tlmgr install <package-name>
tlmgr remove <package-name>

% 更新所有宏包(包括 tlmgr 本身)
tlmgr update --all --self

% 列出所有可更新的宏包
tlmgr update --list

% 指定更新源地址
% <CTAN mirrors> 形如 https://mirrors.tuna.tsinghua.edu.cn/CTAN
tlmgr repository set <CTAN mirrors>/systems/texlive/tlnet

% 查看宏包信息,加 --list 参数可列出宏包的所有文件
tlmgr info <package-name>

 打开TeXworks editor编辑器

打开TexLive,如下所示的编辑器。

 新建一个文件,界面如下图所示:

 TeXworks editor使用界面

如下面代码:

\documentclass{article}
\begin{document}
'''Hello world''' from\LaTeX.
\end{document}

运行后,如下面效果所示:

放大缩小界面

按住Ctrl键,然后转动鼠标滚轮,可以放大或者缩小TeXworks,达到良好的视觉效果。

LATEX代码结构

L A TEX 源代码以一个 \documentclass 命令作为开头,它指定了文档使用的 文档类 document 环境当中的内容是文档正文。
\documentclass \begin{document} 之间的位置称为 导言区 。在导言区中常会使用
\usepackage 命令调用 宏包 ,还会进行文档的全局设置。
\documentclass{...} % ... 为某文档类
% 导言区

\begin{document}
% 正文内容


\end{document}
% 此后内容会被忽略

排版数学公式

在导引区中调用amsmath 宏包

如下面代码所示,在导引区中调用amsmath 宏包。

\documentclass{article}
\usepackage{amsmath}
\begin{document}

'''Hello world''' from\LaTeX.
\end{document}

转义符号 \

 和python类似,\ 是转义符号。如果没有 \,程序会将frac单纯当作字母。如果有\,程序才会将其当作分数符号。如下图,函数

\documentclass{article}
\usepackage{amsmath}
\begin{document}
'''Hello world''' from\ LaTeX.
\[
y=
\frac{n}{n+30}
\]
\end{document}

效果如下:

即可完成该函数。

行内公式和行间公式

如果数学公式和正文在同一行,即行内公式,则需要用$符号,放在公式的首尾

如果数学公式要另起一行,运行如下代码:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
'Hello world' from\ LaTeX.
\begin{equation}
a^2+b^2=c^2
\end{equation}
\end{document}

效果如下.

分数和无穷大符号

输入如下代码:

\documentclass{article}
\usepackage{amsmath}


\begin{document}
In display
\[
\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
= \frac{\pi^2}{6}
\]


\end{document}

效果如下:

如果需要直接使用不带编号的行间公式,则将公式用[ ] 的形式 包括进去。
无穷大的写法:\lim_{n \to \infty}
求和号的写法:\sum_{k=1}^n
分数的写法:\frac{1}{k^2}
π的写法:\pi ,注意需要加上\符号。
指数的写法:pi^2

经纬度距离公式

\documentclass{article}
\usepackage{amsmath}
 
 
\begin{document}
\[
C=2{\pi}r
\]

\[
r=\frac{C}{2\pi}
=\frac{l}{\theta}
\]

\[
{\pi}=180^\circ
\]


On the earth equator and other latitude:
\[
C=40000km=2{\pi}R
\]
\[
40000km   
——  
360^\circ
\]
\[
111km——1^\circ
\]

\[
C_{1}=2{\pi}R \times cos\theta——  360^\circ
\]
\[
111km\times cos\theta——1^\circ
\]

\[
l={\theta}{r}
={\theta}\frac{180^\circ}{\pi}{r}
={\theta} \frac{180^\circ}{\pi}  \frac{C}{2\pi}
={\theta} \frac{180^\circ}{\pi}  6371km 
\]

\[
\lim_{n \to \infty}
\sum_{k=1}^n \frac{1}{k^2}
= \frac{\pi^2}{6}
\]
 
 
\end{document}

运行代码,得到如下效果:

数学常用符号

 

 

 

 

 

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值