Take the 2-minute tour ×
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'm using a two column environment, and I placed a table in the left column, as shown in the image:

actual format

Below it the latex source excerpt used to draw such a table:

\documentclass[final,5p,times,twocolumn]{elsarticle}

\usepackage[table]{xcolor}
\usepackage{booktabs}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus quis metus a massa fringilla rutrum. Nulla in tincidunt eros. Maecenas porta facilisis pretium. Ut id tortor ac libero mattis aliquet. Fusce tincidunt, orci ut rhoncus pretium, mauris metus volutpat tortor, nec interdum ante quam a libero. Donec lacinia fringilla tellus nec pretium. Proin iaculis leo eu nisi eleifend non mattis mi convallis. Nam vel nunc mauris, sed condimentum elit. Nam rhoncus nulla eget odio vulputate molestie pretium ligula fringilla. In elementum arcu et augue bibendum dignissim. Ut vel lacus eu erat vulputate consequat at id odio.

Nulla et nibh enim, id faucibus enim. Nullam lobortis, arcu sed commodo semper, urna nisl imperdiet mauris, non vulputate nisl turpis eu arcu. Sed tincidunt, lorem sed posuere dictum, sapien magna euismod ante, at laoreet ligula ipsum sit amet sapien. Ut aliquam, nunc nec vehicula mattis, erat massa pharetra arcu, vel aliquam ipsum mi et nisl. Quisque dui metus, tincidunt in consequat ut, ullamcorper ac quam. Sed diam odio, placerat at gravida eu, accumsan vitae libero. Sed facilisis mi in risus luctus nec dictum ipsum placerat. Nulla facilisi. Curabitur mattis facilisis placerat. Suspendisse vel velit nec sapien posuere ultricies. Proin fringilla, libero vitae bibendum mattis, lacus ipsum interdum purus, eu cursus sapien neque at justo.

\begin{table}[!htp] 

\center \footnotesize \rowcolors{2}{white}{gray!25}

\caption{List of studies.}\label{tab:studiesList}

\begin{tabular}{llcc}

\toprule

    \textbf{ID} & \textbf{Reference} & \textbf{Pub. Type} & \textbf{Year}\\

\midrule

    S84 & text text fake text  & C & 2010\\ 
    S85 & fake text fake text & W & 2011\\ 
    S86 & fake text fake text & W & 2011\\
    S87 & fake text fake text & C & 2010\\
    S88 & fake text fake text  & C & 2011\\
    S89 & fake text fake text  & W & 2011\\         
    S90 & fake text fake text & C & 2010\\
    S91 & fake text fake text  & W & 2011\\
    S92 & fake text fake text  & C & 2011\\
    S93 & fake text fake text  & C & 2010\\
    S94 & fake text fake text  & J & 2012\\
    S95 & fake text fake text  & C & 2010\\
    S96 & fake text fake text  & C & 2011\\
    S97 & fake text fake text  & W & 2011\\         
    S98 & fake text fake text  & C & 2011\\         
    S99 & fake text fake text  & C & 2010\\
    S100 & fake text fake text  & C & 2011\\
    S101 & fake text fake text  & C & 2010\\                     
    S102 & fake text fake text  & C & 2010\\
    S103 & fake text fake text  & C & 2009\\
    S104 & fake text fake text  & C & 2010\\
    S105 & fake text fake text  & C & 2011\\            
    S106 & fake text fake text  & C & 2009\\
    S107 & fake text fake text  & J & 2011\\
    S108 & fake text fake text  & C & 2009\\
    S109 & fake text fake text  & BC & 2010\\           
    S110 & fake text fake text  & C & 2010\\
    S111 & fake text fake text  & C & 2011\\
    S112 & fake text fake text  & W & 2011\\
    S113 & fake text fake text  & C & 2010\\
    S114 & fake text fake text  & J & 2011\\
    S115 & fake text fake text  & W & 2011\\            
    S116 & fake text fake text  & W & 2010\\
    S117 & fake text fake text  & J & 2011\\            
    S118 & fake text fake text  & C & 2010\\
    S119 & fake text fake text  & C & 2010\\
    S120 & fake text fake text  & J & 2011\\            
    S121 & fake text fake text  & J & 2011\\            
    S122 & fake text fake text  & W & 2012\\            
    S123 & fake text fake text  & C & 2012\\            
    S124 & fake text fake text  & W & 2009\\
    S125 & fake text fake text  & C & 2010\\
    S126 & fake text fake text  & C & 2011\\
    S127 & fake text fake text  & W & 2012\\            
    S128 & fake text fake text  & C & 2010\\
    S129 & fake text fake text  & W & 2011\\            
    S130 & fake text fake text  & C & 2007\\
    S131 & fake text fake text  & J & 2010\\            
    S132 & fake text fake text  & J & 2011\\

\bottomrule

    \multicolumn{4}{l}{\textit{Legend for Publication Type:}} \\
    \multicolumn{4}{l}{[J] Journal, [C]
    Conference, [W] Workshop, [BC] Book Chapter}\\

\end{tabular}

 \end{table}

Suspendisse potenti. Pellentesque vel diam velit. Maecenas sagittis feugiat leo, sed lacinia neque pulvinar elementum. Phasellus non ornare velit. Nulla pretium ultrices libero, non vehicula erat semper laoreet. Pellentesque at tortor id diam ornare tincidunt at ac urna. Nulla condimentum interdum sapien. Nunc sit amet quam velit, sed bibendum dolor. Vivamus nec tortor diam, at hendrerit erat. Donec quis ante ut neque dignissim dignissim. Nam dui eros, pulvinar at laoreet sodales, luctus sed leo. Cras id leo quis nunc interdum tristique at nec dolor. Suspendisse eu elit mauris, at iaculis erat. Nunc quis tortor sed justo venenatis tempor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas arcu lacus, condimentum nec rhoncus et, sagittis sed nisi.

Donec sed mi sem. Suspendisse adipiscing, lectus ut egestas vulputate, magna nunc mollis augue, a venenatis dui sapien at mi. Morbi consectetur tincidunt mi id hendrerit. Sed in pellentesque ante. Cras erat orci, fringilla in hendrerit nec, placerat vitae metus. Phasellus vel elit quis est facilisis pellentesque sit amet et nisl. Aliquam placerat libero sed lacus rutrum sodales non vulputate risus. Curabitur condimentum elit ultricies justo iaculis tristique pretium ligula lacinia. Donec convallis mi nec lectus convallis suscipit. Nullam nisi nisl, tempus in condimentum eget, tristique ut mi. Sed in mi nibh. Donec ligula, sagittis vel facilisis a, rhoncus eget lectus. Quisque consectetur libero sit amet sapien commodo ornare. Integer et convallis dolor. Nunc dignissim commodo ultricies. Nam a ante dictum justo laoreet pellentesque.

Integer nulla sapien, viverra at vehicula ac, accumsan sed risus. Praesent nec ante sem, vitae scelerisque massa. Praesent at posuere ipsum. Morbi sed purus a massa bibendum luctus a vitae justo. Integer pretium auctor lacus vitae tincidunt. Suspendisse viverra pretium ante sed luctus. Suspendisse potenti. Cras ullamcorper adipiscing orci, ut pretium nunc pretium at. In vitae augue vel sapien dictum euismod pretium quis erat.

Vestibulum luctus adipiscing orci, ac sagittis purus placerat consectetur. Duis a bibendum sem. Vivamus non sem vel augue blandit rhoncus eget sed lectus. Nulla facilisi. Fusce tellus odio, faucibus et fringilla et, venenatis suscipit risus. Aenean aliquet tempor ligula auctor condimentum. Nulla accumsan est quis nisl fringilla varius. Morbi aliquam dictum magna in commodo. 

Donec sed mi sem. Suspendisse adipiscing, lectus ut egestas vulputate, magna nunc mollis augue, a venenatis dui sapien at mi. Morbi consectetur tincidunt mi id hendrerit. Sed in pellentesque ante. Cras erat orci, fringilla in hendrerit nec, placerat vitae metus. Phasellus vel elit quis est facilisis pellentesque sit amet et nisl. Aliquam placerat libero sed lacus rutrum sodales non vulputate risus. Curabitur condimentum elit ultricies justo iaculis tristique pretium ligula lacinia. Donec convallis mi nec lectus convallis suscipit. Nullam nisi nisl, tempus in condimentum eget, tristique ut mi. Sed in mi nibh. Donec ligula ligula, sagittis vel facilisis a, rhoncus eget lectus. Quisque consectetur libero sit amet sapien commodo ornare. Integer et convallis dolor. Nunc dignissim commodo ultricies. Nam a ante dictum justo laoreet pellentesque.

\end{document}

There is notably some space that could be used before and after the table. How can I force the use of such spaces, so that the text could be something like the following picture.

expected format

I reach a similar "unexpected" result when I use an image, instead of a table. Especially when I use the command \begin{figure*}[!htp], when I try to enlarge the image a little bit, so that I fits the entire page width, it doesn't place the text in the same page, but rather it forces the text to the next page, as shown in the following pictures.

initial format for image and text

actual and unexpected result

share|improve this question
    
It looks like it made a [p] float because it was too big to fit in a text area. You could use \begin{table}[!tp] to tell it to ignore the constraints or you could tune the parameters. See Frank's description of the float parameters tex.stackexchange.com/questions/39017/… –  David Carlisle Jul 2 '12 at 19:18
    
@DavidCarlisle I've forgotten to mention that I do use the \begin{table}[!htp] command, when defining the table. It doesn't solve my problem. –  Ivan Machado Jul 2 '12 at 19:21
1  
well in that case I fall back on the standard comment of this site: please provide a MWE ie a full document that shows the problem. You can make the source small by using \\[5in] etc so you don't need so many actual rows. –  David Carlisle Jul 2 '12 at 19:26
2  
please make a complete document: these things are sensitive to the class you are using fonts you are using, method of getting two columns etc. Your except uses several commands that are not even defined in standard LaTeX. I could make some guesses which packages you used but why make people guess? –  David Carlisle Jul 2 '12 at 19:49
1  
@IvanMachado: You could try Stefan's answer from Set table position to top. By making those changes, I got the desired output. :) –  Paulo Cereda Jul 2 '12 at 20:11

1 Answer 1

up vote 5 down vote accepted

These are problems that are best tackled when the text is in final form. Assuming it is, this particular situation can be cured by specifying

\begin{table}[!t]

as the presence of a p specifier makes the choice of a page float (column float, here) more desirable for LaTeX.

See How to influence the position of float environments like figure and table in LaTeX? for a detailed description of the float placement algorithm.

Remember that the correct way to specify centering of floating material is with

\centering

rather than with \center that adds unwanted vertical space. The \center command exists, but it should never be called in this form, only via \begin{center}.

share|improve this answer
    
That worked properly! –  Ivan Machado Jul 2 '12 at 20:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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