LaTeX 的简单使用

\documentclass{article} 
    \usepackage{amsmath,amssymb}     
    \usepackage{latexsym}     
    \usepackage{CJK}   
    
    \begin{document} 
    \begin{CJK*}{GBK}{song} 
     测试一下我的数学公式\[\int_a^b f(x)dx\]  
    \end{CJK*}     
    \end{document}

分析一下我们刚才输入的代码 
 第一行,声明文章的类型,我们这儿是论文(article)类型,文章的类型可以是书籍(book)、报告(report)、及信笺(letter);  
 第二行至第四行,声明需要调用的宏包,我们这儿调用了美国数学会的数学公式宏包(amsmath)、美国数学会的数学符号宏包(amssymb)、LATEX 的数学符号宏包(latexsym)和中文处理宏包(CJK);  
 上面的部分称为导言区,也就是正文开始前的部分。从第五行开始,就称为正文部分;  
 第五行说明正文的开始,与此对应,最后一行声明正文的结束;  
 第六行声明中文环境的开始,与此对应,倒数第二行声明中文环境的结束。  
 第七行开始,输入你想输出的内容。  





文章的各个部分
  • 生成标题,在正文的开头加入
     \title{文章的题目}
          \author{作者姓名}
          \date{2005/09/23}
          \maketitle
  • 生成目录
     \tableofcontents
  • 生成章节号
     \chapter{章的名称},\section{节的名称}
  • 生成参考文献:在正文的末尾处加上
     \begin{thebibliography}
     \bibitem{}参考文献1
     \bibitem{}参考文献2
     \end{thebibliography}
  • 分段:在两段之间插入一个空行
  • 分行:LaTeX 会自动分行,但是如果你想在某个地方强制分行,用两个反斜杠(\\)手工分行






1.第一个文档

\documentclass{article}
\begin{document}
  hello, world
\end{document}


2.标题、作者和注释

\documentclass{article}
     \author{My Name}
     \title{The Title}
\begin{document}
  \maketitle
  hello, world     % This is comment
\end{document}


3.章节和段落

\documentclass{article}
  \title{Hello, World}
\begin{document}
  \maketitle
  \section{Hello China} China is in Ease Asian.
\subsection{Hello Beijing} Beijing is the capital of China.
  \subsection{Hello Dongcheng District}
    \paragraph{Tian'anmen Square} is in the center of Beijing.
      \subparagraph{Chairman Mao} is in the center of Tian'anmen.
       Square
  \subsection{Hello Guangzhou}
    \paragraph{Sun Yat-sen University} is the best university in
     Guangzhou.
\end{document}  % 退格只是为了看起来层次清晰美观,实际操作上未必非要
                如此,每一行之前的空格不影响编译生成 PDF 的排版结果。


4.加入目录

\documentclass{article}
\begin{document}
  \tableofcontents
  \section{Hello China} China is in East Asian.
    \subsection{Hello Beijing} Beijing is the capital of China.
      \subsubsection{Hello Dongcheng District}
        \paragraph{Tian'anmen Square} is in the center of Beijing.
          \subparagraph{Chairman Mao} is in the center of Tian'anmen Square.
\end{document}


5.换行

\documentclass{article}
\begin{document}
  Beijing is
  the capital
  of China.

  New York is
  
  the capital
 
  of America.

  Amsterdam is \\ the capital \\
  of Netherlands.
\end{document}     % 空一行为另起一段,\\ 为段内强制换行


6.数学公式

\documentclass{article}
  \usepackage{amsmath}
  \usepackage{amssymb}
\begin{document}
  The Newton's second law is F=ma.

  The Newton's second law is $F=ma$.

  The Newton's second law is 
  $$F=ma$$.

  The Newton's second law is
  \[F=ma\].

  Greek letters $\eta$ and $\mu$

  Fraction $\frac{a}{b}$

  Power $a^b$

  Subscript $a_b$
  
  Derivate $\frac{\partial y}{\partial t} $

  Vector $\vec{n}$

  Bold $\mathbf{n}$

  To time differential $\dot{F}$

  Matrix {lcr here means left, center or right for each column)
  \[
    \left[
      \begin{array}{lcr}
        a1 & b22 & c333 \\
        d444 & e555555 & f6
      \end{array}
    \right]
  \]


  Equations(here \& is the symbol for aligning different rows)
  \begin{align}
    a+b&=c\\
    d&=e+f+g
  \end{align}

  \[
    \left\{
      \begin{aligned}
        &a+b=c\\
        &d=e+f+g
      \end{aligned}
    \right
  \]

\end{document}     % $...$ 开启行内数学模式,用于和文本合在一起使用
                   $$...$$ 和 \[...\] 是另起一行居中开启数学模式


7.插入图片

\documentclass{article}
  \usepackage{graphicx}
\begin{document}
  \includegraphics[width=4.00in, height=3.00in]{figure1.jpg}
\end{document}     % 老版本的 LaTeX 只支持 .eps 图片格式,现在的
                    LaTeX 对 .jpg, .bmp, .png 等格式都可支持


8.简单表格

\documentclass{article}
\begin{document}
  \begin{tabular}{|c|c|}
    aaa & b \\
    c & ddddd\\
  \end{tabular}

  \begin{tabular}{|l|r|}
    \hline
    aaa & b \\
    \hline
    c & ddddd\\
    \hline
  \end{tabular}

  \begin{center}
    \begin{tabular}{|c|c|}
      \hline
        a & b \\ \hline
        c & d\\
        \hline
    \end{tabular}
  \end{center}
\end{document}     % 注意观察有无\hline和有无\begin{center}的区别,
                    注意观察\begin{tabular}后的lcr的区别。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值