1

Is there a way to set the width of a wraptable to the width of the tabular that it is containing rather than setting a specified width?

\begin{wraptable}{r}{8cm}
\begin{tabular}{lcc}
\toprule
& Fibonacci Heap & Binary Heap \\ \midrule
\texttt{insert} & \bigO{1} (amortized) & \bigO{\log{n}} \\ \midrule
\texttt{decreaseKey} & \bigO{1} (amortized) & \bigO{n} \\ \midrule
\texttt{deleteMin} & \bigO{1} (amortized) & \bigO{\log{n}} \\ \bottomrule
\end{tabular}
\caption{The runtime efficiency of different Priority Queues}\label{tabular:priorityQueuesRuntime}
\end{wraptable}

Thanks for any help!

PS: don't think about the runtimes of the algorithms (if you can relate to them), they're wrong!

1 Answers1

3

From wrapfig's documentation:

2 Sizing and optional overhang

Parameter #4 (the second required parameter) is the width of the figure or table. [...]

However, if you specify a width of zero (0pt), the actual width of the figure will determine the wrapping width. A following \caption should have the same width as the figure, but it might fail badly; it is safer to specify a width when you use a caption.

Try \begin{wraptable}{r}{0pt} .... And please provide a MWE and not code snippets.

Arash Esbati
  • 7,416
  • While this works to adjust the width, it somehow negates \vspace{-\baselineskip} that aligned the wraptable with the first line of text. Is there any way around that? – Druid Raves - V Feb 10 '18 at 19:29
  • @EmeraJade - wrapfig adds a gap of \intextsep at the top and bottom (check the manual). I'm not sure what exactly you're looking for, maybe you open up a new question. – Arash Esbati Feb 10 '18 at 21:03
  • I figured it out thanks to this answer https://tex.stackexchange.com/a/258957/131277 – Druid Raves - V Feb 10 '18 at 21:04