GeneralForcing table / image within template

LaTeX specific issues not fitting into one of the other forums of this category.
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Forcing table / image within template

Post by ijc »

Hi again,

I'm having a bit of difficulty forcing a large table onto a particular page in my thesis.

The template we have to use (http://www.inf.ed.ac.uk/teaching/course ... cs4rep.cls) starts new chapters on a new page. One of my appendices has a big table on it, which does fit on a single A4 page, but when I try to include it in my appendix it always puts it on the next page. I thought it might be because it was too big with the chapter title on the same page as well, but even if I scale it very small, it still goes on the other page.

There is no text in the appendix/chapter, just this table.

Code: Select all

\chapter{FFT Core Options}
\label{apd:fftoptions}

\begin{sidewaystable}[!h]
\caption{...} % title name of the table
\centering % centering table
\scalebox{...}{
\begin{tabular}{|l| p{6.5cm}| p{2.5cm}| p{6.5cm}|} % creating 10 columns
...

I tried forcing it with ! but that doesn't make a difference - perhaps because there is no text anyway...

I hope you can help,

Thanks in advance
IJC

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Forcing table / image within template

Post by localghost »

Try a \clearpage (or \cleardoublepage) command right after the table environment to force its output.


Best regards
Thorsten
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Forcing table / image within template

Post by ijc »

If I put a \cleardoublepage at the top of the appendix, is just leaves a blank page before putting the table it, but the table is not under the appendix heading.

Nothing happens if I put the command anywhere else (in the main doc, below of above the apndx. or below the table in the apndx)


Thanks for your help

IJC
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Forcing table / image within template

Post by gmedina »

Try using the hvfloat and float packages instead. A simple example:

Code: Select all

\documentclass{book}
\usepackage{float}
\floatplacement{table}{H}
\usepackage{hvfloat}

\begin{document} 

%saving the table in a box to be passed as argument to \hvfloat
\newbox{\mytable}
\savebox{\mytable}{%
  \begin{tabular}{cc}\hline
    a & b \\
    c & d \\
    e & f \\
    g & h \\ \hline
  \end{tabular}}

\chapter{Appendix 1}
\hvFloat[capPos=r,objectAngle=-90,capAngle=-90,]%
  {table}%
  {\usebox{\mytable}}%
  {Test table 2}%
  {tab:test2}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Forcing table / image within template

Post by ijc »

./MainReport.tex:10:File `hvfloat.sty' not found. ^^M

I have my appendix in a seperate file...ffttiming.tex

main.text

Code: Select all

\documentclass[parskip]{cs4rep}

\usepackage[pdftex]{graphicx}
\usepackage{color}
\usepackage{rotating}

\usepackage{float}
\floatplacement{table}{H}
\usepackage{hvfloat}

\usepackage{caption3} % load caption package kernel first
\DeclareCaptionOption{parskip}[]{} % disable "parskip" caption option
\usepackage[small]{caption}
...
\appendix
\include{fftoptions}
\include{ffttiming}
...

ffttiming.tex

Code: Select all

\chapter{FFT Core Options}
\label{apd:fftoptions}
\hvFloat[capPos=r,objectAngle=-90,capAngle=-90,]%
  {table}%
  {\usebox{\mytable}}%
  {Test table 2}%
  {tab:test2}

%saving the table in a box to be passed as argument to \hvfloat
\newbox{\mytable}
\savebox{\mytable}{%

\begin{sidewaystable}[!h]
...

Thanks very much for your help

IJC
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: Forcing table / image within template

Post by gmedina »

You are missing the hvfloat package. You can get it from CTAN using the link I already provided. Besides that, I do not understand your last post.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Forcing table / image within template

Post by ijc »

Thanks gmedina.

I posted the last bits of my code so you could see how I have it set up, in case there is something in there causing problems.

I got the hvfloat.sty file and put it in the same directory as my report.

./fftoptions.tex:9:Undefined control sequence. {tab:test2}
./fftoptions.tex:9:Missing number, treated as zero. {tab:test2}
./fftoptions.tex:53:Not in outer par mode. }
./fftoptions.tex:53:Undefined control sequence. }
./fftoptions.tex:53:Missing number, treated as zero. }


I tried taking the

Code: Select all

  {Test table 2}%
  {tab:test2}
that out, but it still came up with the other errors.

All the {} appear to be matched up.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Forcing table / image within template

Post by gmedina »

Ah. From what I can see you are still using the sidewaystable environment and I think that's unnecessary if you are going to use the hvfloat package. Please, if possible, post the complete relavant parts of the code you are using for your table. Better yet, if you can post the complete table code, I could try to help you more efficiently.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Re: Forcing table / image within template

Post by ijc »

Thanks for sticking with this gmedina.

The appendix tex file is attached with the table code in it. I also attached the pdf file so you can see what it's outputting and why it isn't right.

I had to battle with LaTeX to get the table landscape, it's too big to do portrait so if hvfloat can make it go landscape all is well.
Attachments
fftoptions.pdf
output
(31.58 KiB) Downloaded 364 times
fftoptions.tex
The appendix tex file
(2.43 KiB) Downloaded 296 times
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Forcing table / image within template

Post by gmedina »

I am attaching the .tex file with some corrections. You will have to add (if you haven't done it already) this lines in your document's preamble:

Code: Select all

\usepackage{graphicx}
\usepackage{float}
\floatplacement{table}{H}
\usepackage{hvfloat}
Remarks: 1) Your table is too big so I scaled it using the \scalebox command provided by the graphicx package.
2) In this thread Juanjo gave some useful advise to reduce the size of a table.
Attachments
fftoptions.tex
(2.27 KiB) Downloaded 382 times
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply