[Tex/LaTex] How to fix image positioning?

graphicshorizontal alignmentpositioningvertical alignment

Possible Duplicate:
Keeping tables/figures close to where they are mentioned

\usepackage{amsfonts}
\usepackage{pdfpages}
\usepackage[hidelinks,unicode]{hyperref} %- to zeby byly polskie znaki w bookmarkach + konwersja na utf8
%\usepackage[hidelinks]{hyperref}
\usepackage{etoolbox}
\usepackage[T1,OT4]{fontenc}

\usepackage{graphicx}

\usepackage{hypcap}

\usepackage{anysize}
\marginsize{3.5cm}{2.5cm}{2cm}{2cm}

\let\origfigure\figure
\let\endorigfigure\endfigure

\renewcommand\baselinestretch{1.5}
\patchcmd{\thebibliography}{*}{}{}{}

\makeatletter
\g@addto@macro\@floatboxreset\centering
\makeatother


\SetSectionFormatting[breakbefore]{chapter} {24pt plus5pt minus2pt}
{\FormatHangHeading{\fontsize{17}{17}\textbf}} {10pt plus3pt}
\SetSectionFormatting{section} {24pt plus5pt minus2pt}
{\FormatHangHeading{\fontsize{14}{14}\textbf}} {10pt plus3pt}
\SetSectionFormatting{subsection} {24pt plus5pt minus2pt}
{\FormatHangHeading{\fontsize{12}{12}\textbf}} {10pt plus3pt}

\makeatletter
\pretocmd{\tableofcontents}{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \pdfbookmark[0]{\contentsname}{toc}%
}{}{}%
\makeatother

\begin{document}
%\language 12345 % wyłącza dzielenie wyrazów
\pagenumbering{Alph}
\begin{titlepage}
\pdfbookmark{Strona tytułowa}{}
\includepdf[pages=1-]{strona_tytulowa.pdf}
\end{titlepage}
\pagenumbering{arabic}
\tableofcontents
\input{tresc.tex}
\input{bibliografia.tex}
\end{document}

tresc.tex:

\chapter{Bzdety}\label{rozdzial-bzdety}
W rozdziale \ref{rozdzial-bzdety} ze strony \pageref{rozdzial-bzdety} znajduje się obrazek \ref{obraz-jesien} na stronie \pageref{obraz-jesien}.

The first paragraph.

\begin{figure}
    \includegraphics[scale=1]{a.jpg}
    \caption[Opcjonalny skrócony opis do spisu obrazków]{Opis}
    \label{obraz-jesien}
\end{figure}


The second paragraph.

I expected something like:

The first paragraph.

[image]


The second paragraph.

I got:

The first paragraph.    

The second paragraph.

[image]

Image is at the very center of next page. How can I fix this?

Best Answer

Use a placement specifier, e.g. you can use [h] as in the following:

\begin{figure}[h]
... figure contents ...
\end{figure}
Related Question