How to make Figure captions justify if long?
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
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
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:
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
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
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
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?
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