On 2014-07-25 07:10, Hans Hagen wrote:
Am 24.07.2014 um 10:36 schrieb Wolfgang Schuster
mailto:schuster.wolfgang@gmail.com>: \starttext
\startplacefigure \framed[width=.8\textwidth,framecolor=red]{one} \stopplacefigure
\setupfloat[figure][location=flushleft]
\startplacefigure \framed[width=1.2\textwidth,framecolor=blue]{two} \stopplacefigure
\stoptext
You can use the command key for \setupfloat to apply a macro to the finished content of the float.
The purpose of this macro is to save the content and compare the width to the width of the text are, when the figure is wider then the available space use the \leftaligned or \rightaligned commands to let the content protrude to the outer margins.
\setuppagenumbering[alternative=doublesided]
\setuplayout[backspace=4cm,width=12cm]
\definemeasure[Widefigure][\textwidth+\rightmargindistance+\rightmarginwidth]
\setupfloat[figure][command=\FigureCommand]
\define\FigureCommand {\dowithnextbox {\signalrightpage \ifdim\nextboxwd>\textwidth \doifrightpageelse{\leftaligned{\flushnextbox}}{\rightaligned{\flushnextbox}}% \else \midaligned{\flushnextbox}% \fi} \hbox}
\showframe
\starttext
\startplacefigure \framed[width=.8\textwidth,framecolor=red]{Left margin} \stopplacefigure
\page
\startplacefigure \framed[width=\measure{Widefigure},framecolor=red]{Left margin} \stopplacefigure
\input knuth
\page
\startplacefigure \framed[width=\measure{Widefigure},framecolor=red]{Right margin} \stopplacefigure
\stoptext
Wolfgang ___________________________________________________________________________________
With Wolfgang's solution, the captions remain centered on the page. With Hans's solution, the captions move with the center of the frame. I expect that, if captions are used and there are other figures that are not placed with this mechanism, Wolfgang's solution will result in a better looking page.
-- Rik