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

### LaTeX 学习笔记模板示例 为了创建一份结构清晰且美观的学习笔记,可以采用如下所示的 LaTeX 模板。此模板不仅适用于记录日常学习心得,也适合撰写较为正式的技术文档。 #### 文档类声明与包导入 ```latex \documentclass[a4paper,12pt]{article} % 导入必要的宏包 \usepackage{amsmath} % 数学公式支持 \usepackage{graphicx} % 插图功能 \usepackage{hyperref} % 超链接支持 \usepackage{geometry} % 页面布局调整 \usepackage{listings} % 代码高亮显示 \usepackage{xcolor} % 颜色定义和支持 ``` #### 设置页面参数 ```latex \geometry{left=3cm,right=3cm,top=2.5cm,bottom=2.5cm} ``` #### 定义颜色用于代码高亮 ```latex \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} \definecolor{codepurple}{rgb}{0.58,0,0.82} \definecolor{backcolour}{rgb}{0.95,0.95,0.92} \lstdefinestyle{mystyle}{ backgroundcolor=\color{backcolour}, commentstyle=\color{codegreen}, keywordstyle=\color{magenta}, numberstyle=\tiny\color{codegray}, stringstyle=\color{codepurple}, basicstyle=\ttfamily\footnotesize, breakatwhitespace=false, breaklines=true, captionpos=b, keepspaces=true, numbers=left, numbersep=5pt, showspaces=false, showstringspaces=false, showtabs=false, tabsize=2 } ``` #### 开始文档主体部分 ```latex \begin{document} \title{LaTeX 学习笔记} \author{} \date{\today} \maketitle \tableofcontents \newpage \section{前言} 本篇笔记旨在记录个人在探索 LaTeX 排版系统的历程中的点滴体会[^2]. \section{基础语法概览} 介绍一些常用的命令和环境... \subsection{段落与分行} 描述如何控制文本格式... \subsection{列表构建} 列举几种不同类型的列表及其用法... \section{数学模式入门} 讲解怎样输入简单的数学表达式以及更复杂的方程式组... \section{图形处理指南} 分享关于插入图片的方法及注意事项... \section{表格设计实例} 展示 table 和 array 环境的区别,并给出具体的应用场景[^4] \section{参考文献管理} 说明 bibtex 的基本概念并提供实际案例来演示其应用方式[^3] \end{document} ``` 上述模板涵盖了从标题页到目录再到各个章节的具体内容框架,还包括了对数学公式、图表的支持,同时也涉及到了参考文献管理和代码片段嵌入等功能模块的设计思路。通过这样一个完整的例子可以帮助新手更好地理解 LaTeX 的工作原理并快速上手实践。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值