Frame around float and its caption, how to?
Hi list, I'm using 201100920 00:09 MkIV standalone. Some time ago Marcin Borkowski asked [1] on this list about framing floats together with their captions. It seems to be unanswered and now I stumbled upon a similar problem. I want to have a figure with a caption together in a frame as wide as the surrounding text, aka \textwidth and the caption filling the available horizontal space. I.e. I want something like \setupcaption[width=\textwidth] \starttext \placefigure[here]{\input tufte}{\externalfigure[cow]} \stoptext with a frame around it. I see two approaches here and none of them gives me what I need. First using \setupfloat[frame=on] only frames the cow and not the caption. I think I can manually correct this with "framedepth" and "width" but doing something "manually" in ConTeXt seems not like a good idea. Am I overlooking something about \setupfloat? Secondly, I tried \framed{...} around \placefigure but there are two issues here: How do I setup the caption to fit nicely into the frame? "\setupcaption[width=\textwidth]" is to much because of the frame spacing... And there is another serious issue, see the following minimal example. The frame is where the figure was placed but is empty, because the figure floated to the next page. \setupcaption[width=max] \starttext \dorecurse{2}{\input tufte \par} \framed{\placefigure[here][fig:muh]{\input tufte}{\externalfigure[cow]}} \input tufte \stoptext I have no idea how to procede with this. Hopefully someone on this list knows how to do this right. Thanks in advance, Stefan. [1] http://archive.contextgarden.net/message/20090724.123610.ddad55af.en.html
Am 25.09.2011 um 18:10 schrieb Stefan Müller:
Hi list,
I'm using 201100920 00:09 MkIV standalone. Some time ago Marcin Borkowski asked [1] on this list about framing floats together with their captions. It seems to be unanswered and now I stumbled upon a similar problem. I want to have a figure with a caption together in a frame as wide as the surrounding text, aka \textwidth and the caption filling the available horizontal space. I.e. I want something like
\setupcaption[width=\textwidth] \starttext \placefigure[here]{\input tufte}{\externalfigure[cow]} \stoptext
with a frame around it.
Found this in my mail archive: % engine=pdftex \setupexternalfigures[location={local,global,default}] \setupfloats[frame=on,frameoffset=1mm] \starttext \section{A figure with a background} \placefigure {none} {\placelegend {\externalfigure[mill][scale=2000]} {\placefloatcaption[figure]{A dutch mill}}} \stoptext It works only with MkII because \placefloatcaption isn’t yet rewritten for the new MkIV code. Wolfgang
Thank you for taking a look at this. Too bad your solution is only MkII. The document I'm currently working on is to be written in APA style and unfortunately the frame around figure+caption is required... I'm not really interested in changing to MkII... ;) I hope there can also be a not too involed solution for this in MkIV. Best regards, Stefan On 25.09.2011 18:32, Wolfgang Schuster wrote:
Am 25.09.2011 um 18:10 schrieb Stefan Müller:
Hi list,
I'm using 201100920 00:09 MkIV standalone. Some time ago Marcin Borkowski asked [1] on this list about framing floats together with their captions. It seems to be unanswered and now I stumbled upon a similar problem. I want to have a figure with a caption together in a frame as wide as the surrounding text, aka \textwidth and the caption filling the available horizontal space. I.e. I want something like
\setupcaption[width=\textwidth] \starttext \placefigure[here]{\input tufte}{\externalfigure[cow]} \stoptext
with a frame around it.
Found this in my mail archive:
% engine=pdftex
\setupexternalfigures[location={local,global,default}]
\setupfloats[frame=on,frameoffset=1mm]
\starttext
\section{A figure with a background}
\placefigure {none} {\placelegend {\externalfigure[mill][scale=2000]} {\placefloatcaption[figure]{A dutch mill}}}
\stoptext
It works only with MkII because \placefloatcaption isn’t yet rewritten for the new MkIV code.
Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
participants (2)
-
Stefan Müller
-
Wolfgang Schuster