ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Paragraphs in Layers
@ 2009-04-09 19:40 Design Department
  2009-04-09 19:45 ` Wolfgang Schuster
  0 siblings, 1 reply; 12+ messages in thread
From: Design Department @ 2009-04-09 19:40 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 19:40 Paragraphs in Layers Design Department
@ 2009-04-09 19:45 ` Wolfgang Schuster
  2009-04-09 20:14   ` Design Department
  0 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2009-04-09 19:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 09.04.2009 um 21:40 schrieb Design Department:

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

Use \setlayerframed.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 19:45 ` Wolfgang Schuster
@ 2009-04-09 20:14   ` Design Department
  2009-04-09 20:27     ` Wolfgang Schuster
  2009-04-09 20:33     ` Willi Egger
  0 siblings, 2 replies; 12+ messages in thread
From: Design Department @ 2009-04-09 20:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 20:14   ` Design Department
@ 2009-04-09 20:27     ` Wolfgang Schuster
  2009-04-09 20:54       ` Design Department
  2009-04-09 20:33     ` Willi Egger
  1 sibling, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2009-04-09 20:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 20:14   ` Design Department
  2009-04-09 20:27     ` Wolfgang Schuster
@ 2009-04-09 20:33     ` Willi Egger
  1 sibling, 0 replies; 12+ messages in thread
From: Willi Egger @ 2009-04-09 20:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 20:27     ` Wolfgang Schuster
@ 2009-04-09 20:54       ` Design Department
  2009-04-09 21:24         ` Wolfgang Schuster
  0 siblings, 1 reply; 12+ messages in thread
From: Design Department @ 2009-04-09 20:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 20:54       ` Design Department
@ 2009-04-09 21:24         ` Wolfgang Schuster
  2009-04-09 21:44           ` luigi scarso
  0 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2009-04-09 21:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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


___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 21:24         ` Wolfgang Schuster
@ 2009-04-09 21:44           ` luigi scarso
  2009-04-09 22:04             ` Wolfgang Schuster
  0 siblings, 1 reply; 12+ messages in thread
From: luigi scarso @ 2009-04-09 21:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 21:44           ` luigi scarso
@ 2009-04-09 22:04             ` Wolfgang Schuster
  2009-04-09 22:53               ` luigi scarso
  0 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2009-04-09 22:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 22:04             ` Wolfgang Schuster
@ 2009-04-09 22:53               ` luigi scarso
  2009-04-09 23:06                 ` Wolfgang Schuster
  0 siblings, 1 reply; 12+ messages in thread
From: luigi scarso @ 2009-04-09 22:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Apr 10, 2009 at 12:04 AM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> 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
unecessary -- quick cut and paste from other code --
but not wrong,

> and why so many '%'?
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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Paragraphs in Layers
  2009-04-09 22:53               ` luigi scarso
@ 2009-04-09 23:06                 ` Wolfgang Schuster
  2009-04-09 23:36                   ` luigi scarso
  0 siblings, 1 reply; 12+ messages in thread
From: Wolfgang Schuster @ 2009-04-09 23:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Paragraphs in Layers
  2009-04-09 23:06                 ` Wolfgang Schuster
@ 2009-04-09 23:36                   ` luigi scarso
  0 siblings, 0 replies; 12+ messages in thread
From: luigi scarso @ 2009-04-09 23:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

>>> 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
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-04-09 23:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-09 19:40 Paragraphs in Layers Design Department
2009-04-09 19:45 ` Wolfgang Schuster
2009-04-09 20:14   ` Design Department
2009-04-09 20:27     ` Wolfgang Schuster
2009-04-09 20:54       ` Design Department
2009-04-09 21:24         ` Wolfgang Schuster
2009-04-09 21:44           ` luigi scarso
2009-04-09 22:04             ` Wolfgang Schuster
2009-04-09 22:53               ` luigi scarso
2009-04-09 23:06                 ` Wolfgang Schuster
2009-04-09 23:36                   ` luigi scarso
2009-04-09 20:33     ` Willi Egger

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