Latex学习笔记(二)

整体源代码:

\documentclass[UTF8, 12pt, a4paper]{article}

%%%% 设置宏包
% 添加设置首行缩进
\usepackage{indentfirst}
% 添加中文包
\usepackage{ctex} 
%\usepackage{amsmath}
% 添加图片插入功能
\usepackage{graphicx}
%\usepackage{subfigure}
%\usepackage{amssymb}
% 添加文档页边距设置
\usepackage{geometry}
% 添加目录超链接
\usepackage[hidelinks]{hyperref}
% 添加列表编号设置
\usepackage{enumerate}
% 添加图片标题设置
\usepackage{caption}
% 添加代码语句支持
\usepackage{listings}
% 添加颜色支持
\usepackage{xcolor}

% \indent\setlength{\parindent}{2em} % 首行缩进指令
% \eqno{(3.1)}                       % 公式标号

% 文档页面属性设置
\geometry{left=1.80cm,right=1.80cm,top=1.80cm,bottom=1.80cm}
% 设置首行缩进2个字符
\setlength{\parindent}{2em}
% 设置图注去除冒号
\captionsetup[figure]{labelformat=default,labelsep=space}
% 设置代码块属性设置
\lstset{
    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=2em,xrightmargin=2em, aboveskip=1em,
    framexleftmargin=2em
} 


% 设置文档标题、作者、时间
\title{机器人轨迹规划:轨迹优化}
\author{Author}
\date{2020年12月4日}

% 文档开始
\begin{document} 
    % 一号子标题
    \section{列表使用}
    机器人最优实践轨迹生成,就是所谓TOPP(Time Optimal Path Parametrization)问题。
    \begin{itemize}
        \item Numeric Integration:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item A New Approach to Time-Optimal Path Parameterization based on Reachability Analysis, Hung Pham, Quang-Cuong Pham.
            \item A General, Fast, and Robust Implementation of the Time-Optimal Path Parameterization Algorithm, Quang-Cuong Pham.
            \item Essential Properties of Numerical Integration for Time-optimal Trajectory Planning Along a Specified Path.
        \end{enumerate}
        \item Convex Optimization:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item Time-Optimal Path Tracking for Robots: A Convex Optimization Approach, Diederik Verscheure et al.
        \end{enumerate}
    \end{itemize}
    
    \newpage
    % 一号子标题
    \section{图片和公式使用展示}
    当给出$n+1$个点时,使用$n$个$p$次多项式代替唯一的$n$次插值多项式,每个多项式定义一段轨迹。以这种方式定义的总函数$s(t)$成为$p$阶样条曲线。$p$的值是根据所需的样条连续度来选择的。
    \par
    例如为了在两个连续段之间发生过渡的时刻$t_k$获得速度和加速度的连续性,可以假定多项式的阶数$p=3$(三次多项式)。
    \begin{figure}[ht]
        % 设置图注编号    
        \renewcommand {\thefigure} {\thesection{}.\arabic{figure}}
        \centering
        \includegraphics[scale=0.6]{figures/spline_trajectory.jpg}
        \caption{三次样条曲线}
    \end{figure}
    
    The Pythagorean theorem is:
    \begin{equation}
        % 设置公式编号    
        \renewcommand {\theequation} {\thesection{}.\arabic{equation}}
        a^2 + b^2 = c^2 \label{pythagorean}
    \end{equation}
    
    \newpage
    % 一号子标题
    \section{代码块展示}
    
    % 代码格式设置
    \lstset{language=tex, tabsize=2}
    \begin{lstlisting}
    \begin{itemize}
        \item Numeric Integration:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item A New Approach to Time-Optimal 
            \item A General, Fast, and Robust Implementation
            \item Essential Properties of Numerical Integration
        \end{enumerate}
        \item Convex Optimization:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item Time-Optimal Path Tracking for Robots
        \end{enumerate}
    \end{itemize}
    \end{lstlisting}
    
    % 文档结束
\end{document}

效果展示:

列表效果

图片和公式使用效果

代码块展示

1. 列表编号

% 引入列表编号的包
\usepackage{enumerate}

% 列表编号代码
    \begin{itemize}
        \item Numeric Integration:
        \begin{enumerate}
            % 设置列表编号,将列表编号修改为[1].展示
            \renewcommand{\labelenumi}{[\theenumi].}
            \item A New Approach to Time-Optimal Path Parameterization based on Reachability Analysis, Hung Pham, Quang-Cuong Pham.
            \item A General, Fast, and Robust Implementation of the Time-Optimal Path Parameterization Algorithm, Quang-Cuong Pham.
            \item Essential Properties of Numerical Integration for Time-optimal Trajectory Planning Along a Specified Path.
        \end{enumerate}
        \item Convex Optimization:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item Time-Optimal Path Tracking for Robots: A Convex Optimization Approach, Diederik Verscheure et al.
        \end{enumerate}
    \end{itemize}

常见的列表有:

  • 无序列表
  • 有序列表
  • 列表嵌套
    具体的使用方法可以查看参考链接中的列表环境的使用

2. 行内和行间公式插入

当给出$n+1$个点时,使用$n$个$p$次多项式代替唯一的$n$次插值多项式,
每个多项式定义一段轨迹。以这种方式定义的总函数$s(t)$成为$p$阶样条曲线。
\par
    The Pythagorean theorem is:
    \begin{equation}
        % 设置公式编号    
        \renewcommand {\theequation} {\thesection{}.\arabic{equation}}
        a^2 + b^2 = c^2 \label{pythagorean}
    \end{equation}
  • 行内公式使用$equation$插入
  • 行间公式使用equation标签插入,同时需要公式进行编号设置
    \begin{equation}
        % 设置公式编号    
        \renewcommand {\theequation} {\thesection{}.\arabic{equation}}
        a^2 + b^2 = c^2 \label{pythagorean}
    \end{equation}
    

3. 图片插入和设置

% 添加图片插入功能
\usepackage{graphicx}
% 添加图片标题设置
\usepackage{caption}

% 设置图注去除冒号
\captionsetup[figure]{labelformat=default,labelsep=space}

\begin{figure}[ht]
    % 设置图注编号    
    \renewcommand {\thefigure} {\thesection{}.\arabic{figure}}
    \centering
    \includegraphics[scale=0.6]{figures/spline_trajectory.jpg}
    \caption{三次样条曲线}
\end{figure}

一般情况下,图片插入会在图片序号出有冒号,所以需要去除冒号,同时根据科学文献的格式,设置图注为图 1.1,借助\renewcommand {\thefigure} {\thesection{}.\arabic{figure}}进行图片序号设置。对于表格,也可以使用该方法修改表格序号,\renewcommand {\thetable} {\thechapter{}.\arabic{table}}

4. 代码块支持

% 添加代码语句支持
\usepackage{listings}
% 添加颜色支持
\usepackage{xcolor}

% 代码块全局设置
% 设置代码块属性设置
\lstset{
    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=2em,xrightmargin=2em, aboveskip=1em,
    framexleftmargin=2em
} 

% 代码块语言和缩进设置
\lstset{language=tex, tabsize=4}
\begin{lstlisting}
    \begin{itemize}
        \item Numeric Integration:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item A New Approach to Time-Optimal 
            \item A General, Fast, and Robust Implementation
            \item Essential Properties of Numerical Integration
        \end{enumerate}
        \item Convex Optimization:
        \begin{enumerate}
            % 设置列表编号
            \renewcommand{\labelenumi}{[\theenumi].}
            \item Time-Optimal Path Tracking for Robots
        \end{enumerate}
    \end{itemize}
\end{lstlisting}

5. 参考资料

【1】列表环境的使用
【2】图标序号插入章节号

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,490评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,581评论 3 395
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 165,830评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,957评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,974评论 6 393
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,754评论 1 307
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,464评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,357评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,847评论 1 317
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,995评论 3 338
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,137评论 1 351
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,819评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,482评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,023评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,149评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,409评论 3 373
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,086评论 2 355

推荐阅读更多精彩内容

  • 源文件的基本结构 一个latex文件分为两个区域,一个是导言区,导言区主要用于全局设置;另一个是正文区(文稿区),...
    richybai阅读 1,297评论 1 7
  • 今天主要总结了latex的一些基本配置和使用latex进行科技论文写作的基本要素(书写文档,插入表格,插入图片,插...
    taozhaojun阅读 13,143评论 1 22
  • 为什么学习Markdown 自从搭建了 Hexo 博客之后,发现还有 Markdown 这种写文章的方法,想到以后...
    lifeColder阅读 20,161评论 10 216
  • 目录 [TOC] 本系列是有关LaTeX的学习系列,共计19篇,本章节是第19篇。前一篇:18LaTeX学习系列之...
    张一根阅读 29,766评论 4 51
  • 为了解决自动化报告之类的问题,测试了几种不同的方案之后,我选了 LaTex。利用 LaTex 生成 PDF 文档可...
    wangpeng905阅读 29,794评论 6 63