Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have images of tables (screenshots from Excel actually), and up to now I'm using this structure.

\begin{table}[htp]
\includegraphics{mytable.png}
\caption{\label{tab:MyTable}some description}
\end{table}

As far as I have gathered, this is the way to go if I want to get a numbering like "Table 1.99" - which I want it to be.

My problem is that the space between caption and picture is different with every table. Is that because the table-images are all of different height and it gets rounded to \baselineskip or something similar? The idea would then be to make the table be vertically aligned at the bottom (I would not care about extra space above a table, but between table and caption that looks no good) - which I don't know how to achieve.

BTW:

  • I am aware of the fact that it is recommended to place captions above images, but I want it to have the same appearance as my images.
  • I also would like to use table because I want my tables to be listed on the list of tables (so changing "Figure" to "Table" but using begin{figure} won't do the trick for me).
  • I know that using built-in tables would be better, but that's currently not the way to go
  • My images do not have spurious white space at any side

EDIT: In order to have all the text equally sized in all "tables", the screenshots were taken at the same zoom level from Excel. The widest table determined the dpi number which was then set for all the table-images (BTW: 215 dpi), so that it fittet on the page. Might that odd resolution be the problem? I'm trying to reproduce it with other images, but it seems random somehow...

share|improve this question
5  
I'm sure others will wonder too.... why not produce the tables in LaTeX? – cmhughes Feb 1 at 16:35
4  
@David I suspect we are going to need some demo images here, plus a suitable TeX file to try them with. It's not clear to me exactly where the spacing might come from. – Joseph Wright Feb 1 at 16:43
3  
maybe the screenshots are not cropped properly? – percusse Feb 1 at 16:46
3  
@BenediktBauer There is no difference between {figure} and {table} environment, besides the fact that they show a different caption text and use a different counter. As a journal Copy Editor, I can verify that table is a table even when it's an Excel printscreen, and I change this in the manuscripts I typeset. – tohecz Feb 1 at 17:29
2  
You need to check your images in an image viewer (or simply put \fbox{...} around the image to test) to see if there is spurious white space in the image,and if so crop the images before inclusion. However while it's reasonable to enter and manage the data in excel you will get much better typeset result if instead of printing a screenshot you export the data from excel as a comma separated list and then import that into latex to typeset the table. – David Carlisle Feb 1 at 17:42
show 12 more comments

closed as too localized by Stephan Lehmke, David Carlisle, tohecz, cmhughes, lockstep Feb 1 at 19:55

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.

1 Answer

As it turned out - and frankly I don't know the real reasons - it all depends on the physical size of the images. So if the resolution is high enough, the image will fit (horizontally) onto the page and the caption will be placed close to the image. If the resolution is too low, so that the image is too wide, the caption is moved away from the image.

The main problem was in my case, that I had used [width=\textwidth] in some cases (so it was not obvious right away), trusting in LaTeX to make it fit perfectly onto the page taking all the horizontal space possible. Yet in my configuration (don't know what/where the culprit is), this always resulted having extra space between table and caption, no matter high the res was set on the pictures.

I have used the etoolbox package and the \AtBeginEnvironment and \AtEndEnvironment to fine tune spacing, but there's not more to it than \vspace{...} so I don't suspect that to be the problem.

Sorry, for not being able to provide a profound explanation - instead of a work around which may even not apply generally.

share|improve this answer
3  
I'm afraid this makes the question too localized... – Stephan Lehmke Feb 1 at 19:03
1  
scaling bitmap images of a screenshot image of a table is unlikely to make for readable output. Why are you importing the tables this way? – David Carlisle Feb 1 at 19:04
@DavidCarlisle I asked him above under the question, his answer: tex.stackexchange.com/questions/96351/… – Speravir Feb 1 at 19:13

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