1

I have following MWE:

\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[color=red,opacity=0.1,contents={}]{background}
\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{caption}
\usepackage{listings}
\usepackage[listingsutf8]{tcolorbox}
\usepackage{tcolorbox}
\usepackage[slovene]{babel}
\usepackage{titlesec}
\usepackage{float}
\usepackage{pifont}

\setcounter{secnumdepth}{4}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\author{Marko Frelih \\ Company \\ \texttt{email}}
\title{Installation manual}
\date{Ljubljana, Marec 2015}

\begin{document}
\maketitle
\thispagestyle{empty}
\pagebreak
\clearpage
\pagenumbering{arabic}

\AddEverypageHook{
  \ifnum\value{page}<1\relax
  \else
  \backgroundsetup{contents={ZAUPNO}}
  \fi
\BgMaterial
}

\subsection{Prvi zagon}
Za uspe\v{s}en prvi zagon ter prevzem kontrole nad Rasbperry Pi B+ moramo najprej namestiti
adapter za serijsko komunikacijo na \textit{GPIO} konektor na na\v{s} ra\v{c}unalnik. Elektri\v{c}na
shema adapterja je slede\v{c}a:
\begin{figure}[htbp]
\centering
\includegraphics[scale=1.0, width=\textwidth]{slike/image_RS232Adapter.png}
\caption{Elektri\v{c}na shema serijskega adapterja}
\end{figure}
%Prvi zagon ra\v{c}unalnika Rasbperry Pi B+ lahko opazujemo na ve\v{c} na\v{c}inov, tukaj bomo opisali
%dva.
%\subsubsection{Prvi zagon z priklopom vseh potrebnih perfiernih enot direktno na Raspberry Pi}
%Pred prvim zagonom moramo na Raspberry Pi B+ priklopiti monitor ali televizijski sprejemnik preko HDMI kabla,
%tipkovnico preko USB vrat ter kabel za internet preko ethernet vrat. Ko to storimo, pri\v{z}gemo Raspberry Pi B+
%z vklopom napajalnika preko micro USB kabla v micro USB re\v{z}o in Rasbperry Pi B+ se pri\v{z}ge, aktivnost
%nalaganja linux operacijskega sistema vidimo na ekranu/televizorju. Najprej se prika\v{z}e predstavitveno okno:
%\begin{figure}[htbp]
%\centering
%\includegraphics[scale=1.0,width=\textwidth]{slike/image_rPiBPlusSplashScreen.png}
%\caption{Rasperry Pi B+ predstavitveno okno}
%\end{figure} \\
Kot vidimo, so na konektoriju \textit{GPIO} uporabljene tri nogice, zato mora adapter na
Raspberry Pi B+ le\v{z}ati, kot prikazuje spodnja slika:
\begin{figure}[htbp]
\centering
\includegraphics[scale=0.6]{slike/image_SerialPImountedrPiBPlus.png}
\caption{Pravilen priklop serijskega adapterja na ra\v{c}unalnik}
\end{figure}
\pagebreak
Nato z \textit{null modem} serijskim kablom pove\v{z}emo Rasberry Pi B+ ter delovno postajo.
in nato se jedro za\v{c}ne nalagati:
\pagebreak
Ko se sistem nalo\v{z}i, se pojavi prijavni pozivnik:
\begin{figure}[htbp]
\centering
\includegraphics[scale=1.0, width=\textwidth]{slike/image_rPiBPlusArchLogin.png}
\caption{Arch Linux konzolno prijavno okno}
\end{figure}

Privzeto uporabni\v{s}ko ime je \textbf{root}, privzeto geslo je prav tako \textbf{root}.
Ob uspe\v{s}ni prijavi se znajdemo v \textit{bash} ukazni lupini
\begin{figure}[htbp]
\centering
\includegraphics[scale=1.0, width=\textwidth]{slike/image_rPiBPlusArchLoginSuccessBash.png}
\caption{Uspe\v{s}na prijava v sistem}
\end{figure}
, od koder bomo nastavili nadaljne obna\v{s}anje sistema. Zaradi zelo olaj\v{s}anega dela
bomo najprej in\v{s}talirali \textit{ssh tunel} ter \textit{ftp stre\v{z}nik},
to pa zato, da lahko dostopamo do naprave ter da lahko urejamo napravine sistemske datoteke
iz omre\v{z}ja.

\end{document}

which results output, showed in screenshot: Wrong text placement Now, before second picture, I have text that is rectangled with red and should reside on next page. Why am I getting wrong text placement?

  • 1
    Use a \clearpage instead of \pagebreak, this will ship out the preceding floats and the text will appear on the next page – user31729 Mar 21 '15 at 12:34
  • @SoundsOfSilence should I use \clearpage in all other parts of documents then? – KernelPanic Mar 21 '15 at 12:37
  • 1
    This depends on your setup. If you want to fix the figures on certain pages, you should not let them float anyway. If you demand certain text to start on the next page, use a \clearpage then. I used \pagebreak not for years really. Finally, there is no general rule – user31729 Mar 21 '15 at 12:39
  • @SoundsOfSilence can you upgrade this comment into question so I can accept it? – KernelPanic Mar 21 '15 at 12:43
  • 2
    in this case, since there isn't enough room on the page for any more text, this text should automatically go to a new page if you leave a blank line before (or after) the figure. unless a figure is positioned in the input file so that it will be in vertical mode when tex reads it, the surrounding text is assumed to be the same paragraph. that's what you're seeing here. if you want the "continuation" text to start flush left, you'll have to specify \noindent. – barbara beeton Mar 21 '15 at 12:45
1

when code for a figure is input within a block of text, processing of the figure will be deferred until the end of the paragraph. figures (and other floats) are processed only in vertical mode.

for this reason, it's recommended that floats always be input between paragraphs.

in the present case, the problem can be solved by inserting a blank line in the input file before (or after, or both) the figure input, since there isn't enough room on the page for another line of text. then the text that is now "continuing" will automatically go to the next page. if that text should start flush left, you'll have to specify \noindent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.