Why does the following produce a single line when the layer content produces four lines in normal flow? How are paragraphs and new lines produced in layers? I've tried \par, \endgraf, \crlf and \\ without success. \definelayer[TicketSummary] [x=\backspace, y=\topspace width=4in, height=4in, repeat=no] \setlayer[TicketSummary] [hoffset=.5\backspace, voffset=2.5in]{ \bold{Client Name:} Acme Corporation \bold{Location of Work:} Main warehouse } -- david
Just tried the following snippet on the live.contextgarden.net with no joy: The layer content appears on a single line, whether I use \par, \\, \endgraf, \crlf or no line ending at all. \definelayer[TicketSummary] [x=\backspace, y=\topspace width=4in, height=4in, repeat=no] \setlayerframed[TicketSummary] [hoffset=.5\backspace, voffset=2.5in]{ \bold{Client Name:} \\ Acme Corporation \\ \bold{Location of Work:} Main warehouse } \setupbackgrounds[page][background={TicketSummary}] \starttext Hello world! \stoptext -- david
Am 09.04.2009 um 22:14 schrieb Design Department:
Just tried the following snippet on the live.contextgarden.net with no joy: The layer content appears on a single line, whether I use \par, \\, \endgraf, \crlf or no line ending at all.
To help you I will explain why your setup did not work. TeX use boxes to place text, two different types are available and they are horizontal (\hbox) and vertical (\vbox) boxes. Text in a horizontal box is placed in a single line and \par \vskip ... is ignored, if your text is too long it runs over the right margin, only text in a vertical box is placed in multiple lines. The pure \setlayer command use a horizontal box for the content and did therefore not work for you, \setlayerframed is (simplified) a combination of \setlayer and \frame, the definition looks like \setlayer[name][setup]{\framed{text}}. The \framed command itself can act as horizontal or vertical box dependent on the setup, by default it acts like a horizontal box, to let it act as vertical box two setup need to be done (1) the alignment (format) of the text needs to be set with 'align=left|normal|...' and (2) it needs either a width or a height with is done with 'width=...' or 'height=...' or 'lines=...'. Your layer command should now look like: \setlayerframed [TicketSummary] [hoffset=.5\backspace, voffset=2.5in, width=3cm, align=right] {\bold{Client Name:}\\ Acme Corporation\\ \bold{Location of Work:} Main warehouse} Wolfgang
Thks. I was incorrectly assuming that the dimension properties, especially width, should be set in \definelayer. I'm not clear on the purpose of a separate \definelayer command, unless it's to allow the abstraction of layer offsets from topspace and backspace value, the way I have in this example. It works now, though, and I'll accept that as an answer given my unwillingness to review that code for \definelayer ;-) -- david
Am 09.04.2009 um 22:54 schrieb Design Department:
Thks. I was incorrectly assuming that the dimension properties, especially width, should be set in \definelayer. I'm not clear on the purpose of a separate \definelayer command, unless it's to allow the abstraction of layer offsets from topspace and backspace value, the way I have in this example.
It works now, though, and I'll accept that as an answer given my unwillingness to review that code for \definelayer ;-)
\definelayer creates new element to place elements in the background and \setlayer fills it with content. the width and height for \definelayer have a different purpose than the one for \setlayerframed, it's best to write just \definelayer[mylayer] or \definelayer[mylayer][width=\paperwidth,height=\paperheight] Wolfgang
I have modify this sample \newdimen\currentlayerheight \newdimen\currentlayerwidth \newbox\Content \definelayer[TicketSummary] [x=\backspace, y=\topspace, width=4in, height=4in, repeat=no] \setlayer[TicketSummary][hoffset=.5\backspace, voffset=2.5in]{% \unprotect% \currentlayerheight=\dimexpr\csname @@llTicketSummaryheight\endcsname\relax% \currentlayerwidth=\dimexpr\csname @@llTicketSummarywidth\endcsname\relax% \protect% \setbox\Content=\vbox{\hsize=\currentlayerwidth% \bold{Client Name:} \\ Acme Corporation \\ \bold{Location of Work:} Main warehouse }% \ht\Content=\currentlayerheight% \ruledhbox{\box\Content} } \setupbackgrounds[page][background={TicketSummary}] \starttext Hello world! \stoptext minimals: no erros, bu evince says Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown minimals-beta: errors ! You can't use `\dimexpr' in restricted horizontal mode. l.12 \currentlayerheight=\dimexpr \csname @@llTicketSummaryheight\endcsname\r... ? -- luigi
Am 09.04.2009 um 23:44 schrieb luigi scarso:
\unprotect% \currentlayerheight=\dimexpr\csname @@llTicketSummaryheight\endcsname \relax% \currentlayerwidth=\dimexpr\csname @@llTicketSummarywidth\endcsname \relax% \protect%
why unprotect/protect and why so many '%'? \edef\currentlayerheight{\csname @@llTicketSummaryheight\endcsname}% \edef\currentlayerwidth {\csname @@llTicketSummarywidth\endcsname}%
\setbox\Content=\vbox{\hsize=\currentlayerwidth% \bold{Client Name:} \\ Acme Corporation \\ \bold{Location of Work:} Main warehouse }% \ht\Content=\currentlayerheight%
why not \vbox to \currentlayerheight
! You can't use `\dimexpr' in restricted horizontal mode. l.12 \currentlayerheight=\dimexpr \csname @@llTicketSummaryheight \endcsname\r... ?
\newdimen checks for the existence of a control sequence Wolfgang
On Fri, Apr 10, 2009 at 12:04 AM, Wolfgang Schuster
Am 09.04.2009 um 23:44 schrieb luigi scarso:
\unprotect% \currentlayerheight=\dimexpr\csname @@llTicketSummaryheight\endcsname\relax% \currentlayerwidth=\dimexpr\csname @@llTicketSummarywidth\endcsname\relax% \protect%
why unprotect/protect
and why so many '%'?
unecessary -- quick cut and paste from other code -- but not wrong, prevent spurios spaces
\edef\currentlayerheight{\csname @@llTicketSummaryheight\endcsname}% \edef\currentlayerwidth {\csname @@llTicketSummarywidth\endcsname}%
\setbox\Content=\vbox{\hsize=\currentlayerwidth% \bold{Client Name:} \\ Acme Corporation \\ \bold{Location of Work:} Main warehouse }% \ht\Content=\currentlayerheight%
why not \vbox to \currentlayerheight
yes I mean \ht\Content=\currentlayerheight% \dp\Content=0pt%
! You can't use `\dimexpr' in restricted horizontal mode. l.12 \currentlayerheight=\dimexpr \csname @@llTicketSummaryheight\endcsname\r... ?
\newdimen checks for the existence of a control sequence
the point is that on minimals-beta there is an error, on minimals no , but xpdf says Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown The code is not wrong -- maybe a bit strange Also this is ok in minimals fails in minimals-beta, and I think It's legal code, but I can fail . \newdimen\currentlayerheight \starttext \currentlayerheight=\dimexpr 12pt +0pt\relax% \the\currentlayerheight \stoptex\newdimen\currentlayerheight -- luigi
Am 10.04.2009 um 00:53 schrieb luigi scarso:
and why so many '%'? prevent spurios spaces
after \relax?
\newdimen checks for the existence of a control sequence
the point is that on minimals-beta there is an error, on minimals no , but xpdf says
Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown
The code is not wrong -- maybe a bit strange
works fine here with preview app or adobe reader
Also this is ok in minimals fails in minimals-beta, and I think It's legal code, but I can fail .
\newdimen\currentlayerheight \starttext \currentlayerheight=\dimexpr 12pt +0pt\relax% \the\currentlayerheight \stoptex\newdimen\currentlayerheight
current: \newdimen\currentlayerheight -> create new dimen register beta: \newdimen\currentlayerheight -> check if \currentlayerheight is already defined, it true write a message to the terminal and do nothing else create a new dimen register what did not happen here because \currentlayerheight is defined in page-lyr.tex Wolfgang
and why so many '%'?
prevent spurios spaces
after \relax? as mental habit
\newdimen checks for the existence of a control sequence
the point is that on minimals-beta there is an error, on minimals no , but xpdf says
Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown Error: ExtGState 'Tr0' is unknown
The code is not wrong -- maybe a bit strange
works fine here with preview app or adobe reader
yes, and even gs but xpdf share the same xpdf code of luatex
beta: \newdimen\currentlayerheight -> check if \currentlayerheight is already defined, it true write a message to the terminal and do nothing else create a new dimen register what did not happen here because \currentlayerheight is defined in page-lyr.tex ah ok now I have seen the log. camelcase next time -- luigi
I do not know what you precisely want to achieve. You need to give dimensions to the framed part of the \setlayerframed. Position the layer with the layer definition. Preset the layer to lefttop and move it with the x and y keys. \definelayer[TicketSummary] [x=\backspace, y=2\topspace, preset=lefttop, repeat=no] \setlayerframed[TicketSummary] [width=\textwidth,height=.5in,align=flushleft]{ \bold{Client Name:} Acme Corporation \\ \bold{Location of Work:} Main warehouse } Willi On Apr 9, 2009, at 10:14 PM, Design Department wrote:
\definelayer[TicketSummary] [x=\backspace, y=\topspace width=4in, height=4in, repeat=no] \setlayerframed[TicketSummary] [hoffset=.5\backspace, voffset=2.5in]{ \bold{Client Name:} \\ Acme Corporation \\ \bold{Location of Work:} Main warehouse }
\setupbackgrounds[page][background={TicketSummary}]
\starttext Hello world! \stoptext
participants (4)
-
Design Department
-
luigi scarso
-
Willi Egger
-
Wolfgang Schuster