ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Captions with background
@ 2019-08-03 15:22 Henning Hraban Ramm
  2019-08-04  8:33 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Henning Hraban Ramm @ 2019-08-03 15:22 UTC (permalink / raw)
  To: ntg-context

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

Hi,

in my books I typeset captions onto full page images, therefore I need a background; in the attached example it’s just a white box, usually I use a MetaPost shadow (some of you helped me with that a few years ago, current code see https://wiki.contextgarden.net/Drop_shadows).

Now, the background should just enclose the text, not more. Since I don’t know how long the caption will be (I use the whole setup in a macro), I need a \vbox within \setlayer, but that always uses the full \textwidth, regardless of width settings of \framed.

If the caption is short, the box should be minimal. Is this possible?


Even better would be a textbackground just behind the text lines.

Unfortunately my MP foo is not up to the task, the rectangular shadow was hard enough, but I’d try.
There’s an example in details.pdf, but I don’t understand how I could manipulate the path around the text (not: paragraph).


The example shows another problem: If you run it with --mode=arrange, the bleed is cut off.
Is this a matter of settings or a bug?


Greetlings, Hraban

[-- Attachment #2: captiontest.tex --]
[-- Type: application/octet-stream, Size: 1672 bytes --]

\usemodule[visual]

\newdimen\Bleed
\newdimen\maxWidth
\newdimen\maxHeight
\newdimen\doubleWidth
\newdimen\topOffset
\newdimen\bottomOffset

\Bleed=3mm

\setuppapersize[A6][A6,oversized]
\setuplayout[%
	location=middle,
	marking=on,
	grid=yes,
	%backspace=12.5mm, width=80mm,
	%topspace=12.5mm, %height=125mm, % Text+Footer
	%header=0mm,footer=10mm,
  cropoffset=0mm,
  bleedoffset=\Bleed,
  trimoffset=-5mm,
]

\setupbleeding[offset=\Bleed]
\maxWidth=\dimexpr\paperwidth + \Bleed\relax
\maxHeight=\dimexpr\paperheight + 2\Bleed\relax
%\doubleWidth=\dimexpr2\maxWidth\relax
%\topOffset=\dimexpr\topspace + \headerheight + \Bleed\relax
%\bottomOffset=\dimexpr\bottomheight + \footerheight + \Bleed\relax

\definelayer[picbg][x=0mm,y=-\Bleed,width=\maxWidth,height=\maxHeight] %
\setupbackgrounds[page][background=picbg,state=start]

\definemakeup[fullpage][
  page=no,
  doublesided=no,
  headerstate=empty,
  footerstate=empty,
  pagestate=start,
]

\startmode[arrange]
\setuppapersize[A6][A4,landscape]
\setuparranging[2UP]
\stopmode


\starttext
\fakewords{50}{100}

% full page image, left page
\startfullpagemakeup
	\setlayer[picbg][
    x=-\Bleed,
    y=-\Bleed]{%
    \fakeimage{\maxWidth}{\maxHeight}{\maxWidth}{\maxHeight}
		%\externalfigure[dum][height=\maxHeight,width=\maxWidth]%
    %\fakeimage{5cm}{3cm}{10cm}{5cm}
	}
	% set caption into footer on top if picture
	\setlayer[picbg][
    x=\backspace,
    y=\dimexpr\makeupheight + \footerheight\relax,
  ]{%
    \inframed[
      frame=off,width=fit,autowidth=force,
      background=color,backgroundcolor=white]{%
      \vbox{\fakewords{2}{20}}
    }%
  }%
\stopfullpagemakeup

\fakewords{200}{250}

\stoptext

[-- Attachment #3: 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] 3+ messages in thread

end of thread, other threads:[~2019-08-04 10:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-03 15:22 Captions with background Henning Hraban Ramm
2019-08-04  8:33 ` Hans Hagen
2019-08-04 10:59   ` Henning Hraban Ramm

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).