当前位置: 首页 > news >正文

LaTeX学习笔记

  LaTeX是一种排版系统,有些像网页设计语言HTML,Word也是一种排版系统,它属于所见即所得的排版系统,而LaTeX主要用代码来排版含有很多数学符号和公式的科技类文章或书籍。LaTeX是用TeX语言编写的一组宏代码,TeX是LaTeX的基础,TeX是在计算机科学家高德纳在修订《计算机程序设计艺术》时,为了排版这一部书籍而产生的。现已成为国际上数学、物理、计算机等科技领域专业排版的事实标准。

  首先总结一下排版公式的代码,公式主要分为行内公式和行外公式两种:

  行内公式代码:

\documentclass{article}
\begin{document}
    $\Delta=a^2-4ac$
\end{document}

  行外公式可分为以下几种代码:

\documentclass{article}
\begin{document}
    \[
            \Delta=a^2-4ac
    \]
\end{document}    
\documentclass{article}
\begin{document}
    \begin{equation}  
            \Delta=a^2-4ac
    \end{equation}
\end{document}    

TeX原本是面向西文写作的,如果想加载中文排版,需要加入以下代码:

\documentclass[UTF8]{ctexart}
\begin{document}
    \section{判别式公式}
    \begin{equation}  
            \Delta=a^2-4ac
    \end{equation}
\end{document}    

排版表格的代码:

\documentclass{article}
\begin{document}
    \begin{table}[h]
        \begin{tabular}{*{5}c}
            \hline
            $a$ & $b$ & $c$ \\
            \hline
            3 & 4 & 5       \\
            \hline
            12 & 13 & 15    \\
            \hline 
        \end{tabular}
        \qquad
        $
            \left(
                A^2+B^2=C^2
            \right)
        $ 
        $(A^2+B^2=C^2)$  %一般情况不用这种方式,不够美观
    \end{table}
\end{document} 

 排版图片代码:

\documentclass{article}
\usepackage{MCMthesis}
\begin{document}
    \begin{figure}
    \centering
    \includegraphics[width=12cm]{1.jpg}
    \caption{first picture}
    \label{fig:2}
    \end{figure}
\end{document}

几张图片并列情况:

\documentclass{article}
\usepackage{MCMthesis}
\usepackage{subfigure}
\begin{document}
    \begin{figure*}[h|t]
    \centering
    \subfigure[Number of elements read]
    {\includegraphics[height=2in,width=2in]{aaa.eps}}
    \subfigure[Size of disk files scanned] {\includegraphics[height=2in,width=2in]{aaa.eps}}
    \subfigure[Three picture]
    {\includegraphics[height=2in,width=2in]{aaa.eps}}
    \label{fig5}
    \end{figure*}
\end{document}  

 标题排版代码:

\documentclass{article}
\begin{document}
        \section{First}
        \section{Second}
        \section{Third}
          \subsection{first}
\end{document} 

文章字体代码:

  LaTeX设置字体大小命令由小到大依次为:

\tiny
\scriptsize
\footnotesize
\small
\normallsize
\large
\Large
\LARGE
\huge
\Huge

\documentclass{article}
\begin{document}
    \small{I'm scottding}

    \normalsize{I'm scottding}

    \large{I'm scottding}

    \Large{I'm scottding}

    \LARGE{I'm scottding}

    \huge{I'm scottding}

    \Huge{I'm scottding}
\end{document} 
或者
\documentclass{article}
\begin{document}
\Large
    I'm Scottding

\LARGE
    I'm Scottding
\end{document}

字体加粗:

\documentclass{article}
\begin{document}
    \textbf{I'm scottding}
\end{document}

字体为斜体:

\documentclass{article}
\begin{document}
    \emph{I'm scottding}
\end{document} 
或
\documentclass{article}
\begin{document}
    \emph
    I'm scottding
\end{document} 

即加粗又斜体:

\documentclass{article}
\begin{document}
    \emph{
        \textbf{
            I'm scottding
              }
        }
\end{document} 

文字下方添加下划线:

\documentclass{article}
\begin{document}
    \underline{ I'm Scottding }
\end{document} 

 参考文献的排版:

\documentclass{article}
\begin{document}
    \begin{thebibliography}{99}
    \bibitem{1} http://eblog.cersp.com/userlog16/29980/archives/2007/540390.shtml
    \bibitem{2} http://www.stats.gov.cn/tjsj/ndsj/
    \bibitem{3} http://www.chinacitywater.org/zwdt/ldzs/71793.shtml
    \end{thebibliography}
\end{document}

参考文献的在文中的引用:

\cite{文献编号}

附录中添加代码的格式:

\documentclass{article}
\usepackage{MCMthesis}
\begin{document}
    \section{appendices}
        \subsection{First appendix}
            Here are simulation programmes we used in our model as follow.\\

            \textbf{\textcolor[RGB]{0.98,0.00,0.00}{Input matlab source:}}
            \lstinputlisting[language=Matlab]{./code/matlab1.m}
        \subsection{Second appendix}
            \textcolor[RGB]{0.98,0.00,0.00}{\textbf{Input C++ source:}}
            \lstinputlisting[language=C++]{./code/sudoku.cpp}
\end{document}

 表格嵌套:

\documentclass{article}
\usepackage{multirow}
\begin{document}
    \begin{table}[!h]
        \centering
        \label{scottding}
        \caption{Scottding}
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}
            \hline
            \multirow{2}{*}{Scott} & 
            \multirow{2}{*}{Ding}  &  
            \multicolumn{2}{|c|}{Scott} & 
            \multicolumn{2}{|c|}{Ding} \\
            \cline{3-6}
            & & scottding & scottding & scottding & scottding \\
            \hline
            scottding1 & scottding2 & scottding3 & scottding4 & scottding5 & scottding6  \\
            \cline{1-6}
        \end{tabular}
    \end{table}
\end{document}

 合并单元格:

umentclass{article}
\usepackage{multirow}
\begin{document}
    \begin{table}[!h]
        \centering
        \label{scottding}
        \caption{Scottding}
        \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
            \hline
             \multirow{3}{*}{Scottt}                         & 
                   \multirow{3}{*}{Ding}                          &  
             \multicolumn{2}{|c|}{\multirow{2}{*}{Scott}}         &
                 \multicolumn{2}{|c|}{\multirow{2}{*}{Ding}}           \\
                &    &  \multicolumn{2}{|c|}{}  & \multicolumn{2}{|c|}{}  \\
            \cline{3-6}
                  &              &      sss &    sss &   sss &  sss  \\
            \hline 
        \end{tabular}
    \end{table}
\end{document}

 

转载于:https://www.cnblogs.com/NYNU-ACM/p/4264908.html

相关文章:

  • 杭电OJ BestCoder28期1001Missing number问题(小技巧偏移法)
  • Ecshop系统二次开发教程及流程演示
  • C#的百度地图开发(一)发起HTTP请求
  • python学习
  • MySQL STRAIGHT_JOIN
  • 数据结构之线性结构
  • lucene查询排序结果原理总结
  • Azure 中的多个 VM NIC 和网络虚拟设备
  • poj 1236 scc强连通分量
  • Javascript模块化编程(一):模块的写法
  • leetcode[44]Wildcard Matching
  • scanf,sscanf利用format跳过干扰的空格
  • 无线路由器之间桥接组网
  • busybox中的tftp使用
  • 庙庙湖
  • php的引用
  • Angular 响应式表单之下拉框
  • Apache Zeppelin在Apache Trafodion上的可视化
  • Asm.js的简单介绍
  • CSS 专业技巧
  • IDEA常用插件整理
  • java第三方包学习之lombok
  • leetcode378. Kth Smallest Element in a Sorted Matrix
  • node学习系列之简单文件上传
  • Python进阶细节
  • Python学习之路13-记分
  • Python中eval与exec的使用及区别
  • 从setTimeout-setInterval看JS线程
  • 机器人定位导航技术 激光SLAM与视觉SLAM谁更胜一筹?
  • 罗辑思维在全链路压测方面的实践和工作笔记
  • 盘点那些不知名却常用的 Git 操作
  • 如何打造100亿SDK累计覆盖量的大数据系统
  • 实现菜单下拉伸展折叠效果demo
  • 线性表及其算法(java实现)
  • 优秀架构师必须掌握的架构思维
  • 第二十章:异步和文件I/O.(二十三)
  • ​【C语言】长篇详解,字符系列篇3-----strstr,strtok,strerror字符串函数的使用【图文详解​】
  • ​软考-高级-信息系统项目管理师教程 第四版【第23章-组织通用管理-思维导图】​
  • # Swust 12th acm 邀请赛# [ A ] A+B problem [题解]
  • #!/usr/bin/python与#!/usr/bin/env python的区别
  • #if和#ifdef区别
  • #多叉树深度遍历_结合深度学习的视频编码方法--帧内预测
  • (04)odoo视图操作
  • (C语言)输入自定义个数的整数,打印出最大值和最小值
  • (Repost) Getting Genode with TrustZone on the i.MX
  • (附源码)计算机毕业设计SSM疫情社区管理系统
  • (四) Graphivz 颜色选择
  • (四)库存超卖案例实战——优化redis分布式锁
  • .cn根服务器被攻击之后
  • .net FrameWork简介,数组,枚举
  • .NET 中使用 Mutex 进行跨越进程边界的同步
  • .NET成年了,然后呢?
  • .NET单元测试
  • .NET的微型Web框架 Nancy
  • .net利用SQLBulkCopy进行数据库之间的大批量数据传递