Vertical alignment of \placefigure[right]
Hi, I would like to vertically shift the placement of figures (\placefigure[right]...), so that the upper side of the figure would be aligned with the top of the first line in a paragraph as opposed to the bottom of the first paragraph. Here's a minimal example. The second "ugly workaround" shows what I'm trying to achieve, but ideally using a cleaner approach. Does there exist a magic keyword for that? \starttext \hrule \placefigure[right]{Caption}{\framed[width=5cm,height=4cm]{}} \input knuth % ugly workaround \hrule \vskip-11pt \placefigure[right]{Caption}{\framed[width=5cm,height=4cm]{}} \vskip11pt \input knuth \stoptext Thank you, Mojca
Am 07.05.2014 um 14:23 schrieb Mojca Miklavec
Hi,
I would like to vertically shift the placement of figures (\placefigure[right]...), so that the upper side of the figure would be aligned with the top of the first line in a paragraph as opposed to the bottom of the first paragraph.
Here's a minimal example. The second "ugly workaround" shows what I'm trying to achieve, but ideally using a cleaner approach. Does there exist a magic keyword for that?
You can change the value with \setupfloat[spacebefore=] but it’s a global value for all float types. Wolfgang
I would like to vertically shift the placement of figures (\placefigure[right]...), so that the upper side of the figure would be aligned with the top of the first line in a paragraph as opposed to the bottom [of the first line?] of the first paragraph.
Ah, I can finally answer a question. The key is "high": \starttext \hrule \placefigure[right,high]{Caption}{\framed[width=5cm,height=4cm]{}} \input knuth \stoptext But that seems too easy. Is it what you want? -Sanjoy
On Wed, May 7, 2014 at 2:48 PM, Sanjoy Mahajan wrote:
I would like to vertically shift the placement of figures (\placefigure[right]...), so that the upper side of the figure would be aligned with the top of the first line in a paragraph as opposed to the bottom [of the first line?] of the first paragraph.
Ah, I can finally answer a question. The key is "high":
\starttext \hrule \placefigure[right,high]{Caption}{\framed[width=5cm,height=4cm]{}} \input knuth \stoptext
But that seems too easy. Is it what you want?
Yes, perfect, that's *exactly* what I want. Thank you, Sanjoy. Now it would be nice to document this on http://wiki.contextgarden.net/Command/placefigure What other keywords are related to "high"? I'm guessing "low" which might or might not spare you an extra line on bottom (but that's just judging from a few quick experiments). If you know a bit more about how to combine these keywords, I would be grateful if you would add a few examples, else I'll document this one. Mojca
I use "high" in combination with zero spacing afterwards, in order to tighten the text flowing around the figure. Compare the two variants below. (I confess to not knowing the difference between "sidespaceafter" and "spaceafter," but both seem to have the same effect.) \starttext {\setupfloats[sidespaceafter=0pt] \hrule \placefigure[right,high]{Caption}{\framed[width=5cm,height=4.3cm]{}} \input knuth } \vskip1cm \hrule \placefigure[right,high]{Caption}{\framed[width=5cm,height=4.3cm]{}} \input knuth \stoptext
Here are a few more keys. I don't fully understand their effect, but I found them in strc-flt.mkvi (p.s. shouldn't that be .mkiv ?). In the final "grid" examples, I extended the figure height to 4.5cm, to show the effect of the grid, which seems to be that the bottom of the figure aligns with a baseline. The top can then protrude, if the height is not a multiple of the line height. But, if the figure heights are right, it would look good in combination with \setupfloats[sidespaceafter=0pt]. -Sanjoy \starttext \hrule \placefigure[right]{Caption}{\framed[width=5cm,height=4.3cm]{}} \input knuth \vskip1cm \hrule \placefigure[right,fit]{Fit}{\framed[width=5cm,height=4.3cm]{}} \input knuth \page \hrule \placefigure[right,depth]{Depth}{\framed[width=5cm,height=4.3cm]{}} \input knuth \vskip1cm \hrule \placefigure[right,height]{Height}{\framed[width=5cm,height=4.3cm]{}} \input knuth \page \hrule \placefigure[right,halfline]{Halfline}{\framed[width=5cm,height=4.3cm]{}} \input knuth \vskip1cm \hrule \placefigure[right,grid]{Grid}{\framed[width=5cm,height=4.5cm]{}} \input knuth \page \hrule \setupfloats[sidespaceafter=0pt] \placefigure[right,grid,high,none,nonumber]{Grid+high}{\framed[width=5cm,height=4.5cm]{}} The {\bf grid+high figure} \input tufte \input knuth \stoptext
Hi, Le 07/05/2014, Sanjoy Mahajan a écrit
Here are a few more keys. I don't fully understand their effect, but I found them in strc-flt.mkvi (p.s. shouldn't that be .mkiv ?).
Some of the keys are documented in the 'details' manual (http://www.pragma-ade.com/general/manuals/details.pdf) in section 6. I discovered the 'high' key there! All the best. -- Romain Diss
participants (4)
-
Mojca Miklavec
-
Romain Diss
-
Sanjoy Mahajan
-
Wolfgang Schuster