2

This is not about keeping the picture or table close to where they have been mentioned.

It is about keeping the caption of the picture (or table) together with the picture. Otherwise the picture and the caption will be displayed in different pages (or columns). Then, how to do it?.

\documentclass[journal,twoside]{IEEEtran}
\usepackage[spanish,english]{babel}
\usepackage{circuitikz}
\usepackage[justification=centering]{caption}

\begin{document}
\title{Minimal Working}

\maketitle

\begin{center}
\includegraphics[scale=0.2444]{MultiplierSimulationI.png}
\captionof{figure}{\small Multiplier circuit x3.}
\end{center}

\begin{center}
\begin{circuitikz}[american]
\draw (-0.5,-0.5) to[open, l=$Anode$] (0,-0.5);
\draw (-1,0) to[D, v=$V_D$] (-1,-2);
\draw (-1,0) to[open, o-o] (-1,-2);
\draw (0,-0.5) -- (0,-1.3) to[short, i=$i_D$] (0,-1.5);
\draw (-0.5,-2.3) to[open, l=$Cathode$] (0,-2.3);
\end{circuitikz}
\captionof{figure}{\small Ideal Diode.}
\end{center}

\end{document}

This is how I insert pictures (correct me if I am wrong, I insert them like this to put them wherever I want and avoid that the position itself anywhere in the page, and to give them a location). Anyway, if you add forced spaces before the picture there is a time where the picture will stay in the first column and the caption in the first line of the second column (same situation with the circuit).

Hans
  • 1,013
  • When would this ever happen? Perhaps only when you use specialized packages or other trickery. As such, can you provide us with a minimal working example (MWE) that replicates your problem? – Werner Apr 03 '14 at 05:50
  • As Werner said, this is not the normal behaviour. You have certainly tweaked something. Without the code, it is impossible for use to guess and help. –  Apr 03 '14 at 06:30

2 Answers2

3
  • Use a figure environment to keep picture and caption together, and to let the picture float.
  • Without figure (if you don't want it to float), use a minipage environment to prevent a page break between picture and caption. No floating can result in bad page breaks though, such as much whitespace at the end of the previous page.

Other possibilities: samepage environment, \nopagebreak command, but I recommend the options above.

Stefan Kottwitz
  • 231,401
1

Solved by using the Float Package:

\documentclass[journal,twoside]{IEEEtran}
\usepackage[spanish,english]{babel}
\usepackage{circuitikz}
\usepackage[justification=centering]{caption}
\usepackage{float}

\begin{document}
\title{Minimal Working}

\maketitle

\begin{figure}[H]
\centering
\includegraphics[scale=0.2444]{MultiplierSimulationI.png}
\caption{\small Multiplier circuit x3.}
\end{figure}

\begin{figure}[H]
\centering
\begin{circuitikz}[american]
\draw (-0.5,-0.5) to[open, l=$Anode$] (0,-0.5);
\draw (-1,0) to[D, v=$V_D$] (-1,-2);
\draw (-1,0) to[open, o-o] (-1,-2);
\draw (0,-0.5) -- (0,-1.3) to[short, i=$i_D$] (0,-1.5);
\draw (-0.5,-2.3) to[open, l=$Cathode$] (0,-2.3);
\end{circuitikz}
\caption{\small Ideal Diode.}
\end{figure}

\end{document}

When inserting forced spaces the caption won't separate of the picture.

MWE

Hans
  • 1,013