How to make Figure captions justify if long?
![](https://secure.gravatar.com/avatar/6405d132ea78b13c33e6cbe9bbb8c590.jpg?s=120&d=mm&r=g)
Hello, The title is not self explaining, I'll try to do this. My layout style require that table or figure captions stay centered only if short. If long, it needs that the caption be justified (like normal text, but less width). In LaTeX, I know that this works on article document class, like the pdf file I attached shows. -- Wagner Macedo
![](https://secure.gravatar.com/avatar/02a711d78d02355347d6cff73fda2572.jpg?s=120&d=mm&r=g)
On 2012-02-08 Wagner Macedo
My layout style require that table or figure captions stay centered only if short. If long, it needs that the caption be justified (like normal text, but less width).
I don't know if I get you right, but I think you are talking about the width of the caption. It adaptes to the with of the figure. There is the “minwidth” parameter for \setupcaptions, but since the short captions will not be centred it's probably not what you aim for. I don't have a solution, but a workaround that alters the global width setting for an individual caption: \useMPlibrary [dum] \starttext \startplacefigure [title=Foo Bar] \externalfigure [placeholder] \stopplacefigure \setupcaptions [width=.8\textwidth] \startplacefigure [title={\input tufte\par}] \externalfigure [placeholder] \stopplacefigure \setupcaptions [width=fit] \startplacefigure [title=Foo Bar] \externalfigure [placeholder] \stopplacefigure \input knuth \stoptext Marco
![](https://secure.gravatar.com/avatar/6405d132ea78b13c33e6cbe9bbb8c590.jpg?s=120&d=mm&r=g)
Thanks by the answer, but I had already thought in this. I would like
something more definitive.
By the way, at http://wiki.contextgarden.net/Reference/en/setupcaptions I
can see a command argument. I was wondering if a custom command can do the
trick, but I don't know how I should use this arg and what it is for.
--
Wagner Macedo
On 8 February 2012 21:43, Marco
I don't know if I get you right, but I think you are talking about the width of the caption. It adaptes to the with of the figure. There is the “minwidth” parameter for \setupcaptions, but since the short captions will not be centred it's probably not what you aim for. I don't have a solution, but a workaround that alters the global width setting for an individual caption:
![](https://secure.gravatar.com/avatar/e79f226aa442b589932230491affa641.jpg?s=120&d=mm&r=g)
Am 09.02.2012 um 02:13 schrieb Wagner Macedo:
Thanks by the answer, but I had already thought in this. I would like something more definitive.
How about this: \starttext \placefigure[here]{This is just an example for this is just an example for this is just an example for this is just an example for this is just an example for this is just an example for this}{\externalfigure[any][width=0.5\textwidth]} \stoptext ------- Steffen
![](https://secure.gravatar.com/avatar/6405d132ea78b13c33e6cbe9bbb8c590.jpg?s=120&d=mm&r=g)
In your example, the caption is limited to image width.
What I want is something as
\setupcaption[figure][width=\textwidth, align=middle]
does. But long texts should behave as document text (hyphenated, including).
Thanks by attention.
--
Wagner Macedo
On 9 February 2012 04:34, Steffen Wolfrum
How about this:
\starttext
\placefigure[here]{This is just an example for this is just an example for this is just an example for this is just an example for this is just an example for this is just an example for this}{\externalfigure[any][width=0.5\textwidth]}
\stoptext
![](https://secure.gravatar.com/avatar/cedc4d83943006afe3994fb0a0455f82.jpg?s=120&d=mm&r=g)
On Thu, Feb 09 2012, Wagner Macedo wrote:
My layout style require that table or figure captions stay centered only if short. If long, it needs that the caption be justified (like normal text, but less width).
--8<---------------cut here---------------start------------->8--- \defineframed[FullWidth][offset=overlay, width=\textwidth, frame=off, align=middle] \starttext \placefigure[here]{\input tufte\relax} {\FullWidth{\externalfigure[any][width=3cm]}} \placefigure[here]{Short} {\FullWidth{\externalfigure[any][width=3cm]}} \stoptext --8<---------------cut here---------------end--------------->8--- Is this a solution? -- Peter
![](https://secure.gravatar.com/avatar/6405d132ea78b13c33e6cbe9bbb8c590.jpg?s=120&d=mm&r=g)
Yes, thank you.
And to not need to enclose \externalfigure with \FullWidth, I found that I
can set the command attribute on \setupfloat[figure] as following:
\defineframed[FullWidth][offset=overlay, width=\textwidth, frame=off,
align=middle]
\setupfloat[figure][command=\FullWidth]
--
Wagner Macedo
On 9 February 2012 09:06, Peter Münster
Is this a solution?
![](https://secure.gravatar.com/avatar/02a711d78d02355347d6cff73fda2572.jpg?s=120&d=mm&r=g)
On 2012-02-09 Peter Münster
\defineframed[FullWidth][offset=overlay, width=\textwidth, frame=off, align=middle] \starttext \placefigure[here]{\input tufte\relax} {\FullWidth{\externalfigure[any][width=3cm]}} \placefigure[here]{Short} {\FullWidth{\externalfigure[any][width=3cm]}} \stoptext
Is this a solution?
This looks like the solution, yes. However you scatter the source with \FullWidth commands. Wagners solution seems to be more clean. So we end up with the following: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Sorry Aditya, for not using your kitties ;) \useMPlibrary [dum] \defineframed [FigureFramed] [ width=.8\textwidth, offset=overlay, frame=off, ] % Doesn't work :( Why not? %\setupfloat [figure] [width=.8\textwidth] \setupfloat [figure] [command=\FigureFramed] \starttext \startplacefigure [title=Foo Bar] \externalfigure [placeholder] \stopplacefigure \startplacefigure [title={\input tufte\par}] \externalfigure [placeholder] \stopplacefigure \input knuth \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% But the question is, why does setting the float width in \setupfloat fail? What else is it supposed to do? It doesn't seem to do anything. Marco
participants (4)
-
Marco
-
Peter Münster
-
Steffen Wolfrum
-
Wagner Macedo