Determine the width of a float for later use.

tomprice's picture

Hello,

I would like to determine the length of a figure or table for later use in a Scietific WorkPlace document. For example, I would like to put some comments under a table that are no wider than the table. The code below illustrates what I am trying to do. Notice that the Source and Note paragraphs adjust to the width of the figure in the typeset file. These paragraphs change when the figure size is changed. (You will need your own figure.) I am not able to get this code to format using SWP.

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{times}
\usepackage{calc}
%\usepackage{iadb}

\newcommand{\mydem}[1]{\setbox0=\hbox{#1}\unhcopy0\\[3pt]}

\newenvironment{IDBsource}[1]{\textit{Source: }{#1}}{}
\newenvironment{IDBnote}[1]{\\[.6pt]\textit{Note: }{#1}}{}

\begin{document}
Some introductory text.
\begin{figure}[bht]
\begin{center}
\mydem{\hphantom{\includegraphics[scale=.535,draft]{../graphics/businessCycle_gradient.jpg}}}
    \caption{Figure caption.}
    \includegraphics[scale=.55]{../graphics/businessCycle_gradient.jpg}
    \hspace*{\dimen0\relax}  
    \begin{minipage}{\the\wd0}
    \begin{IDBsource}
        Source of the figure source of the figure source of the figure. Source of the figure. Source of the figure source of the figure.
    \end{IDBsource}
    \begin{IDBnote}
        This is a note for this figure.
       
        Some notes may consist of two paragraphs.
    \end{IDBnote}
    \end{minipage}
\end{center}
\end{figure}

\end{document}

 

tomprice's picture

Thanks to my friend Don Story

Thanks to my friend Don Story I may have a solution but I am interested in others.