Latex学习 (教程、安装和设置、示例)

链接

视频教程(推荐)

latex中文教程-15集从入门到精通包含各种latex操作 (Bilibili) (西北农林科技大学 信息工程学院 耿楠)

配套笔记 LaTeX使用 | Chen的博客

字体问题 https://tieba.baidu.com/p/3937382897

 

安装

步骤1. CTeX (套装)

下载地址: http://www.ctex.org/CTeXDownload

CTeX包含编译器(MiKTeX)、编辑器(WinEdt)等多个软件.

步骤2. MiKTeX (编译器)

下载地址: https://miktex.org/download

我安装上CTeX之后, 其中的MiKTeX并不能用, 经过我搜索之后发现, 再安装一个MiKTeX可以解决问题.

安装的时候把CTeX自带的MiKTeX覆盖.

步骤3. TeXstudio(编辑器)

下载地址: http://texstudio.sourceforge.net/

上面提到了WinEdt这个编辑器, 但是TeXstudio更好用

 

配置

如果你跟我一样特别在乎软件的外观的话, 你一定会认为TeXstudio太丑了. 所以, 除了其它教程里提到的必要配置之外, 我这里还有一些操作是纯粹用来美化软件界面.

1. 样式

有Windows, WindowsXP, WindowsVista, Fusion, 默认5中选择. 建议选Fusion, 更好看

2. 配色方案

有经典和现代两种选择, 建议选经典. "现代"是黑色工具条, 不好看.

3. 字体

建议选微软雅黑

4. 语言

建议选中文简体(zh_CN)

5. 默认编译器

选择XeLaTeX. 默认的pdfLaTeX在某些情况下有问题

6. 字体

建议使用YaHei Consolas Hybrid (雅黑和Consolas混合字体) (百度即可下载)

7. 字号

字号选12, 否则太小

8. 默认字体编码

选择UTF-8, 最通用, 支持各种字符.

 

我的文档

我用LaTeX写了一份文档, 几乎用了我可能用到的所有功能, 下面就是例子

头部

%% head
\documentclass[UTF8]{ctexart}    % 文档类型(ctex + article)
\usepackage{geometry}
\usepackage{amsmath}            % 数学包

% 图片包
\usepackage{graphicx}            
\graphicspath{{images/},{pics/}}     % 图片默认路径

% 设置图片和表格题注的格式
\usepackage{caption}
\captionsetup[figure]{labelfont={sf},textfont={sf},labelsep=quad}
%                       /|\标签和文字设置无衬线字体    /|\ 编号后面隔一个\quad 
\captionsetup[table]{labelfont={sf},textfont={sf},labelsep=quad}

% 将图片编号和章节关联起来
\renewcommand{\thefigure}{\thesection-\arabic{figure}} % set caption label style to 1.A
% \renewcommand{\thesubfigure}{\arabic{subfigure}}

% 设置页边距
\geometry{left=3.18cm,right=3.18cm,top=2.54cm,bottom=2.54cm}
\linespread{1.5}

% 设置页眉的格式
\pagestyle{plain}
% plain - Just a plain page number.
% empty - Produces empty heads and feet - no page numbers.
% headings - Puts running headings on each page. The document style specifies what goes in the headings.
% myheadings - You specify what is to go in the heading with the \markboth or the \markright commands.

% 用于支持代码 - 列表包和颜色包
\usepackage{listings}
\usepackage{xcolor}
\lstset{
    % breaklines, 自动换行
    numbers=left, 
    % numberstyle= \tiny, 
    keywordstyle= \color{blue!70},
    commentstyle= \color{red!50!green!50!blue!50}, 
    frame=shadowbox, % 阴影效果
    rulesepcolor= \color{ red!20!green!20!blue!20} ,
    escapeinside=``, % 英文分号中可写入中文
    xleftmargin=1em,xrightmargin=1em, aboveskip=1em%,
    %framexleftmargin=2em
}

% 支持含合并单元格的表格
\usepackage{multicol}
\usepackage{multirow}

% 支持粗横线和粗竖线的表格
\usepackage{tabu}
% 粗横线 \tabucline[2pt]{-}
% 粗竖线 {c|[2pt]c|c|c|c|c}

% 斜线表头
\usepackage{diagbox}

% 设置各级标题的格式
\ctexset{
    section={   % 完整的标题由name逗号坐标+数字+逗号右边+afternum组成
        format+=\zihao{3} \heiti \mdseries,
        name={,、},    % 逗号左边为空, 右边是顿号
        number=\chinese{section},  % 数字用中文(一 二 三)
        aftername= \hspace{0pt}  % 序号之后不添加东西, 可以换成空格、Tab等等。
    },
    subsection={
        format+=\zihao{4} \heiti \raggedright \mdseries,
        number=\arabic{section}.\arabic{subsection},
    },
    subsubsection={
        format+=\zihao{-4}
    }
}

% 标题
\title{\heiti 中中中中中中(4)——中中中中}
\date{}
\author{}

正文

%% body
\begin{document}
%    \pagestyle{}
    \maketitle     % 使用标题、作者、日期等内容生成标题
    \zihao{-4}     % 全部字号设置为小四(特殊规定的除外)
    \section{概述}
    \subsection{聊天界面概述}
        中中中。中,中。中、中、中,中,中。
    \subsection{需求分析}
    中,中。如图 \ref{toolbar_img} 所示。
    \begin{figure}[ht]
        % 常用选项[htbp]是浮动格式:
        % 『h』当前位置。将图形放置在正文文本中给出该图形环境的地方。如果本页所剩的页面不够,这一参数将不起作用。
        % 『t』顶部。将图形放置在页面的顶部。
        % 『b』底部。将图形放置在页面的底部。
        % 『p』浮动页。将图形放置在一只允许有浮动对象的页面上。
        \includegraphics[width=1.0\textwidth]{toolbar}  % toolbar是文件路径, 只是省略了扩展名
        \caption{工具栏}
        \label{toolbar_img}
    \end{figure}
    
    中:中``中''中,中“中”中。中,中,中。
     
    中:中“中”中,中“中”中。中A中,中B中,中AB中。


    

    \section{技术实现}
    \subsection{使用LineRenderer绘画组件实现绘图工具}
    \label{sec:linerenderer}
    \subsubsection{LineRenderer介绍与使用过程}
    中。
    
    中:
    
    1)  中。点击菜单栏中的GameObject$>$Create Empty。
    
    2)  中。点击菜单栏中的Componet$\rightarrow$Effects>Line Render。
    
    3) 中。
    \subsubsection{使用LineRenderer绘制箭头}
    中。% 下面的语言csh是C#
        \begin{lstlisting}[language={csh}]  
if (Input.GetMouseButtonDown(0)) {
    lineRenderer.positionCount = 0; // 线性渲染器的点的个数设置为0
    from = Input.mousePosition;     // 记录手指按下的位置
    isDrawing = true;
}
        \end{lstlisting}  
        
        中,中。
        \begin{lstlisting}[language={csh}]
else if ((Input.GetMouseButtonUp(0) || Input.GetMouseButton(0))) {
    lineRenderer.positionCount = 6;
    to = Input.mousePosition;
}
        \end{lstlisting}
        
    中。设$BC$和$BD$的长度为$l$,$BC$与$BA$的夹角是$\alpha$,$BA$与水平线的夹角是$\theta $。要计算$C$和$D$两点的坐标。其中$l$和$\theta $是常数。示意图如图\ref{arrow_img} 所示。
    
    \begin{figure}[ht]
        \centering
        \includegraphics[width=0.5\textwidth]{draw_arrow}
        \caption{箭头顶点示意图}
        \label{arrow_img}
    \end{figure}

    中,$\mathrm{sin}\alpha =\frac{{y}_{2}-{y}_{1}}{\sqrt{{\left({x}_{2}-{x}_{1}\right)}^{2}+{\left({y}_{2}-{y}_{1}\right)}^{2}}}$。中$C(x_3=x_2-\cos (\alpha-\theta),y_3=y_2+\sin (\alpha-\theta)\cdot l)$,$D(x_4=x_2-\cos (\alpha+\theta)\cdot l, y_4=y_2 + \sin (\alpha + \theta)\cdot l)$。


    中$\arcsin$中,$C$、$D$中$x$中,中。


 

    \begin{lstlisting}[language={csh}]
if (isDrawing && lineRenderer.positionCount == 6) {
    float length = Mathf.Sqrt((to.x-from.x)*(to.x-from.x)+(to.y-from.y)*(to.y-from.y));
    float l = 60f;                            // BC的长度
    float alpha = -Mathf.Asin((from.y - to.y) / length);
    float theta = 0.7854f;                   // 45度角
    Vector2 p3 = new Vector2(to.x - Mathf.Cos(alpha - theta) * l * (to.x >= from.x ? 1 : -1), to.y - Mathf.Sin(alpha - theta) * l);
    Vector2 p4 = new Vector2(to.x - Mathf.Cos(alpha + theta) * l * (to.x >= from.x ? 1 : -1), to.y - Mathf.Sin(alpha + theta) * l);
    lineRenderer.SetPosition(0, from);
    lineRenderer.SetPosition(1, to);
    lineRenderer.SetPosition(2, p3);
    lineRenderer.SetPosition(3, to));
    lineRenderer.SetPosition(4, p4);
    lineRenderer.SetPosition(5, to);
}
    \end{lstlisting}
    \subsubsection{使用LineRenderer绘制矩形}
    中,中,中。绘制方式见图\ref{draw_rect}。


 

    \begin{figure}[ht]
        \centering
        \includegraphics[width=0.5\linewidth]{images/draw_rect}
        \caption{矩形的绘制示意图}
        \label{draw_rect}
    \end{figure}
    \subsubsection{使用LineRenderer进行自由绘制}
    中,中:
    \begin{lstlisting}[language={csh}]
private LinkedList<Vector2> points = new LinkedList<Vector2>();
    \end{lstlisting}
    
    中,中,中points中中。中LineRender中。
    \subsection{使用LeanTouch实现模型移动、缩放和旋转}
    \subsubsection{LeanTouch实现移动和缩放}
    LeanTouch中Unity中,中、中、中。
    
    中Unity中LeanTouch中,中。然后点击菜单栏中的GameObject$\rightarrow$Lean$\rightarrow$Touch,中。中LeanScale中、LeanTranslate中,中。中,中1中,中3中。中,中。
    \subsubsection{实现模型旋转}
    LeanTouch中LeanRotate中$Z$中,中$X$中$Y$中,中LeanRotate中。中\ref{screen_coordinate} 中。
    \begin{figure}[th]
        \centering
        \includegraphics[width=0.3\linewidth]{images/screen_coordinate}
        \caption{手机屏幕坐标系}
        \label{screen_coordinate}
    \end{figure}

    中X中Y中。中,中:
    \begin{lstlisting}[language={csh}]
camera.transform.RotateAround(model.position, Vector3.up,
    mouse_x * 30 * speed);
    \end{lstlisting}
    
    中,中$X$中:
    \begin{lstlisting}[language={csh}]
camera.transform.RotateAround(model.position,
    camera.transform.right, mouse_y * 30 * speed);
    \end{lstlisting}
    \subsubsection{实现坐标系的转换}
    中,Unity中,\ref{sec:linerenderer} 节提到的LineRender需要提供三维的坐标,中Unity中。LeanTouch中。
    
    中,中。LeanTouch中,中Camera Distance中,中。
    \begin{lstlisting}[language={csh}]
depth.Conversion = LeanScreenDepth.ConversionType.CameraDistance;
depth.Distance = 0.5f;    
    \end{lstlisting}
    
    \ref{sec:linerenderer}的代码均需要用LeanTouch进行坐标转换。
    \begin{lstlisting}[language={csh}]
depth.Convert(point, camera);
    \end{lstlisting}
    \subsection{Animator动画控制实现模型拆解}
    \label{sec:animator}
    \subsubsection{Animator介绍}
    Animator中Animation Clips(中)、Animator Controller(中)中Avatar(中)中。
    
    Unity中Animation中,中,中,中,中。Unity中Animation中,中,中。
    
    Animator Controller中。Animator中Animation中,中。
    
    中,Animation中,中。中Animator中。

    \subsubsection{使用Animator实现播放爆炸图}
    中Animation,中,中,我们设计了如下结构(图\ref{fig:animator})来实现功能。
    
    \begin{figure}[th]
        \centering
        \includegraphics[width=0.6\linewidth]{images/animator}
        \caption{Animator状态转换图}
        \label{fig:animator}
    \end{figure}

    nimator中,中;中Condition,中。中,中bool中Next中,中False,中Next=True中Next=False。
    
    中,Animation Controller中Entry中Empty(中Entry中),中。中,中,Next中True,中。中,中。
    \begin{lstlisting}[language={csh}]
if (animator.GetBool("Next")) {
    animator.SetBool("Next", false);
} else {
    animator.SetBool("Next", true);
}
    \end{lstlisting}
    
    中,Next中False,中。中,中。中,Next中True,中。中。
    \subsection{实现发送消息与同步功能}
    \subsubsection{功能概述}
    中:
    
    1) 中
    
    2) 中
    
    3) 中
    
    4) 中
    
    5) 中
    
    中。
    
    1) 中,中ID、中ID、中、中4中。
    
    2) 中、中,中。
    
    3) 中、中,中。
    \subsubsection{模型与相机状态同步}
    中,中,中。
    \begin{lstlisting}[language={csh}]
if (timer > 0.025f) {
    timer = 0;
    if (!camera.position.Equals(LastSent.position)
        || !camera.rotation.Equals(LastSent.rotation) 
        || model.localScale.x != LastSent.localScale) {
        NetworkController._instance.SendModelPosition(camera.position, camera.rotation, model.localScale.x / defaultScale);
        LastSent.position = camera.position;
        LastSent.rotation = camera.rotation;
        LastSent.localScale = model.localScale.x;
    }
}
    \end{lstlisting}
    
    中:
    \begin{lstlisting}
{
    "type":"mpos",            //model_position 模型位置的缩写
    "content":{
        "pos":{                // 相机位置
            "x":12,
            "y":12,
            "z":12,
            "scale":0.5     // 模型缩放比例
        },
        "rotate":{            // 相机旋转
            "x":12,
            "y":12,
            "z":12,
            "w":12
        }
    }
}
    \end{lstlisting}
    
    中,中type中mpos中。
    \subsubsection{画笔同步}
    中,中,中,中。中,中。
    \begin{lstlisting}[language={csh}]
if (times > 0.15f) {
    if (!Input.mousePosition.Equals(LastSent.mousePosition)) {
        NetworkController._instance.SendNewLineMessage(from, Input.mousePosition);
        LastSent.mousePosition = Input.mousePosition;
    }
    times = 0f;
}
    \end{lstlisting}
    \subsubsection{动画同步与文本消息}
    根据\ref{sec:animator} 节的介绍,中,中,中。
    
    中,中JSON中。
    \section{总结}
    中,中——中,中。中,中LineRender、Animator中LeanTouch中,中。


 

    \section{贡献人员}
    
    \begin{table}[h]
        \caption{贡献人员}
        \centering
            \begin{tabu}{c c c c}        % l-eft c-enter r-ight
            \tabucline[2pt]{1-4} % ====================================================
            \multirow{2}{*}{序号} & \multicolumn{2}{c}{个人基本信息} & \multirow{2}{*}{权重} \\
            \cline{2-3}    % 横线 从第1列到第2列
                                  & 姓名   & 出生日期                &                       \\
            \hline %-------------------------------------------------------------------
            \hline %-------------------------------------------------------------------
            1                     & 亢小龙 & 1999/1/1                & 0.4                   \\ 
            2                     & 潜中龙 & 2000/12/31              & 0.2                   \\ 
            3                     & 飞大龙 & 1998/12/31              & 1.4                   \\
            \tabucline[2pt]{1-4} % ===================================================
        \end{tabu}
    \end{table}
    \begin{table}[h]
        \centering
        \caption{斜线表头似乎无法与multirow结合}
        \begin{tabu}{c|c c}
            \tabucline[2pt]{1-}
            \diagbox{姓名}{成绩}{科目} & 语文 & 数学\\
            \hline
            刘德某                     & 100  & 99\\
            安卑某                     & 60   & 72\\
            \tabucline[2pt]{1-}
        \end{tabu}
    \end{table}
\end{document}

PDF画统计图使用的包: pdfplots

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值