3

I would like to enforce a table on a page.

I tried \startpostponing[2] but it doesn't seem to work and gives me an error:

Undefined control sequence \startpostponing

Is there any other way by which, I could force my table to occur on a particular page.

P.S I also tried \afterpage{}, but it didn't work as well.

Edit: My code:

        \documentclass[12pt,oneside, paper=a4,pagesize=pdftex, liststotoc, bibtotoc]{scrartcl}
        %Einstellungen der Seitenrnder
        \usepackage[left=3.0cm,right=3.0cm,top=3cm,bottom=3cm,includeheadfoot]{geometry}
        \usepackage{graphicx}
        %Umlaute ermglichen
        \usepackage[latin1]{inputenc}
        \usepackage{color}
        %\usepackage[printonlyused]{acronym}
        \usepackage{cite}
        \usepackage{multirow}
        \usepackage{booktabs}
        \usepackage{setspace}
        \usepackage{amssymb}
        \usepackage{wrapfig}
        \usepackage[tight,TABTOPCAP]{subfigure}
        \usepackage{float}
        \usepackage{epstopdf}
        \definecolor{orange}{rgb}{1,0.5,0}
        \usepackage[T1]{fontenc}
        \usepackage{algorithmic}
        \usepackage{amsmath}
        %------------------------------------------------------------------------- 
        % macros - newly defined by htrsek
        \newcommand{\todo}[1]{\textcolor{red}{\textbf{TODO: #1}}}
        \newcommand{\comment}[2]{\textcolor{orange}{\textbf{\textit{\textless Comment (#1): #2\textgreater}}}}
        \newcommand{\inprogress}[3]{\textcolor{blue}{\textbf{InProgress: #1}}}
        \newcommand{\translate}[4]{\textcolor{green}{\textbf{(#1)}}}
        \newcommand{\flexWARE}{\textsuperscript{flex}WARE }
        \newcommand{\thedate}{\today}
        %[BC] Using the listing package for source code embedding.
        \usepackage{listings} \lstset{numbers=left, numberstyle=\tiny, numbersep=5pt} \lstset{language=Perl} 

         %PDF Kram
        \usepackage[%
            pdftitle={something},% Titel des PDF Dokuments.
            pdfauthor={someone},%Autor des PDF Dokuments.
            pdfsubject={something},%Thema des PDF Dokuments.
            pdfcreator={MiKTeX, LaTeX, hyperref, KOMA-Script},%Erzeuger des PDF Dokuments.
            pdfkeywords={project title},% auch fr PDF 
            pdfpagemode=UseOutlines,% Inhaltsverzeichnis anzeigen beim 
            %pdfdisplaydoctitle=true,%Dokumenttitel statt Dateiname 
            pdflang=en%Sprache des Dokuments.
        ]{hyperref}

        \definecolor{LinkColor}{rgb}{0,0,0.5}
        \definecolor{hellgelb}{rgb}{1,1,0.8}
        \definecolor{colKeys}{rgb}{0,0,1}
        \definecolor{colIdentifier}{rgb}{0.4,0.4,0.4}
        \definecolor{colComments}{rgb}{0,0.5,0}
        \definecolor{colString}{rgb}{1,0,0}
        \definecolor{blue}{rgb}{0,0,1}

        \hypersetup
        {
            colorlinks=true,%        Aktivieren von farbigen Links im Dokument (keine Rahmen)
            linkcolor=LinkColor,%    Farbe festlegen.
            citecolor=LinkColor,%    Farbe festlegen.
            filecolor=LinkColor,%    Farbe festlegen.
            menucolor=LinkColor,%    Farbe festlegen.
            urlcolor=LinkColor,%     Farbe von URL's im Dokument.
            bookmarksnumbered=true%  Überschriftsnummerierung im PDF Inhalt anzeigen.
        }
        %Zeilenabstand 1.2
        \linespread{1.2}
        %Kopf- und Fusszeile
        \usepackage{fancyhdr}
        \pagestyle{fancy}
        \fancyhf{}
        %Kopfzeile links bzw. innen
        \fancyhead[L]{\textsf{someone}}
        %Kopfzeile rechts bzw. aussen
        \fancyhead[R]{\textsf{\nouppercase{\leftmark}}}
        %Linie oben
        \renewcommand{\headrulewidth}{0.5pt}
        %Fusszeile links bzw. innen
        \fancyfoot[L]{\textsf{Something}}
        %Fusszeile rechts bzw. aussen
        \fancyfoot[R]{{\textsf{\pagemark}}}
        %Linie unten
        \renewcommand{\footrulewidth}{0.5pt}
        \setlength{\parindent}{0pt}

        %Setup for listings.
        \lstset{basicstyle=\small}
        \lstset{language=C}

        \newtheorem{Def}{Definition}
        \begin{document}
        \thispagestyle{empty}

        \newpage
        \pagenumbering{arabic}

        \thispagestyle{empty}
        \mbox{}

        \newpage
        \renewcommand{\thepage}{\roman{page}}
        \section*{Affirmation}
        \newpage
        \section*{Abstract}

        \newpage

        \section*{Acknowledgements}

        \newpage



        \setcounter{tocdepth}{3}
        \tableofcontents


        \newpage

   \afterpage{
\clearpage
\begin{landscape}
\begin{table}[p!]
\begin{center}
\rowcolors{1}{thistle}{lightblue}
 \begin{tabular}{ | p{4cm} | p{5cm} | p{5cm} | p{4.5cm} |}
\hline


My table


\hline
 \end{tabular}
\end{center}
\end{table}
\end{landscape}
\clearpage

\clearpage
\begin{landscape}
\begin{table}[h]
\begin{center}
\rowcolors{1}{thistle}{lightblue}
 \begin{tabular}{ | p{4cm} | p{5cm} | p{5cm} | p{4.5cm} |}
\hline
\hiderowcolors \textbf{Examples} & \textbf{How it works} & \textbf{Technologies} & \textbf{On the market} \\ \hline \showrowcolors

Table2

 \\ \hline
 \end{tabular}
    \caption{Examples of IoT.}
\end{center}
\end{table}
\end{landscape}
\clearpage
}



        \end{document}         
mafp
  • 19,096
Spaniard89
  • 679
  • 2
  • 6
  • 12
  • 4
    If you want it in a particular position just use tabular wrapping that tabular in \begin{table} tells latex to move it to somewhere convenient for page breaking. If you don't tell LaTeX to move it, it won't move. – David Carlisle Jan 23 '13 at 15:26
  • @DavidCarlisle I am using Tabular, and it didn't bring any luck. – Spaniard89 Jan 23 '13 at 15:47
  • @DavidCarlisle My document is too long to paste it here, hence I have pasted the part of my code where table is generated. The problem is, my table occurs at the end of the document and not where it is called in latex. – Spaniard89 Jan 23 '13 at 15:54
  • 1
    The idea is that you generate a minimal small (but complete) example that shows the problem. But as I said in the first comment the only reason for using begin{table} is to allow latex to move the table. In particular using [h] makes it highly likely that the float goes to the end as it's main effect is to stop latex using t top ppage float or b bottom. – David Carlisle Jan 23 '13 at 15:58
  • 1
    Please fix your example if you run it it produces ! Undefined control sequence. `l.117 \afterpage {! LaTeX Error: Environment landscape undefined.

    l.119 \begin{landscape}

    ? ! Undefined control sequence. l.122 \rowcolors {1}{thistle}{lightblue} ?

    – David Carlisle Jan 23 '13 at 16:04
  • @DavidCarlisle I am extremely sorry, that was copy-paste error, I have updated my code above,please have a look at it. Thanks a lot for helping me out. – Spaniard89 Jan 23 '13 at 16:05
  • Still the same errors you load dozens of packages unrelated to the problem, and don't load the packages that define the commands that you use. afterpage landscape rowcolors all give undefined command errors. Please test your document before posting. – David Carlisle Jan 23 '13 at 16:10
  • 1
    Related (duplicate?): http://tex.stackexchange.com/q/9485/21591 – mafp Jan 23 '13 at 16:12
  • I've managed to work out the errors but I'm trying to clarify... we're trying to force the first table onto page 2? Edit: I think mafp linked to a good solution for this. – LordStryker Jan 23 '13 at 16:16
  • @LordStryker No Actually we are forcing it on page 7 and 8, cause there are two table embedded inside \afterpage{} – Spaniard89 Jan 23 '13 at 16:17

1 Answers1

4

The boxhandler package can do what you want. [Note I edited this one day after the first post, offering an improved version that requires no user intervention other than defining in advance on which pages the figures should appear.] In this MWE I give below, the figures will appear on pages 1, 3, and 4, as defined in the preamble to the document.

\documentclass{article}
\usepackage{ifthen}
\usepackage{boxhandler}
\holdFigures
\bxfigure{Here is my caption}
  {\fbox{Here is my figure material}}
\bxfigure{Here is my another caption}
  {\fbox{Here is some more figure material}}
\bxfigure{Here is my third caption}
  {\fbox{Here is yet more figure material}}
\newcommand\checkpage{\ifthenelse%
  {\equal{\csname figpage\roman{figure}\endcsname}{\thepage}}%
  {\nextFigure[t]}{}}
\let\parsave\par
\def\par{\parsave\checkpage}
\def\figpage{1}
\def\figpagei{3}
\def\figpageii{4}
\begin{document}
The \textsf{boxhandler} package has figure (and table) deferral options.
By using \verb|\holdFigures|, figures may be defined but are not output.
They are only output with a \verb|\nextFigure| or if you want the
backlog cleared out, with \verb|\clearFigures|.

Note that in this MWE, I first create all the figures in the
preamble using the \verb|\bxfigure| command, with
\verb|\holdFigures| active.  I have created a command
\verb|\checkpage| which is automatically invoked with every
\verb|\par|.  If the page is a predefined value, the next figure is
printed.  To predefine what pages the figures will printout, the
user need merely define the variables, using a roman suffix of
(figure$- 1$)\\

\noindent
\verb|\def\figpage{1}   % First  figure on page 1|\\
\verb|\def\figpagei{3}  % second figure on page 3|\\
\verb|\def\figpageii{4} % third  figure on page 4|\\
\verb|...|

Notice in this document that nowhere, after \verb|\begin{document}|
is a figure call invoked anywhere.  Yet the figures show at their
assigned locations.

\clearpage
Here is text

\clearpage
more text

\clearpage
still more text

\end{document}

Here is a snapshot of the top of page 1

enter image description here

David Carlisle
  • 757,742