Text FormattingWhy is the figure image shown before section heading

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
artemff
Posts: 113
Joined: Sat Oct 17, 2009 11:15 pm

Why is the figure image shown before section heading

Post by artemff »

Code: Select all

 \section{section}
  \begin{figure} [ht]
  \includegraphics{images/image.eps}
  \caption{caption}
  \end{figure}
Why image is shown before name of section in result file?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Why is the figure image shown before section heading

Post by localghost »

Code: Select all

\begin{figure}[!ht]
  % figure contents
  \caption{Dummy figure}\label{fig:dummy}
\end{figure}

Best regards
Thorsten
artemff
Posts: 113
Joined: Sat Oct 17, 2009 11:15 pm

Why is the figure image shown before section heading

Post by artemff »

localghost wrote:

Code: Select all

\begin{figure}[!ht]
  % figure contents
  \caption{Dummy figure}\label{fig:dummy}
\end{figure}

Best regards
Thorsten
It don't help.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Why is the figure image shown before section heading

Post by localghost »

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}

\begin{document}
  \section{One}
    \begin{figure}[!ht]
      \centering
      \rule{6.4cm}{3.6cm}
      \caption{Dummy figure}\label{fig:dummy}
    \end{figure}
\end{document}
artemff
Posts: 113
Joined: Sat Oct 17, 2009 11:15 pm

Why is the figure image shown before section heading

Post by artemff »

localghost
This is minimal incorrect example:

Code: Select all

\documentclass [a4paper, 12pt, oneside]{scrartcl}

\usepackage [CP1251] {inputenc}
\usepackage [english, russian] {babel}
\usepackage{indentfirst}
\usepackage{misccorr}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{ccaption}

\begin{document}
 \title{blabla}
 \author{asdfasdfasdfasdf}
 \date{2009}
 \maketitle
 \newpage
 \section{blabla}
  \begin{figure} [ht]
  \includegraphics{images/blabla.eps}
  \caption{blabla}
  \end{figure}
  \small
  \par blabla:\par
  R1 = 17,5Ом\par
  R2 = 30Ом\par
  R3 = 10Ом\par
  R'4 = 12,5Ом \par
  R''4 = 10Ом\par 
  R5 = 37,5Ом\par
  R'6 = 30Ом\par 
  R''6 = 60Ом\par 
  E2 = 74В\par 
  E3 = 25В\par 
  J2 = 0,8А\par 
  J3 = 0А\par 
 \section{blabla}
  \begin{figure} [!ht]
   \includegraphics{images/circuit2.eps}
   \caption{blabla}
  \end{figure}
  \begin{equation}
    R4 = R'4 + R''4
  \end{equation}
\end{document}
If I add this in

Code: Select all

figure

Code: Select all

 \centering
      \rule{6.4cm}{3.6cm}
black rectangle is appeared.
artemff
Posts: 113
Joined: Sat Oct 17, 2009 11:15 pm

Re: Sequence is wrong

Post by artemff »

It's work after addition \newline after \section
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Why is the figure image shown before section heading

Post by Stefan Kottwitz »

The \rule command draws the black rectangle. Thorsten used it to produce a dummy image, just as a place holder, that's a common way. He would have told it, perhaps he's offline at the moment.

Regarding your problem you could try

Code: Select all

\usepackage[section]{placeins}
Stefan
LaTeX.org admin
Post Reply