ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* framed text question
@ 2009-04-21 10:46 Jos van Gisbergen
  2009-04-21 13:10 ` Aditya Mahajan
  0 siblings, 1 reply; 4+ messages in thread
From: Jos van Gisbergen @ 2009-04-21 10:46 UTC (permalink / raw)
  To: ntg-context


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

Hi,

I have a question regarding framed text.
To obtain framed verbatim text that breaks over pages, I use the macro
\definetextbackground. I have encountered a slight problem, however:
sometimes the upper part of the frame appears on the bottom of the
page with no text in it (because there's not enough room). The strange
thing is that if I comment out the setupcolors macro the problem
disappears (in the example that is).
I have included an example of this below. Run with texexec --pdf test.tex

The version of texexec I'm using is:

 TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005

               texexec : TeXExec 5.2.4 - ConTeXt / PRAGMA ADE 1997-2005
               texutil : TeXUtil 9.0.0 - ConTeXt / PRAGMA ADE 1992-2004
                   tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4)
               context : ver: 2005.01.31
               cont-en : ver: 2005.01.31  fmt: 2009.1.26  mes: english


Thanks in advance

Trychius


----------------------------------  test.tex  ----------------------------------
\installlanguage[en]
\setuppapersize[A4]

\definelayout[myCustomLayout][
 header=10mm,                    % height of header
 footer=10mm,                    % height of footer
 topspace=8mm,                   % space above header
 bottomspace=\topspace,          % space below footer
 backspace=25mm,
 cutspace=20mm,
 width=middle,
 height=middle,
 marking=on,                     % enable the marking of text
 grid=yes,
]

\setuplayout[myCustomLayout]

\setuptyping[margin=10mm,
             space=off,               % Do not show space characters explicitely
             color=black,             % Color of verbatim text
            ]

\setupcolors[state=start]

\definetextbackground[FramedText][
        location=paragraph,
        rulethickness=0.5pt,
        framecolor=red,
        background=color,backgroundcolor=yellow,
        leftoffset=1.0\bodyfontsize,rightoffset=1.0\bodyfontsize,
        topoffset=1.0\bodyfontsize,bottomoffset=1.0\bodyfontsize,
        frame=on]



\starttext
            in this story took place, some of the most
            important mines of the Scottish coal beds
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            Now, at the time when the events related
            in this story took place, some of the most
            important mines of the Scottish coal beds
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            Now, at the time when the events related
            in this story took place, some of the most
            important mines of the Scottish coal beds
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            Now, at the time when the events related
            in this story took place, some of the most
            important mines of the Scottish coal beds
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            had been exhausted by too rapid working. In
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten

\startFramedText
\starttyping
            in this story took place, some of the most
            important mines of the Scottish coal beds
            had been exhausted by too rapid working. In
            the region which extends between Edinburgh
            and Glasgow, for a distance of ten or twelve
            miles, lay the Aberfoyle colliery, of which
            the engineer, James Starr, had so long directed
            the works. For ten years these mines had been
            abandoned. No new seams had been discovered,
            although the soundings had been carried
            to a depth of fifteen hundred or even of
            two thousand feet, and when James Starr had
            retired, it was with the full conviction that
            even the smallest vein had been completely
            exhausted.
\stoptyping
\stopFramedText
\stoptext


      

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

[-- Attachment #2: Type: text/plain, Size: 487 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: framed text question
  2009-04-21 10:46 framed text question Jos van Gisbergen
@ 2009-04-21 13:10 ` Aditya Mahajan
  0 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2009-04-21 13:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 21 Apr 2009, Jos van Gisbergen wrote:

> Hi,
>
> I have a question regarding framed text.
> To obtain framed verbatim text that breaks over pages, I use the macro
> \definetextbackground. I have encountered a slight problem, however:
> sometimes the upper part of the frame appears on the bottom of the
> page with no text in it (because there's not enough room). The strange
> thing is that if I comment out the setupcolors macro the problem
> disappears (in the example that is).

I sometimes use

\definetextbackground[....][before={\testpage[3], .. other options .. ]

The \testpage[3] checks if there is enough space to put three lines, if 
not it issues a page break. In most cases this gets rid of the hanging 
empty text backgrounds at the bottom of a page.

Aditya
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Framed text question
  2005-01-19 17:19 Framed " Brian Kahne
@ 2005-01-19 17:35 ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2005-01-19 17:35 UTC (permalink / raw)


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

Brian Kahne wrote:
> 
> Hi,
> 
> I'm new to Context, so hopefully this isn't a completely obvious 
> question, but I was wondering whether it was possible to have framed 
> text split across a page. In this particular case, I have a code sample 
> that I want to be framed and have a different background color than the 
> rest of the text, so I have it surrounded by \startframedtext and 
> \stopframedtext.  Is it possible to use \splitfloat to split this if the 
> code sample is too large to fit on a single page?  If so, what would be 
> the syntax?  If not, is there another mechanism?

the following background mechanism splits across pages, works over columns, can 
be used nested, can be applied for very dirty tricks, etc

\setupcolors[state=start]

\starttext

\definetextbackground[more][state=start,backgroundcolor=red] % location=paragraph
\definetextbackground[test][state=start,backgroundcolor=green]

\page \placefigure[left]{}{}

\starttextbackground[test]
   \readfile{ward}{}{}
   \starttextbackground[more]
     \readfile{ward}{}{}
   \stoptextbackground
   \readfile{ward}{}{}
\stoptextbackground

\page \placefigure[right]{}{}

\starttextbackground[test]
   \readfile{ward}{}{}
   \starttextbackground[more]
     \readfile{ward}{}{}
   \stoptextbackground
   \readfile{ward}{}{}
\stoptextbackground

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

[-- Attachment #2: test.pdf --]
[-- Type: application/pdf, Size: 16211 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Framed text question
@ 2005-01-19 17:19 Brian Kahne
  2005-01-19 17:35 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Kahne @ 2005-01-19 17:19 UTC (permalink / raw)



Hi,

I'm new to Context, so hopefully this isn't a completely obvious question, but I 
was wondering whether it was possible to have framed text split across a page. 
In this particular case, I have a code sample that I want to be framed and have 
a different background color than the rest of the text, so I have it surrounded 
by \startframedtext and \stopframedtext.  Is it possible to use \splitfloat to 
split this if the code sample is too large to fit on a single page?  If so, what 
would be the syntax?  If not, is there another mechanism?

Thanks for any help!

Brian Kahne

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

end of thread, other threads:[~2009-04-21 13:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-21 10:46 framed text question Jos van Gisbergen
2009-04-21 13:10 ` Aditya Mahajan
  -- strict thread matches above, loose matches on Subject: below --
2005-01-19 17:19 Framed " Brian Kahne
2005-01-19 17:35 ` Hans Hagen

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