I am trying to save a minipage width and height in one environment, and use these dimensions in a subsequent environment of mine, to make a picture environment.
The idea is to create a picture on the right of the minipage using the rest of the \columnwidth, and with the same height as the minipage on the left.
The problem is, as far as I understand, that neither the lengths nor the \savebox'es set within the first environment survive to the next one, as they are subject to scoping rules of LaTeX.
So my question is, how can save dimensions (or the box) in one environment and use them in another?
Update: here is (non-working) example using \global:
\documentclass{article}
\usepackage{calc}
\usepackage{picture}
\newsavebox{\questiontextbox}
\newsavebox{\questionpicturebox}
\newlength{\questiontextheight}
\newenvironment{questiontext}[1]%
{\begin{lrbox}{\questiontextbox}%
\begin{minipage}[t]{#1}}%
{\end{minipage}\end{lrbox}%
\noindent\usebox{\questiontextbox}%
\settoheight{\questiontextheight}{\usebox{\questiontextbox}}% ****
\global\setlength{\questiontextheight}{\questiontextheight}}
\newenvironment{questionpicture}[1]%
{\begin{lrbox}{\questionpicturebox}%
\setlength{\unitlength}{1cm}%
\begin{picture}(#1-\fboxsep-\fboxsep,\questiontextheight)}%
{\end{picture}\end{lrbox}%
\fbox{\raisebox{-\questiontextheight}{\usebox{\questionpicturebox}}}}
\begin{document}
\begin{questiontext}{0.2\columnwidth}
There must be some text here so I made it up to fill more than just a
single line.
\end{questiontext}%
\begin{questionpicture}{0.8\columnwidth}
\put(0.5,0.5){\circle{0.4}}
\end{questionpicture}
\end{document}
The \fbox is there only to visualize that the picture height is only two \fboxsep's. I tried to put \global before \settoheight in the line marked with ****, which does not work, either. No idea what I am doing wrong; could the packages calc or picture (which is needed to use real dimensions) prevent proper \global behaviour?


