banner



How To Fix The Location Of A Figure In Latex

The commodity explains how to apply the correct LaTeX commands to insert a figure in text. The desired placement of figures throughout the text is demonstrated using iv different types of techniques with the help of illustrations.


  1. Float
  2. Minipage
  3. Center
  4. Adjustbox
  5. FAQ

Float

Floats are used to comprise elements that cannot be broken across pages, such as figures and tables. If there is not enough room on the current folio for a effigy, the bladder will place the effigy at the top of the next page. The effigy environment is used to generate floats that incorporate figures. The placement specifier parameter allows united states to have control over the location of the effigy in text.

Specifier Placement
t Place the effigy at the top of a text folio
b Place the figure at the bottom of a text page
h Place the figure at the position in the text where the figure environment is (since it cannot be used alone, information technology automatically adds the t option)
p Place the figure on a separate float page
! Used in addition to the other parameters, it overrides the restrictions of LaTeX over the floats (such equally the maximum number of floats in a folio) and helps to enforce the chosen parameter.
H Comes with the float package, it admittedly forces the figure to appear at the position in the text where the figure environment is

The default placement parameter is tbp, which means LaTeX will try to place the figure to the top or the bottom part of the page, or it will place it on a separate bladder page. The order of the parameters is not important, it only means that LaTeX will try to identify the figure in one of the positions that are included in the parameter, and volition not try the excluded ones.

\usepackage{graphicx,bladder} % ... \begin{effigy}[H] \centering \includegraphics[width = .v\textwidth]{latex.png} \caption{Figure in a float} \characterization{fig:bladder} \end{figure}

Floats are a helpful environment to adapt the positions of figures in a text body. However, in some cases, its options may lack the command needed to make the figure appear in an exact part of a text. In those cases, one of the options below can help position the figure.

Minipage

Minipage is an alternative to float, it does not require the figure surround. It creates a small page environment with a given width. Since this is non a figure environment, caption command is not enough to elaborate on the element nosotros are creating the caption for. For this purpose, we tin include caption package at the beginning of our document, and use captionof command with figure parameter to add a caption to the effigy. Additionally, to middle the figure, \centering command is used. This surroundings might need a vertical spacing command to go on consistency throughout the text.

\usepackage{graphicx, caption} % ... \begin{minipage}{\linewidth} \centering \includegraphics[width = .5\textwidth]{latex.png} \captionof{figure}{Figure in a minipage} \label{fig:minipage} \end{minipage}

Center

Center is an alternative to float environment and minipage, it only centers the elements in its telescopic. Since this is still the same document environment, spacing volition be like to other elements in the text, such equally paragraphs.

\usepackage{graphicx, caption} % ... \begin{center} \includegraphics[width = .5\textwidth]{latex.png} \captionof{figure}{Figure in a center telescopic} \characterization{fig:center} \end{center}

AdjustBox

Adjustbox bundle is used to make a non-floating float substitute for your packaged products. In an adjustbox environment, alignment, caption and label are attributes that can exist declared every bit an statement. Nosotros also need to declare that nosotros are adding a figure which is non going to be evaluated as a float with nofloat = figure option. Additionally, to separate the caption from the regular text, we tin apply the vspace choice with any length value. In this case, we used \bigskipamount to make it the aforementioned size as a \bigskip.

\usepackage{graphicx, adjustbox} % ... \begin{adjustbox}{center, nofloat=effigy, vspace=\bigskipamount, caption={Figure in an adjustbox}, label={fig:adjustbox}} \includegraphics[width=\textwidth]{latex.png} \terminate{adjustbox}

FAQ

Question 1: How can I tell LaTeX I really desire the effigy in that specific identify, no thing how much whitespace will be left?
As mentioned in the Float section, the placement specifier parameters can be used. The best mode to precisely position the figure is the H placement specifier, which is a part of the float package.

Question ii: Is H from float the same as !h?
No, !h is non the same every bit H. !h only positions the picture at the desired location, if possible, but it's not an absolute control.

Question 3: Which other methods tin be used for forced figure placement in text other than bladder?
Minipage, center and adjustbox tin can exist used as an alternative to float if the desired figure location is the same as its place in the LaTeX code.

Contempo Posts

link to Typesetting Multiple Choice Questions in LaTeX

Typesetting Multiple Choice Questions in LaTeX

due north this tutorial, we will see how to write a multiple-choice test in LaTeX, using the exam certificate course. This document form provides multiple tools to easily typeset exams in LaTeX, and nosotros have...

link to How to Write a Minimalistic CV in LaTeX: Step-by-step Guide

How To Fix The Location Of A Figure In Latex,

Source: https://latex-tutorial.com/figure-placement-in-text/

Posted by: holimansque1965.blogspot.com

0 Response to "How To Fix The Location Of A Figure In Latex"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel