Floats[ edit ] 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 Custom floats below. 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.
|Published (Last):||4 May 2017|
|PDF File Size:||4.29 Mb|
|ePub File Size:||7.20 Mb|
|Price:||Free* [*Free Regsitration Required]|
Floats[ edit ] 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 Custom floats below. 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. As with various other entities, there exist limitations on the number of unprocessed placed floats in line. LaTeX by default can cope with maximum 18 floats and a symptomatic error is:!
LaTeX Error: Too many unprocessed floats. The morefloats package lifts this limit. To create a figure that floats, use the figure environment. 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. Specifier Permission h Place the float here, i. Override internal parameters LaTeX uses for determining "good" float positions. H Places the float at precisely the location in the LaTeX code. Requires the float package,  i. 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 decision is never changed; 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. After that, it starts processing document material for this page. In the process, it may encounter further floats. The tabular environment that was used to construct the tables is not a float by default. This can, e.
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 completely stops them from floating. You have the full and absolute control about the placement of your figures and captions.
Captions[ edit ] It is always good practice to add a caption to any figure or table. Fortunately, this is very simple in LaTeX. 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. Side captions[ edit ] 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. The floatrow package is newer and has more capabilities. Unnumbered captions[ edit ] In some types of document such as presentations , it may not be desirable for figure captions to start with 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. The caption used for each figure will appear in these lists, along with the figure numbers, and page numbers that they appear on.
Typically the short description is for the caption listing, and the long description will be placed beside the figure or table. It is the second most speciose genus in the family. 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.
Wrapping text around figures[ edit ] 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 install additional packages.
LaTeX will automatically calculate the value if this option is left blank but this can result in figures that look ugly with too much spacing. The LaTeX calculation is manually overridden by entering the number of lines you would like the figure to span. There are overall eight possible positioning targets: r right side of the text l left side of the text i inside edge—near the binding in a twoside document o 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. 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. The wrapfig package can also be used with user-defined floats with float package. See below in the section on custom floats. 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.
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.
In general, it is best not to add any space at all: let LaTeX do the formatting work! 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. Subfloats[ edit ] A useful extension is the subcaption  package, which uses subfloats within a single float. The subfig package subfigure package is deprecated  is a useful alternative when used in-conjunction with LaTeX templates i.
These packages give the author the ability to have subfigures within figures, or subtables within table floats. Subfloats have their own caption, and an optional global caption.
You may also use a table environment for subtables. In this case you can use continued figures using the caption package. 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. Default is [tbp]. However, h still does not work. Custom floats[ edit ] 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.
LaTeX writes the captions to this file. The default name that appears at the start of the caption is the type. Then the float contents, followed by a final horizontal rule. Float styles can also be customized as the second example below illustrates. Although not introduced so far, its name is fairly intuitive!
One is that it will not automatically wrap text in cells, even if it overruns the width of the page. For a more convenient method, have a look at The tabularx package , or The tabulary package. Instead of p, use the m attribute to have the lines aligned toward the middle of the box or the b attribute to align along the bottom of the box. Here is a simple example. However, the strong breeze will bring down the temperatures. Clear spells across most of Scotland and Northern Ireland, but rain reaching the far northwest. Conditions will improve by early afternoon and continue throughout the evening.
Manual de LaTeX
The standard point size used in most modern computer programs known as the desktop publishing point or PostScript point has 1 pt equal to approximately 0. This is because these older engines only support a fixed set of sizes - between 5 and 17 point. When he designed Computer Modern, Knuth created individual font files for these sizes, each with stroke widths and spacing optimized for that particular size. To avoid distorting them, scaling these fonts is disabled by default. This issue is avoided when using lualatex or xelatex, which use Latin Modern - a vectorized version of Computer Modern - as the default font family. This still provides individual files at each of the original optical sizes , but will automatically scale the closest one when asked for an arbitrary size. The fontspec package is extremely configurable.
This is a guide to the LaTeX typesetting system. It is intended as a useful resource for everybody, from new users who wish to learn, to old hands who need a quick reference. It takes a "plain" text file and converts it into a high-quality document for printing or on-screen viewing. LaTeX is a macro system built on top of TeX that aims to simplify its use and automate many common formatting tasks. It is the de-facto standard for academic journals and books, and provides some of the best typography free software has to offer. This book is organized into different parts: Getting Started will provide you with the very first steps to print your first document, from installing the needed software to basic concepts and syntax. Common Elements discusses common features you would expect from a document processor, including fonts, layout, colors, lists, and figures.