0

I was trying to insert an image at a specific position after a text, but because it was followed by table on the next page, the image was forced to be alone on the top of a page which I didn't want but I think there is no solution. So my question is, how can I place this image in the center of the page (vertical and horizontal centering)?

My code:

\documentclass{book} 
\usepackage[german]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[top=4cm,bottom=4cm,left=4cm,right=4cm,asymmetric]{geometry}
\usepackage{booktabs,dcolumn}
\usepackage[figureposition=bottom]{caption}
\usepackage{fancyhdr}
\numberwithin{equation}{chapter}
\fancyhf{}
\fancyhead[C]{\leftmark}
\fancyhead[LE,RO]{\thepage}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\chaptermark}[1]{
 \markboth{#1}{}}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand*{\mc}[1]{\multicolumn{1}{c}{#1}}
\newcommand*{\mcTwo}[1]{\multicolumn{2}{c}{#1}}
\linespread{1.8}
\setlength\parindent{0pt}
\begin{document} 
\chapter {Einleitung} 
\section{Motivation}  
[TEXT]
I NEED TO INSERT AN IMAGE EXACTLY HERE!
[TEXT]
AND THEN THE TABLE BELOW! 
    \makeatletter
\setlength{\@fptop}{0pt}
\setlength{\@fpbot}{0pt plus 1fil}
\makeatother
\clearpage
\begin{table}[htbp]
 \centering
 \caption{Zusammensetzungen einiger SX-Nickelbasislegierungen in wt\%.}
 \label{tbl:1}
  \begin{tabular}{c d{2.1} d{2.1} d{2.1} d{1.1} d{1.1} d{1.2} d{1.1} d{1.1} d{1.1} d{1.1} d{1.0} d{1.2}}
   \toprule
    Alloy & \mc{Ni} & \mc{Cr} & \mc{Co} & \mc{Mo} & \mc{W} & \mc{Al} & \mc{Ti} & \mc{Ta} & \mc{Re} & \mc{Nb} & \mc{V} & \mc{Hf} \\
   \midrule
    \mcTwo{First generation} & & & & & & & & & & & \\
   \midrule
    PWA~1480    & 62.5 & 10   &  5   & \mc{---} & 4        & 5    & 1.5      & 12   & \mc{---} & \mc{---} & \mc{---} & \mc{---} \\[1ex]
    Ren{\'e}~N4 & 62.6 &  9   &  8   & 2        & 6        & 3.7  & 4.2      &  4   & \mc{---} & 0.5 & \mc{---} & \mc{---}      \\[1ex]
    CMSX-2      & 66.6 &  8   &  4.6 & 0.6      & 7.9      & 5.6  & 0.9      &  5.8 & \mc{---} & \mc{---} & \mc{---} & \mc{---} \\[1ex]
    SRR~99      & 66.5 &  8.5 &  5   & \mc{---} & 9.5      & 5.5  & 2.2      &  2.8 & \mc{---} & \mc{---} & \mc{---} & \mc{---} \\
   \midrule
    \mcTwo{Second generation} & & & & & & & & & & & \\
   \midrule
    PWA~1484    & 59.4 &  5   & 10   & 2        & 6        & 5.6  & \mc{---} &  9   & 3        & \mc{---} & \mc{---} & \mc{---} \\[1ex]
    Ren{\'e}~N5 & 61.8 &  7   &  8   & 2        & 5        & 6.2  & \mc{---} &  7   & 3        & \mc{---}      & \mc{---} & 0.2      \\[1ex]
    CMSX~4      & 61.8 &  6.5 &  9   & 0.6      & 6        & 5.6  & 1        &  6.5 & 3        & \mc{---} & \mc{---} & 0.1      \\[1ex]
    CMSX~6      & 70.4 & 10   &  5   & 3        & \mc{---} & 4.8  & 4.7      &  2   & \mc{---} & \mc{---} & \mc{---} & 0.1      \\[1ex]
   \midrule
    \mcTwo{Third generation} & & & & & & & & & & & \\
   \midrule
    CMSX-10     & 69.6 &  2   &  3   & 0.4      & 5        & 5.7  & 0.2      &  8   & 6        & 0.1      & \mc{---} & 0.03     \\[1ex]
    Ren{\'e}~N6 & 57.4 &  4.2 & 12.5 & 1.4      & 6        & 5.75 & 0        &  7.2 & 5.4      & 0        & 0        & 0.15     \\
   \bottomrule
  \end{tabular}
\end{table}
...
\end{document}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
abdu
  • 1,849
  • \begin{figure}[!p] might work – latex user May 28 '13 at 20:05
  • @LuanResende I also tried this but nothing happened it's still sticking to the top of the page! :( – abdu May 28 '13 at 20:07
  • this works for me: \begin{figure}[p] \centering \includegraphics{'picture'} \end{figure} – Rico May 28 '13 at 20:13
  • @Rico I think I have a problem with the floats? I tried adding a picture at the end of my document just to see what happens. It's automatically moved to the top of a new page. It's weird. – abdu May 28 '13 at 20:30
  • 2
    Interessting could you add a MWE reproducing the problem? – Rico May 28 '13 at 20:34
  • @Rico I don't really know what to add. I'm using the standard command for adding an image. but then I used

    \makeatletter \setlength{\@fptop}{0pt} \setlength{\@fpbot}{0pt plus 1fil} \makeatother \clearpage

    to force the table on the following page to go to the top of the page. So I don't know if this has something to do with the problem.

    – abdu May 28 '13 at 20:43
  • @abdu just edit your question and add some (minimal) code which explains your problem this would help a lot, i'll try adding your makeatletter to a sampledocument and have a look if it destroys my image positioning – Rico May 28 '13 at 20:52
  • @Rico Ok edited my question. I hope this helps! =) – abdu May 28 '13 at 20:57
  • Why do you have \usepackage{caption} twice? Also, if you want the figure in the middle, why not remove the figure position specifier? – dustin May 28 '13 at 21:02

1 Answers1

2

If you are not on two column, you could do:

\newpage

\vspace*{\fill}
\begin{figure}[options] 
  \centering
  \includegraphics[]{}
  \caption{}
  \label{}
\end{figure}
\vspace*{\fill}

\newpage
dustin
  • 18,617
  • 23
  • 99
  • 204
  • why so complicated? just use \vfill – Rico May 28 '13 at 20:56
  • @Rico how is \vspace*{\fill} complicated? It may be verbose but it isn't technically taxing. – dustin May 28 '13 at 20:57
  • @abdu not a problem. – dustin May 28 '13 at 21:03
  • @dustin but I still would like to know, how to be able to place the image whereever I want in order to let texts be automatically placed above and under it. In the question I posted my code. I think the table is doing the problems. Or is it sometimes impossibleto force LaTeX to do certain things? – abdu May 28 '13 at 21:08
  • @abdu \begin{figure*} \end{figure*} This will let latex place it where it is most appropriate. – dustin May 28 '13 at 21:28
  • @dustin Ok! Thanks. I also checked my document, I think the image has been always moved to the next page because of lack of space. So now I placed it alone in the centre of a page. – abdu May 29 '13 at 22:58