1

I have a table which can get aligned to the column width but the table is a part of the subpoint. By subpoint I mean (an itemize within an itemize or a point within a list of points), the width should be lesser than the column. It's 2 column page. Therefore I need it to be aligned to subpoint width. Here's my code:

\begin{table}[ht]
\centering
\caption{Time complexity for heap operations}
\setlength{\tabcolsep}{4pt} 
\renewcommand{\arraystretch}{1.2}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{cccc}
\hline\hline 
Implementation & deletemin(d) & insert/decreasekey(i) & {|V| x d + (|V| + |E| x i ) }\\
\hline
Binary heap    & O(log |V|)         & O(log |V|)                  & O((|V| + |E| )log |V|)  \\
d-ary heap     & O(\[\dfrac{dlog|V|}{log d}\])        & O(\[\dfrac{log|V|}{log d}\])                 & O((|V|\dot d + |E| )\[\dfrac{log|V|}{log d}\])              \\
Fibonacci heap & O(log |V|)         & O(1) (amortized)                  &O(|V|log |V| + |E|)  \\
\end{tabular}}

Here is the result: enter image description here

  • 3
    Welcome to TeX.SE. What is a subpoint? Do you mean the width of paragraph by the current \item? – user31729 Apr 14 '17 at 23:14
  • Off-topic but you need to replace log with \log – Au101 Apr 14 '17 at 23:20
  • PLease make your code compilabe (you have many errors in code) and extend this code sniped to complete small document with \documentclass{...} on its beginning and \end{document} on the end. It seems that your table is to wide to be fit into column width (even with use of \tiny font size). A solution can be make table over both document columns with use \begin{figure*} ... \end{figure*}. – Zarko Apr 14 '17 at 23:34
  • It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you. – Dai Bowen Apr 14 '17 at 23:35
3

If the table is part of the list structure you can sized it to \linewidth rather than \columnwidth but also you should just have the tabular and remove the table environment. The only purpose of table is to specify that the table is a floating environment that may be moved to help with page breaking, so it may not appear within the list, so by design the table environment resets most settings so they are not affected by the environment where you set the table.

I would never apply \resizebox to a table it produces font sizes that are inconsistent with the rest of the document. You can use tabular* to force the table width to be \linewidth without needing to distort the font size.

  • Don't forget \captionof{table} and possibly a minipage. – John Kormylo Apr 15 '17 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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