热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

记录一些Latex的技巧

Latex一些技巧:1.如何创建不浮动的的figure和table\makeatletter\newcommand{\figcaption}{\def\captyp

Latex 一些技巧:

1. 如何创建不浮动的的 figure 和 table

\makeatletter
\newcommand{\figcaption}{\def\@captype{figure}\caption}
\newcommand{\tabcaption}{\def\@captype{table}\caption}
\makeatother\begin{center}
\includegraphics[width=0.8\textwidth]{exp2/mpi_time_size.eps}\\
\figcaption{MPI 实现高斯消元计算行列式的程序运行时间与矩阵大小变化关系}\label{fig:mpi2}
\end{center}\begin{center}
\begin{tabular}{c|cccccc}
\toprule
进程数 & 1 & 2 & 4 & 8 & 16 & 32 \\ \hline
1000 阶 & 0.711 & 0.452 & 0.331 & 0.239 & 0.226 & 2.380 \\
1200 阶 & 1.633 & 1.074 & 0.609 & 0.354 & 0.311 & 3.261 \\
1400 阶 & 2.905 & 1.912 & 1.204 & 0.448 & 0.386 & 2.623 \\
\bottomrule
\end{tabular}
\tabcaption{MPI 实现高斯消元计算行列式不同进程数下的运行时间(单位:s)}\label{tab:mpi}
\end{center}

2. 如何让表格填满
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}c|ccccc|ccccc}
其中 @{\extracolsep{\fill}} 就是用来干这个的.

3. 两个图并排插入一行:

\begin{figure}[htbp]
\centering
\begin{minipage}{0.4\textwidth}
\centering
\includegraphics[width=\textwidth]{文件名}
\caption{标题}\label{fig:f1}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\centering
\includegraphics[width=\textwidth]{文件名}
\caption{标题}\label{fig:f2}
\end{minipage}\vspace{\baselineskip}
\end{figure}

4. 子图的插入方法

\usepackage{graphicx}和\usepackage{subfigure}
\begin{figure}[htbp]
\centering
\subfigure[第1个子图标题]{
\label{第1个子图标签(通常为fig:subfig1:subsubfig1)}
\includegraphics[width=0.4\textwidth]{文件名}}
\subfigure[第2个子图标题]{
\label{第2个子图标签(通常为fig:subfig1:subsubfig2)}
\includegraphics[width=0.4\textwidth]{文件名}}
\caption{总标题}\label{总标签(通常为fig:subfig1)}
\vspace{\baselineskip}
\end{figure}

5. \graphicspath{{Figures/}} 指定图片路径

6. 公式环境中(比如 equation, align 等)不能有空行,
否则会提示 paragraph ended before *** was complete...

7. 双栏排版,

  \begin{multicols}{2}\newpage % 切换到另一栏,否则默认底端对齐\end{multicols}

 用 \begin{colums}[T] 更灵活:

\begin{columns}[T]\begin{column}{0.4\linewidth}\end{column}\begin{column}{0.6\linewidth}\end{column}
\end{columns}

还可以嵌套使用哦! 

8. \newcommand{\argmax}{\operatornamewithlimits{argmax}}

     

 9. 插入代码:

1 \usepackage{xcolor}
2 \usepackage{listings}
3
4 \ifdefined \lstavoidwhitepre
5 \lstavoidwhitepre
6 \lstdefinestyle{colors}{keywordstyle={\bf\color{blue}}, commentstyle={\color{dkgreen}}, stringstyle=\color{mauve}}
7 \lstset{language=C, style=colors, backgroundcolor=\color{lightblue}}
8 \else
9 \lstdefinestyle{colors}{keywordstyle={\bf\color{blue}}, commentstyle={\color{dkgreen}}, stringstyle=\color{mauve}}
10 \lstset{language=C, style=colors,basicstyle=\footnotesize, backgroundcolor=\color{lightblue}, showspaces=false, showstringspaces=false, showtabs=false, frame=single, breaklines=true, basewidth=5.5pt }
11 \fi
12
13 ....
14 \begin{document}
15 \lstinputlisting{hello.c}
16 \end{document}

排版效果如下图:

 

9. 表格中插入多行 \parbox

\parbox

\parbox[position][height][inner-pos]{width}{text}

parbox is a box whose contents are created in paragraph mode. The \parbox has two mandatory arguments:

  • width - specifies the width of the parbox, and
  • text - the text that goes inside the parbox.

LaTeX will position a parbox so its centre lines up with the centre of the text line. The optional position argument allows you to line up either the top or bottom line in the parbox (default is top).

If the height argument is not given, the box will have the natural height of the text.

The inner-pos argument controls the placement of the text inside the box. If it is not specified, position is used.

  • t --- text is placed at the top of the box.
  • c --- text is centred in the box.
  • b --- text is placed at the bottom of the box.
  • s --- stretch vertically. The text must contain vertically stretchable space for this to work.

详见:http://herbert.the-little-red-haired-girl.org/html/latex2e/$5cparbox.html

 

待续。。

转:https://www.cnblogs.com/shalijiang/archive/2013/03/25/2981224.html



推荐阅读
  • 本文介绍了Swing组件的用法,重点讲解了图标接口的定义和创建方法。图标接口用来将图标与各种组件相关联,可以是简单的绘画或使用磁盘上的GIF格式图像。文章详细介绍了图标接口的属性和绘制方法,并给出了一个菱形图标的实现示例。该示例可以配置图标的尺寸、颜色和填充状态。 ... [详细]
  • 开发笔记:实验7的文件读写操作
    本文介绍了使用C++的ofstream和ifstream类进行文件读写操作的方法,包括创建文件、写入文件和读取文件的过程。同时还介绍了如何判断文件是否成功打开和关闭文件的方法。通过本文的学习,读者可以了解如何在C++中进行文件读写操作。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • 本文介绍了在Python3中如何使用选择文件对话框的格式打开和保存图片的方法。通过使用tkinter库中的filedialog模块的asksaveasfilename和askopenfilename函数,可以方便地选择要打开或保存的图片文件,并进行相关操作。具体的代码示例和操作步骤也被提供。 ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 不同优化算法的比较分析及实验验证
    本文介绍了神经网络优化中常用的优化方法,包括学习率调整和梯度估计修正,并通过实验验证了不同优化算法的效果。实验结果表明,Adam算法在综合考虑学习率调整和梯度估计修正方面表现较好。该研究对于优化神经网络的训练过程具有指导意义。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 也就是|小窗_卷积的特征提取与参数计算
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了卷积的特征提取与参数计算相关的知识,希望对你有一定的参考价值。Dense和Conv2D根本区别在于,Den ... [详细]
  • 前景:当UI一个查询条件为多项选择,或录入多个条件的时候,比如查询所有名称里面包含以下动态条件,需要模糊查询里面每一项时比如是这样一个数组条件:newstring[]{兴业银行, ... [详细]
  • 先看看ElementUI里关于el-table的template数据结构:<template><el-table:datatableData><e ... [详细]
  • 花瓣|目标值_Compose 动画边学边做夏日彩虹
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了Compose动画边学边做-夏日彩虹相关的知识,希望对你有一定的参考价值。引言Comp ... [详细]
author-avatar
永恆極光_822
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有