Re: [NTG-context] Moving horizontally a whole ensemble of layers in the same run?
On Tue, Dec 17, 2019 at 07:30:49PM +0100, Hans Hagen wrote:
you need to make a MWE to show what you mean
normally
\hbox to <somewidth>{\hss<come content>\hss}
is good enough for centering
Here is my MWE. Think of a photo album. To make it interesting the pages should all be different. To this purpose layers are a good means. I'd like to centre the layers on their page without doing so manually and without changig the distances between them. Using luacode one can calculate the distance d between the leftmost and the rightmost edge. Half the difference (\textwidth - d) is the amount to move the whole layer ensemble. My question is now: Does in context exist a possibility to move all layers jointly without correcting all their x-values subsequently? I append the pdf-file of my MWE. Rudolf ---------------------------------------------------------- MWE --------------------- \setuppapersize[A4,landscape] \setupexternalfigures[location={default}] \starttext \definelayer[LAY]% \setlayer[LAY][x=0pt,y=-8pt]% {% \vbox {% \hsize=.35\textwidth \externalfigure[cow][width=\hsize]% \vskip\lineheight \input tufte } } \setlayer[LAY][x=210pt,y=0pt]% {% \definedfont[Serif at 82pt] \rotate[rotation=90,frame=on,offset=2pt]{\hbox{JOURNEY}} } \setlayer[LAY][x=360pt,y=50pt]% {% \vbox {% \hsize=200pt \input ward \vskip\lineheight \externalfigure[hacker][height=.4\textheight]% } } \flushlayer[LAY] \page \definelayer[LAY]% \setlayer[LAY][x=0pt,y=0pt]% {\externalfigure[mill][height=.4\textheight]} \setlayer[LAY][x=150pt,y=0pt]% {\externalfigure[hacker][height=.4\textheight]} \setlayer[LAY][x=0pt,y=200pt]% {\externalfigure[cow][width=.5\textwidth]} \setlayer[LAY][x=\dimexpr.65\textwidth+40pt\relax,y=0pt]% {% \vbox {% \hsize=.2\textwidth \startalignment[flushleft] \input ward \vskip\lineheight \input ward \stopalignment } } \flushlayer[LAY] \stoptext ------------------------------------------------------------------------------------
Rudolf Bahr schrieb am 18.12.2019 um 15:13:
On Tue, Dec 17, 2019 at 07:30:49PM +0100, Hans Hagen wrote:
you need to make a MWE to show what you mean
normally
\hbox to <somewidth>{\hss<come content>\hss}
is good enough for centering Here is my MWE. Think of a photo album. To make it interesting the pages should all be different. To this purpose layers are a good means. I'd like to centre the layers on their page without doing so manually and without changig the distances between them. Using luacode one can calculate the distance d between the leftmost and the rightmost edge. Half the difference (\textwidth - d) is the amount to move the whole layer ensemble.
My question is now: Does in context exist a possibility to move all layers jointly without correcting all their x-values subsequently?
1. You can use hoffset and voffset to shift all layers. 2. You can use \setlayerframed to put paragraphs in a layer. \setuppapersize[A4,landscape] \setupexternalfigures[location=default] \definelayer[LAY] \starttext \startbuffer \setlayerframed [LAY] [x=0pt, y=-8pt] [frame=off, width=.35\textwidth, align={normal,tolerant}] {\externalfigure[cow][width=\hsize] \blank[line] \input tufte\par} \setlayerframed [LAY] [x=225pt, y=0pt] [orientation=90, foregroundstyle={\definedfont[Serif at 82pt]}] {JOURNEY} \setlayerframed [LAY] [x=360pt, y=50pt] [frame=off, width=200pt, align={normal,tolerant}] {\input ward \blank[line] \externalfigure[hacker][height=.4\textheight]} \flushlayer[LAY] \stopbuffer \getbuffer \page \setuplayer[LAY][hoffset=4cm,voffset=-2cm] \getbuffer \stoptext Wolfgang
On Wed, Dec 18, 2019 at 06:13:51PM +0100, Wolfgang Schuster wrote:
Rudolf Bahr schrieb am 18.12.2019 um 15:13:
On Tue, Dec 17, 2019 at 07:30:49PM +0100, Hans Hagen wrote:
you need to make a MWE to show what you mean
normally
\hbox to <somewidth>{\hss<come content>\hss}
is good enough for centering Here is my MWE. Think of a photo album. To make it interesting the pages should all be different. To this purpose layers are a good means. I'd like to centre the layers on their page without doing so manually and without changig the distances between them. Using luacode one can calculate the distance d between the leftmost and the rightmost edge. Half the difference (\textwidth - d) is the amount to move the whole layer ensemble.
My question is now: Does in context exist a possibility to move all layers jointly without correcting all their x-values subsequently?
1. You can use hoffset and voffset to shift all layers.
2. You can use \setlayerframed to put paragraphs in a layer.
\setuppapersize[A4,landscape]
\setupexternalfigures[location=default]
\definelayer[LAY]
\starttext
\startbuffer
\setlayerframed [LAY] [x=0pt, y=-8pt] [frame=off, width=.35\textwidth, align={normal,tolerant}] {\externalfigure[cow][width=\hsize] \blank[line] \input tufte\par}
\setlayerframed [LAY] [x=225pt, y=0pt] [orientation=90, foregroundstyle={\definedfont[Serif at 82pt]}] {JOURNEY}
\setlayerframed [LAY] [x=360pt, y=50pt] [frame=off, width=200pt, align={normal,tolerant}] {\input ward \blank[line] \externalfigure[hacker][height=.4\textheight]}
\flushlayer[LAY]
\stopbuffer
\getbuffer
\page
\setuplayer[LAY][hoffset=4cm,voffset=-2cm]
\getbuffer
\stoptext
Wolfgang
Thank you very much, Wolfgang! That is exactly what I need and what I was looking for! Very nice coding indeed! Rudolf
participants (2)
-
Rudolf Bahr
-
Wolfgang Schuster