latex postsubtable 需要什么宏

查看: 290|回复: 0
阅读权限100威望0 级论坛币14394 个学术水平107 点热心指数176 点信用等级93 点经验98370 点帖子1231精华0在线时间2012 小时注册时间最后登录
积分 3519, 距离下一级还需 81 积分
权限: 自定义头衔, 签名中使用图片, 设置帖子权限, 隐身, 设置回复可见
道具: 彩虹炫, 雷达卡, 热点灯, 雷鸣之声, 涂鸦板, 金钱卡, 显身卡, 匿名卡, 抢沙发, 提升卡, 沉默卡下一级可获得
道具: 千斤顶
购买后可立即获得
权限: 隐身
道具: 金钱卡, 雷鸣之声, 彩虹炫, 雷达卡, 涂鸦板, 热点灯
开心签到天数: 610 天连续签到: 13 天[LV.9]以坛为家II
本文为翻译改编,欲了解原文,请参看
最开始,我建立这个博客是为了帮助 LaTeX 的新手,但后来随着
的建立,博客的受众变得更广了,在我看来,这也不是件坏事。你所面临的挑战只会让你一直努力向前!然而,今天,这篇文章对于新手来说是非常有用的(译者注:对于我们国内大部分人来说都是值得一看的),在这篇文章中,我总结了每个
LaTeX 用户都应该使用的 9 个宏包!让我们开始吧!
宏包的顺序与其重要性无关,顺序是完全随机的。每节的首行是我调用宏包的常用方式,仅作参考!
amsmath\usepackage{amsmath}amsmath 宏包是 AMS(美国数学协会)系列宏包中最重要的宏包,这个宏包引入了一些改进的数学环境。比如:加载 amsmath之后,我们可以使用 align 环境。我所有的行间公式都使用了 align 环境 (或者无编号版的 align* 环境),即便有时候公式不需要对齐。Lars Madsen 在 PracTeX 杂志上有篇文章也鼓励使用 amsmath 宏包的环境,详细参看
geometry\usepackage[a4paper]{geometry}使用 geometry 宏包来调整页面的页边距非常方便。整个文档默认的页边距可以通过这个宏包的选项来改变(置于\usepackage 之后的方括号内,比如 a4paper),大部分情况下,我使用这个宏包(使用 a4paper 选项)来创建 A4 纸张以及相应的页边距。使用这个宏包,我们也可以改变某个特定页面的页边距, 上另外一篇文章介绍了怎么使用 geometry 宏包重新设定文档奇偶页的边距,详情参看 。
graphicx\usepackage{graphicx}关于 graphicx 没啥特别的,但是它可能是所有宏包中最重要的宏包,这个宏包引入了插图命令 \includegraphics,我们的文档如果需要插图都将用到它。
nag\RequirePackage[l2tabu, orthodox]{nag}事实上,如果你的代码没问题,这个宏包将不会做任何事情。注意:把这个宏包放在你的导言区的第一行(甚至在 \documentclass 之前)。它将会检测你文档中是否使用已经被淘汰了的宏包以及过时的命令,nag 的文档说明可以访问 。
microtype\usepackage{microtype}microtype 宏包可以改善了单词、字母的间距。它可能做了很多,但是大部分人察觉不到使用它之后文档的变化。但至少,加载了 microtype 之后,文档看起来更好,也更容易阅读。注意:如果有使用到字体宏包,需要将 microtype 宏包放在它们的后面,因为这个宏包对单词、字母的调整和字体是有关的。
siunitx\usepackage{siunitx}siunitx 宏包大大简化了写作科技文的 TeX 命令,科技文写作中很大一部分是单位、数字。这个宏包添加了一些命令,比如 \num命令可以输出我们想要的各种方式的数字形式(比如科学记数法),而 \si 命令用来输出单位。我经常用到的命令是 \SI 和 \SIrange。比如 \SI{10}{\hertz} 输出为 “10Hz”(这能有效避免输入错误,我可能会写成 HZ 或者 hz 而不是 Hz)。\SIrange 命令多一个参数:\SIrange{10}{100}{\hertz} 输出为 “10Hz to 100Hz”。
cleveref\usepackage{cleveref}另外一个非常有吸引力的宏包是 cleveref。这个宏包引入了 \cref 命令,当使用这个命令用于交叉引用的时候(而不是 \ref 或者 \eqref),根据引用的不同,它会自动添加一个单词前缀,引用 figure 环境,它会自动添加 “fig.”,而对于 equation 环境,它会自动添加 “eq.”。因此,这是一个用来简化写作的 LaTeX 宏包。之前有篇文章介绍了 cleveref 宏包,在那篇文章中,展示了如何修改引用对象前面的单词(比如 fig,eq),详情参看
hyperref\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}hyperref 非常强大,你可以有非常多的可能性,其中最突出的特色是超链接。当引用一幅图的时候,引用与图形形成了链接,当你点击引用的地方,它会跳转到链接的图片处。并且 hyperref 可以让你插入 PDF 元数据到你的最终文档中。注意:作为一个经验法则,你应该在导言区的最后加入这个宏包,在所有宏包之后。也存在少数例外的情况:比如,本文提到的 cleveref 宏包,cleveref宏包应该在 hyperref 之后。更多的例外情况可以参看:。
booktabs\usepackage{booktabs}booktabs 宏包可以让我们创建没有竖线分隔的表格,这些分隔线在很多情况下是不必要的,并且很难看。使用 booktabs 宏包创建表格比创建普通 LaTeX 表格更费劲。因此,我专门写了一篇文章,关于怎样使用 booktabs 宏包创建好看的表格,详情参看
示例下载我这里写了一个示例,主要是导言区,在这个示例文件中,上述所有的宏包都加载进去了,Happy TeXing!
译者按这篇文章是 2 年前的,可能你会发现某些宏包已经被淘汰了,或者某些宏包的选项已经改变,或者有更好的宏包选择,欢迎发表您的见解,本文仅为抛砖引玉之用!
支持楼主:、
购买后,论坛将把您花费的资金全部奖励给楼主,以表示您对TA发好贴的支持
载入中......
论坛好贴推荐From Wikibooks, open books for an open world
Getting Started
Common Elements
Floats, Figures and Captions
Technical Texts
Special Pages
Special Documents
Creating Graphics
Programming
Miscellaneous
Help and Recommendations
Appendices
introduced importing graphics. However, just having a picture stuck in between paragraphs does not look professional. For starters, we want a way of adding captions, and to be able to cross-reference. What we need is a way of defining figures. It would also be good if LaTeX could apply principles similar to when it arranges text to look its best to arranging pictures as well. This is where floats come into play.
Floats are containers for things in a document that cannot be broken over a page. LaTeX by default recognizes "table" and "figure" floats, but you can define new ones of your own (see
below). Floats are there to deal with the problem of the object that won't fit on the present page, and to help when you really don't want the object here just now.
Floats are not part of the normal stream of text, but separate entities, positioned in a part of the page to themselves (top, middle, bottom, left, right, or wherever the designer specifies). They always have a caption describing them and they are always numbered so they can be referred to from elsewhere in the text. LaTeX automatically floats Tables and Figures, depending on how much space is left on the page at the point that they are processed. If there is not enough room on the current page, the float is moved to the top of the next page. This can be changed by moving the Table or Figure definition to an earlier or later point in the text, or by adjusting some of the parameters which control automatic floating.
Authors sometimes have many floats occurring in rapid succession, which raises the problem of how they are supposed to fit on the page and still leave room for text. In this case, LaTeX stacks them all up and prints them together if possible, or leaves them to the end of the chapter in protest. The skill is to space them out within your text so that they intrude neither on the thread of your argument or discussion, nor on the visual balance of the typeset pages.
To create a figure that floats, use the figure environment.
\begin{figure}[placement specifier]
... figure contents ...
\end{figure}
The previous section mentioned how floats are used to allow LaTeX to handle figures, while maintaining the best possible presentation. However, there may be times when you disagree, and a typical example is with its positioning of figures. The placement specifier parameter exists as a compromise, and its purpose is to give the author a greater degree of control over where certain floats are placed.
Permission
Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot)
Position at the top of the page.
Position at the bottom of the page.
Put on a special page for floats only.
Override internal parameters LaTeX uses for determining "good" float positions.
Places the float at precisely the location in the LaTeX code. Requires the float package, e.g., \usepackage{float}. This is somewhat equivalent to h!.
What you do with these placement permissions is to list which of the options you wish to make available to LaTeX. These are simply possibilities, and LaTeX will decide when typesetting your document which of your supplied specifiers it thinks is best. Frank Mittelbach describes the algorithm:
If a float is encountered, LaTeX attempts to place it immediately according to its rules (detailed later)
if this succeeds, the float is placed and that decis
if this does not succeed, then LaTeX places the float into a holding queue to be reconsidered when the next page is started (but not earlier).
Once a page has finished, LaTeX examines this holding queue and tries to empty it as best as possible. For this it will first try to generate as many float pages as possible (in the hope of getting floats off the queue). Once this possibility is exhausted, it will next try to place the remaining floats into top and bottom areas. It looks at all the remaining floats and either places them or defers them to a later page (i.e., re-adding them to the holding queue once more).
After that, it starts processing document material for this page. In the process, it may encounter further floats.
If the end of the document has been reached or if a \clearpage is encountered, LaTeX starts a new page, relaxes all restrictive float conditions, and outputs all floats in the holding queue by placing them on float page(s).
In some special cases LaTeX won't follow these positioning parameters and additional commands will be necessary, for example, if one needs to specify an alignment other than centered for a float that sits alone in one page.
Use \listoffigures to add a list of the figures in the beginning of the document. To change the name used in the caption from Figure to Example, use \renewcommand{\figurename}{Example} in the figure contents.
It's possible to get a thin border around all figures. You have to write the following once at the beginning of the document:
\usepackage{float}
\floatstyle{boxed}
\restylefloat{figure}
The border will not include the caption.
Floating tables are covered in a . Let's give a quick reminder here. The tabular environment that was used to construct the tables is not a float by default. Therefore, for tables you wish to float, wrap the tabular environment within a table environment, like this:
\begin{table}
  \begin{tabular}{...}
  ... table data ...
  \end{tabular}
\end{table}
You may feel that it is a bit long winded, but such distinctions are necessary, because you may not want all tables to be treated as a float.
Use \listoftables to add a list of the tables in the beginning of the document.
The placeins package provides the command \FloatBarrier, which can be used to prevent floats from being moved over it. This can, e.g., be useful at the beginning of each section. The package even provides an option to change the definition of \section to automatically include a \FloatBarrier. This can be set by loading the package with the option [section] (\usepackage[section]{placeins}). \FloatBarrier may also be useful to prevent floats intruding on lists created using itemize or enumerate. The flafter package can be used to force floats to appear after they are defined, and the endfloat package can be used to place all floats at the end of a document. The float package provides the H option to floating environments, which stops them from floating.
It is always good practice to add a caption to any figure or table. Fortunately, this is very simple in LaTeX. All you need to do is use the \caption{''text''} command within the float environment. LaTeX will automatically keep track of the numbering of figures, so you do not need to include this within the caption text.
The location of the caption is traditionally underneath the float. However, it is up to you to therefore insert the caption command after the actual contents of the float (but still within the environment). If you place it before, then the caption will appear above the float. Try out the following example to demonstrate this effect:
\documentclass[a4paper,12pt]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h!]
  \caption{A picture of a gull.}
  \centering
    \includegraphics[width=0.5\textwidth]{gull}
\end{figure}
\begin{figure}[h!]
  \centering
    \reflectbox{%
      \includegraphics[width=0.5\textwidth]{gull}}
  \caption{A picture of the same gull
           looking the other way!}
\end{figure}
\begin{table}[h!]
  \begin{center}
    \begin{tabular}{| l c r |}
    \hline
    1 & 2 & 3 \\
    4 & 5 & 6 \\
    7 & 8 & 9 \\
    \hline
    \end{tabular}
  \end{center}
  \caption{A simple table}
\end{table}
Notice how the tables and figures
have independent counters.
\end{document}
Note that the command \reflectbox{...} flips its content horizontally.
It is sometimes desirable to have a caption appear on the side of a float, rather than above or below. The sidecap package can be used to place a caption beside a figure or table. The following example demonstrates this for a figure by using a SCfigure environment in place of the figure environment.
\documentclass{article}
\usepackage[pdftex]{graphicx}
\usepackage{sidecap}
\begin{document}
\begin{SCfigure}
  \centering
  \caption{ ... caption text ... }
  \includegraphics[width=0.3\textwidth]%
    {Giraff_picture}% picture filename
\end{SCfigure}
\end{document}
In some types of document (such as presentations), it may not be desirable for figure captions to start Figure:. This is easy to suppress by just placing the caption text in the Figure environment, without enclosing it in a Caption. This however means that there is no caption available for inclusion in a list of figures.
Captions can be listed at the beginning of a paper or report in a "List of Tables" or a "List of Figures" section by using the \listoftables or \listoffigures commands, respectively. The caption used for each figure will appear in these lists, along with the figure numbers, and page numbers that they appear on.
The \caption command also has an optional parameter, \caption[''short'']{''long''} which is used for the List of Tables or List of Figures. Typically the short description is for the caption listing, and the long description will be placed beside the figure or table. This is particularly useful if the caption is long, and only a "one-liner" is desired in the figure/table listing. Here is an example of this usage:
\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\listoffigures
\section{Introduction}
\begin{figure}[hb]
  \centering
  \includegraphics[width=4in]{gecko}
  \caption[Close up of \textit{Hemidactylus} sp.]
   {Close up of \textit{Hemidactylus} sp., which is
   part the genus of the gecko family. It is the
   second most speciose genus in the family.}
\end{figure}
\end{document}
Labels and cross-references work fairly similarly to the general case - see the
section for more information.
If you want to label a figure so that you can reference it later, you have to add the label after the caption (inside seems to work in LaTeX 2e) but inside the floating environment. If it is declared outside, it will give the section number.
If the label picks up the section or list number instead of the figure number, put the label inside the caption to ensure correct numbering. If you get an error when the label is inside the caption, use \protect in front of the \label command.
Although not normally the case in academic writing, an author may prefer that some floats do not break the flow of text, but instead allow text to wrap around it. (Obviously, this effect only looks decent when the figure in question is significantly narrower than the text width.)
A word of warning: Wrapping figures in LaTex will require a lot of manual adjustment of your document. There are several packages available for the task, but none of them works perfectly. Before you make the choice of including figures with text wrapping in your document, make sure you have considered all the options. For example, you could use a layout with two columns for your documents and have no text-wrapping at all.
Anyway, we will look at the package wrapfig. Note that wrapfig may not come with the default installation of LaTeX; you might need to .
To use wrapfig, you must first add this to the preamble:
\usepackage{wrapfig}
This then gives you access to:
\begin{wrapfigure}[lineheight]{position}{width}
There are overall eight possible positioning targets:
right side of the text
left side of the text
inside edge–near the binding (in a twoside document)
outside edge–far from the binding
The uppercase-character allows the figure to float, while the lowercase version means "exactly here".
The width is, of course, the width of the figure. An example:
\begin{wrapfigure}{r}{0.5\textwidth}
  \begin{center}
    \includegraphics[width=0.48\textwidth]{gull}
  \end{center}
  \caption{A gull}
\end{wrapfigure}
You can also allow LaTeX to assign a width to the wrap by setting the width to 0pt. \begin{wrapfigure}{l}{0pt}
Note that we have specified a size for both the wrapfigure environment and the image we have included. We did it in terms of the text width: it is always better to use relative sizes in LaTeX, let LaTeX do the work for you! The "wrap" is slightly bigger than the picture, so the compiler will not return any strange warning and you will have a small white frame between the image and the surrounding text. You can change it to get a better result, but if you don't keep the image smaller than the "wrap", you will see the image over the text.
The wrapfig package can also be used with user-defined floats with float package. See below in the .
It happens that you'll generate figures with too much (or too little) white space on the top or bottom. In such a case, you can simply make use of the optional argument [lineheight]. It specifies the height of the figure in number of lines of text. Also remember that the environment center adds some extra white space a consider using the command \centering instead.
Another possibility is adding space within the float using the \vspace{...} command. The argument is the size of the space you want to add, you can use any unit you want, including pt, mm, in, etc. If you provide a negative argument, it will add a negative space, thus removing some white space. Using \vspace tends to move the caption relative to the float while the [lineheight] argument does not. Here is an example using the \vspace command, the code is exactly the one of the previous case, we just added some negative vertical spaces to shrink everything up:
\begin{wrapfigure}{r}{0.5\textwidth}
  \vspace{-20pt}
  \begin{center}
    \includegraphics[width=0.48\textwidth]{gull}
  \end{center}
  \vspace{-20pt}
  \caption{A gull}
  \vspace{-10pt}
\end{wrapfigure}
In this case it may look too shrunk, but you can manage spaces the way you like. In general, it is best not to add any space at all: let LaTeX do the formatting work!
(In this case, the problem is the use of \begin{center} to center the image. The center environment adds extra space that can be avoided if \centering is used instead.)
You can use intextsep parameter to control additional space above and below the figure: \setlength\intextsep{0pt}
Alternatively you might use the picins package instead of the wrapfig package which produces a correct version without the excess white space out of the box without any hand tuning.
There is also an alternative to wrapfig: the package floatflt .
To remove the white space from a figure once for all, one should refer to the program pdfcrop, included in most TeX installations.
A useful extension is the subcaption package which uses subfloats within a single float. The subfigure and subfig packages are deprecated however they are useful alternatives when used in-conjunction with latex templates (i.e templates for journals from Springer and IOP, IEEETran and ACM SIG) that are not compatible with subcaption. These packages gives the author the ability to have subfigures within figures, or subtables within table floats. Subfloats have their own caption, and an optional global caption. An example will best illustrate the usage of the subcaption package:
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{figure}
        \centering
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[width=\textwidth]{gull}
                \caption{A gull}
                \label{fig:gull}
        \end{subfigure}%
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc.
          %(or a blank line to force the subfigure onto a new line)
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[width=\textwidth]{tiger}
                \caption{A tiger}
                \label{fig:tiger}
        \end{subfigure}
        ~ %add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc.
          %(or a blank line to force the subfigure onto a new line)
        \begin{subfigure}[b]{0.3\textwidth}
                \includegraphics[width=\textwidth]{mouse}
                \caption{A mouse}
                \label{fig:mouse}
        \end{subfigure}
        \caption{Pictures of animals}\label{fig:animals}
\end{figure}
You will notice that the figure environment is set up as usual. You may also use a table environment for subtables. For each subfloat, you need to use:
\begin{table}[&placement specifier&]
    \begin{subtable}[&placement specifier&]{&width&}
        \centering
        ... table 1 ...
        \caption{&sub caption&}
    \end{subtable}
    ~
    \begin{subtable}[&placement specifier&]{&width&}
        \centering
        ... table 2 ...
        \caption{&sub caption&}
    \end{subtable}
\end{table}
If you intend to cross-reference any of the subfloats, see where t \caption outside the subfigure-environment will provide the global caption.
subcaption will arrange the figures or tables side-by-side providing they can fit, otherwise, it will automatically shift subfloats below. This effect can be added manually, by putting the newline command (\\) before the figure you wish to move to a newline.
Horizontal spaces between figures are controlled by one of several commands, which are placed in between \begin{subfigure} and \end{subfigure}:
A non-breaking space (specified by ~ as in the example above) can be used to insert a space in between the subfigs.
: \qquad, \quad, \;, and \,
Generic space: \hspace{''length''}
Automatically expanding/contracting space: \hfill
If you are writing a document using two columns (i.e. you started your document with something like \documentclass[twocolumn]{article}), you might have noticed that you can't use floating elements that are wider than the width of a column (using a LaTeX notation, wider than 0.5\textwidth), otherwise you will see the image overlapping with text. If you really have to use such wide elements, the only solution is to use the "starred" variants of the floating environments, that are {figure*} and {table*}. Those "starred" versions work like the standard ones, but they will be as wide as the page, so you will get no overlapping.
A bad point of those environments is that they can be placed only at the top of the page or on their own page. If you try to specify their position using modifiers like b or h they will be ignored. Add \usepackage{dblfloatfix} to the preamble in order to alleviate this problem with regard to placing these floats at the bottom of a page, using the optional specifier [b]. Default is [tbp]. However, h still does not work.
To prevent the figures from being placed out-of-order with respect to their "non-starred" counterparts, the package fixltx2e
should be used (e.g. \usepackage{fixltx2e}).
If tables and figures are not adequate for your needs, then you always have the option to create your own! Examples of such instances could be source code examples, or maps. For a program float example, one might therefore wish to create a float named program. The package float is your friend for this task. All commands to set up the new float must be placed in the preamble, and not within the document.
Add \usepackage{float} to the preamble of your document
Declare your new float using: \newfloat{type}{placement}{ext}[outer counter], where:
type - the new name you wish to call your float, in this instance, 'program'.
placement - t, b, p, or h (as previously described in ), where letters enumerate permitted placements.
ext - the file name extension of an auxiliary file for the list of figures (or whatever). Latex writes the captions to this file.
outer counter - the presence of this parameter indicates that the counter associated with this new float should depend on outer counter, for example 'chapter'.
The default name that appears at the start of the caption is the type. If you wish to alter this, use \floatname{type}{floatname}
Changing float style can be issued with \floatstyle{style} (Works on all subsequent \newfloat commands, therefore, must be inserted before \newfloat to be effective).
plain - the normal style for Latex floats, but the caption is always below the content.
plaintop - the normal style for Latex floats, but the caption is always above the content.
boxed - a box is drawn that surrounds the float, and the caption is printed below.
ruled - the caption appears above the float, with rules immediately above and below. Then the float contents, followed by a final horizontal rule.
Float styles can also be customized as the second example below illustrates.
An example document using a new program float type:
\documentclass{article}
\usepackage{float}
\floatstyle{ruled}
\newfloat{program}{thp}{lop}
\floatname{program}{Program}
\begin{document}
\begin{program}
  \begin{verbatim}
class HelloWorldApp {
  public static void main(String[] args) {
    //Display the string
    System.out.println("Hello World!");
\end{verbatim}
  \caption{The Hello World! program in Java.}
\end{program}
\end{document}
The verbatim environment is an environment that is already part of Latex. Although not introduced so far, its name is fairly intuitive! LaTeX will reproduce everything you give it, including new lines, spaces, etc. It is good for source code, but if you want to introduce a lot of code you might consider using the listings package, that was made just for it.
While this is useful, one should be careful when embedding the float within another float. In particular, the error
not in outer par mode
may occur. One solution might be to use the [H] option (not any other) on the inner float, as this option "pins" the inner float to the outer one.
Newly created floats with \newfloat can also be used in combination with the wrapfig package from above. E.g. the following code creates a floating text box, which floats in the text on the right side of the page and is complete with caption, numbering, an index file with the extension .lob and a customization of the float's visual layout:
\documentclass{article}
% have hyperref package before float in order to get strange errors with .\theHfloatbox
\usepackage[pdftex]{hyperref}
\usepackage{float}
% allows use of "@" in control sequence names
\makeatletter
% this creates a custom and simpler ruled box style
\newcommand\floatc@simplerule[2]{{\@fs@cfont #1 #2}\par}
\newcommand\fs@simplerule{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@simplerule
  \def\@fs@pre{\hrule height.8pt depth0pt \kern4pt}%
  \def\@fs@post{\kern4pt\hrule height.8pt depth0pt \kern4pt \relax}%
  \def\@fs@mid{\kern8pt}%
  \let\@fs@iftopcapt\iftrue}
% this code block defines the new and custom floatbox float environment
\floatstyle{simplerule}
\newfloat{floatbox}{thp}{lob}[section]
\floatname{floatbox}{Text Box}
\begin{document}
\begin{floatbox}{r}{}
  \textit{Bootstrapping} is a resampling technique used
  for robustly estimating statistical quantities, such as
  the model fit $R^2$. It offers some protection against
  the sampling bias.
  \caption{Bootstrapping}
\end{floatbox}
\end{document}
To change the appearance of captions, use the caption
package. For example, to make all caption labels small and bold:
\usepackage[font=small,labelfont=bf]{caption}
The KOMA script packages
have their own caption customizing features with e.g. \captionabove, \captionformat and \setcapwidth. However these definitions have limited effect on newly created float environments with the wrapfig package.
Alternatively, you can redefine the \thefigure command:
\renewcommand{\thefigure}{\arabic{section}.\arabic{figure}}
for more information on counters. Finally, note that the caption2 package has long been deprecated.
There is a LaTeX package lpic
to put LaTeX on top of included graphics, thus allowing to add TeX annotations to imported graphics. It defines a convenient interface to put TeX over included graphics, and allows for drawing a white background under the typeset material to overshadow the graphics. It is a better alternative for label you do not have to change text size when rescaling pictures, and all LaTeX power is available for labels.
A very similar package, with somewhat different syntax, is pinlabel . The link given also points to the packages psfrag and overpic.
A much more complicated package which can be used in the same way is . TikZ is a front-end to a drawing library called pgf (which is used to make beamer for instance). It can be used to label figures by adding text nodes on top of an image node.
That concludes all the fundamentals of floats. You will hopefully see how much easier it is to let LaTeX do all the hard work and tweak the page layouts in order to get your figures in the best place. As always, the fact that LaTeX takes care of all caption and reference numbering is a great time saver.
This page uses material from Andy Roberts'
with permission from the author.

我要回帖

更多关于 latex post 的文章

 

随机推荐