ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Fullwidth topfigure with caption in the margin
@ 2020-09-07 19:26 Mikael Sundqvist
  2020-09-08 11:42 ` Mikael Sundqvist
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Sundqvist @ 2020-09-07 19:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1099 bytes --]

Hi,

Is there a way to have a fullwith topfigure with caption in the margin so
that the figure does not interfere with the text? My try is


%%%%%%%
\setuplayout[
rightmargin=2in,
rightmargindistance=0.375in,
width=4.125in,
]

\showframe

\definecolor [transparentred] [r=1,t=.5,a=1]

\definefloat[topfigure][topfigures][figure]

\setupfloat[topfigure][
default={margin},
location=flushleft,
maxwidth=6.5in,
]

\setupcaption[topfigure][
number=no,
location=bottom,
style={\switchtobodyfont[8bp]},
]
\starttext
\dorecurse{4}{\samplefile{knuth}}

\startplacetopfigure[title={\samplefile{ward}}]
\blackrule[width=6.5in,height=2in,color=transparentred]
\stopplacetopfigure

\samplefile{knuth}
\stoptext
%%%%%%

but, as one can see on page two, the text from the previous page just
continues under the image. I want the "larg-scale user..." to start below
the image. It would be good if it was also possible to configure the
distance between the image and the text.

(I guess one option would be to not use a margin figure, and use
default=top, but then I don't know how to handle the caption.)

/Mikael

[-- Attachment #1.2: Type: text/html, Size: 1366 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fullwidth topfigure with caption in the margin
  2020-09-07 19:26 Fullwidth topfigure with caption in the margin Mikael Sundqvist
@ 2020-09-08 11:42 ` Mikael Sundqvist
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Sundqvist @ 2020-09-08 11:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2765 bytes --]

On Mon, Sep 7, 2020 at 9:26 PM Mikael Sundqvist <mickep@gmail.com> wrote:

> Hi,
>
> Is there a way to have a fullwith topfigure with caption in the margin so
> that the figure does not interfere with the text? My try is
>
>
> %%%%%%%
> \setuplayout[
> rightmargin=2in,
> rightmargindistance=0.375in,
> width=4.125in,
> ]
>
> \showframe
>
> \definecolor [transparentred] [r=1,t=.5,a=1]
>
> \definefloat[topfigure][topfigures][figure]
>
> \setupfloat[topfigure][
> default={margin},
> location=flushleft,
> maxwidth=6.5in,
> ]
>
> \setupcaption[topfigure][
> number=no,
> location=bottom,
> style={\switchtobodyfont[8bp]},
> ]
> \starttext
> \dorecurse{4}{\samplefile{knuth}}
>
> \startplacetopfigure[title={\samplefile{ward}}]
> \blackrule[width=6.5in,height=2in,color=transparentred]
> \stopplacetopfigure
>
> \samplefile{knuth}
> \stoptext
> %%%%%%
>
> but, as one can see on page two, the text from the previous page just
> continues under the image. I want the "larg-scale user..." to start below
> the image. It would be good if it was also possible to configure the
> distance between the image and the text.
>
> (I guess one option would be to not use a margin figure, and use
> default=top, but then I don't know how to handle the caption.)
>
> /Mikael
>

An update: I am now able to get something closer to what I want. The figure
is where I want it, the caption is where I want it. The code might be bad
and there might be better ways to do it. For example, I could not find how
to use the title text but only the subtitle in the figure. The spacing is
also a bit manual in the \TopFigureCaption command. Any comments for
improvements (or completely different solutions) are very welcome.

/Mikael

\setuplayout[
rightmargin=2in,
rightmargindistance=0.375in,
width=4.125in,
]

\showframe

\definecolor [transparentred] [r=1,t=.5,a=1]

\definefloat[topfigure][topfigures][figure]

\setupfloat[topfigure][
default={top,none},
location=flushright,
maxwidth=6.5in,
]

\setupcaption[topfigure][
number=no,
]

\define\TopFigureCaption{%
\blank[-line,force,overlay]
\vsmash{%
\blank[line]
\framed[align=flushright,width=6.5in,frame=off,offset=overlay]{%
\startframedtext[
width=\rightmarginwidth,
frame=off,
offset=overlay,
style={\switchtobodyfont[8bp]},
align=flushleft,
]\floatuserdataparameter{subtitle}
\stopframedtext}}}


\starttext
\dorecurse{3}{\samplefile{knuth}}

\startplacetopfigure[title=This is the title][subtitle={\samplefile{ward}}]
\blackrule[width=6.5in,height=2in,color=transparentred]
\TopFigureCaption
\stopplacetopfigure

\dorecurse{3}{\samplefile{knuth}}

\startplacetopfigure[title=This is the title][subtitle={\samplefile{ward}}]
\blackrule[width=6.5in,height=2in,color=transparentred]
\TopFigureCaption
\stopplacetopfigure

\stoptext

[-- Attachment #1.2: Type: text/html, Size: 9534 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-08 11:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 19:26 Fullwidth topfigure with caption in the margin Mikael Sundqvist
2020-09-08 11:42 ` Mikael Sundqvist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).