Graphics, Figures & Tables ⇒ placement graphics
-
- Posts: 15
- Joined: Wed Mar 04, 2009 12:33 am
placement graphics
Javier
\begin{figure}[!ht]
\caption{fig}\label{Fig: ergodic}
\centering
\includegraphics[width=6in,height=5in]{myfig}\\
\end{figure}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
placement graphics
Omit the \\ command for a line break. It is completely superfluous.
Best regards
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
placement graphics
if you want to avoid floating have a look at the possibilities listed here: Prevent floating of figures or tables. Or try the package placeins and its command \FloatBarrier.rockybalboa wrote:I want it here or on top, but LaTex places it below for some reason.
Stefan
Re: placement graphics
Your problem might come from the fact that you are misplacing the commands. Firstly, in a figure environment, LaTeX expects the caption and the label after the figure itself. Secondly, like said by localghost, you don't need to tell LaTeX that you want a linebreak after a figure, it is automatic. Thirdly, I believe you are confusing your compiler with the command \begin{figure}[!ht]. It tells your compiler that you want to "force" (!) your figure to be here (h) or on top (t). Try to image if I would force you to be on two different place at once, you would choose the one you like. So keep this information simple, with \begin{figure}[!t]. I don't remember if you are not suppose to add the exclamation after the location [t!]. At last, by define the width and the height of your figure, you will most probably change its original ratio. Why don't you specify one dimension, to keep the ratio of the figure intact.
Hope this helps. Cheers
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
placement graphics
The sequence of commands is completely irrelevant to the placement of the float. But in fact, the caption of a figure belongs underneath.fatra2 wrote:[...] Your problem might come from the fact that you are misplacing the commands. Firstly, in a figure environment, LaTeX expects the caption and the label after the figure itself. [...]
There will be no confusion for the compiler. The exclamation mark doesn't force the output of a float, but makes the compiler neglect the default settings for placing floats on a page (by reducing the according values). One single parameter will be overwritten with an according warning in the log file. The given combination yields very good results.fatra2 wrote:[...] Thirdly, I believe you are confusing your compiler with the command \begin{figure}[!ht]. It tells your compiler that you want to "force" (!) your figure to be here (h) or on top (t). Try to image if I would force you to be on two different place at once, you would choose the one you like. So keep this information simple, with \begin{figure}[!t]. I don't remember if you are not suppose to add the exclamation after the location [t!]. [...]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 15
- Joined: Wed Mar 04, 2009 12:33 am
Re: placement graphics
Javier