[NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread 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?

\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
___
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
___


Re: [NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread Wolfgang Schuster

Am 07.05.2014 um 14:23 schrieb Mojca Miklavec mojca.miklavec.li...@gmail.com:

 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
___
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
___


Re: [NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread Sanjoy Mahajan
 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
___
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
___


Re: [NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread Mojca Miklavec
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
___
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
___


Re: [NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread Sanjoy Mahajan
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
___
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
___


Re: [NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread Sanjoy Mahajan
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

___
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
___


Re: [NTG-context] Vertical alignment of \placefigure[right]

2014-05-07 Thread Romain Diss
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
___
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
___