ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* how to reuse float numbers?
@ 2007-09-07  7:15 William S.
  2007-09-07 11:54 ` Wolfgang Schuster
  2007-09-07 16:17 ` William S.
  0 siblings, 2 replies; 7+ messages in thread
From: William S. @ 2007-09-07  7:15 UTC (permalink / raw)
  To: ntg-context

Hello,

I am wondering if the float numbers can be reused for floats that are longer
than a page. I use floats that contain program segments (source code) for
a project report for my university studies.

The guidelines specify that captions for code which is longer than one page
or crosses page boundaries should be reprinted and the title changed to
(continued).

example:

Program Segment 1.1: Hello World
  #include <stdio.h>
  main() {

...on next page...

Program Segment 1.1: (continued)
    printf("hello world!\n");
  }

Can someone help me do this in ConTeXt? I think I can do the splitting of
the code myself if needed, but I don't know how to reuse the float number.
Currently this is how I define the float:

\definetyping[Program][blank=halfline]
\definefloat[ProgramSegment][ProgramSegments]
\setupcaption[ProgramSegment][location=top,align=right,headstyle=bold,style=bold,inbetween={}]
\setuplabeltext[en][ProgramSegment=Program Segment ]

And I use it like this:
\placeProgramSegment[here]{Hello World}
{
\startProgram
main() {
  printf("hello world!\n");
}
\stopProgram
}

Any help will be appreciated.

Thanks,
William.
___________________________________________________________________________________
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] 7+ messages in thread

* Re: how to reuse float numbers?
  2007-09-07  7:15 how to reuse float numbers? William S.
@ 2007-09-07 11:54 ` Wolfgang Schuster
  2007-09-07 12:44   ` William S.
  2007-09-07 16:17 ` William S.
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2007-09-07 11:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/9/7, William S. <loumzie@gmail.com>:
> Hello,
>
> I am wondering if the float numbers can be reused for floats that are longer
> than a page. I use floats that contain program segments (source code) for
> a project report for my university studies.
>
> The guidelines specify that captions for code which is longer than one page
> or crosses page boundaries should be reprinted and the title changed to
> (continued).
>
> example:
>
> Program Segment 1.1: Hello World
>   #include <stdio.h>
>   main() {
>
> ...on next page...
>
> Program Segment 1.1: (continued)
>     printf("hello world!\n");
>   }
>
> Can someone help me do this in ConTeXt? I think I can do the splitting of
> the code myself if needed, but I don't know how to reuse the float number.
> Currently this is how I define the float:
>
> \definetyping[Program][blank=halfline]
> \definefloat[ProgramSegment][ProgramSegments]
> \setupcaption[ProgramSegment][location=top,align=right,headstyle=bold,style=bold,inbetween={}]
> \setuplabeltext[en][ProgramSegment=Program Segment ]
>
> And I use it like this:
> \placeProgramSegment[here]{Hello World}
> {
> \startProgram
> main() {
>   printf("hello world!\n");
> }
> \stopProgram
> }
>
> Any help will be appreciated.
>
> Thanks,
> William.

you can start with the following example from Hans.

\definefloat[Exhibit][table]
\starttext
\input tufte\par
\splitfloat[lines=auto]{\placeExhibit{Knuth}}
{\dorecurse{4}{\input knuth \par}}
\input tufte\page[yes]
\stoptext

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

* Re: how to reuse float numbers?
  2007-09-07 11:54 ` Wolfgang Schuster
@ 2007-09-07 12:44   ` William S.
  2007-09-07 13:29     ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: William S. @ 2007-09-07 12:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 9/7/07, Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:
>
> you can start with the following example from Hans.
>
> \definefloat[Exhibit][table]
> \starttext
> \input tufte\par
> \splitfloat[lines=auto]{\placeExhibit{Knuth}}
> {\dorecurse{4}{\input knuth \par}}
> \input tufte\page[yes]
> \stoptext
>
> Wolfgang
>

It says "there is nothing to split" at home and using ConTeXt live.
Thanks for the pointer to splitfloat. I'll investigate it using
ConTeXt's source code.

William.
___________________________________________________________________________________
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] 7+ messages in thread

* Re: how to reuse float numbers?
  2007-09-07 12:44   ` William S.
@ 2007-09-07 13:29     ` Wolfgang Schuster
  2007-09-07 14:15       ` William S.
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2007-09-07 13:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

2007/9/7, William S. <loumzie@gmail.com>:
> On 9/7/07, Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:
> >
> > you can start with the following example from Hans.
> >
> > \definefloat[Exhibit][table]
> > \starttext
> > \input tufte\par
> > \splitfloat[lines=auto]{\placeExhibit{Knuth}}
> > {\dorecurse{4}{\input knuth \par}}
> > \input tufte\page[yes]
> > \stoptext
> >
> > Wolfgang
> >
>
> It says "there is nothing to split" at home and using ConTeXt live.
> Thanks for the pointer to splitfloat. I'll investigate it using
> ConTeXt's source code.
>
> William.

can you try my attached example.

Wolfgang

[-- Attachment #2: listing.tex --]
[-- Type: application/x-tex, Size: 5960 bytes --]

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

* Re: how to reuse float numbers?
  2007-09-07 13:29     ` Wolfgang Schuster
@ 2007-09-07 14:15       ` William S.
  0 siblings, 0 replies; 7+ messages in thread
From: William S. @ 2007-09-07 14:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 9/7/07, Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:
>
> can you try my attached example.
>
> Wolfgang
>
>

Thank you! That's amazing...

It seems I need to learn more about writing these macros before I can
do anything like that. I almost decided to just use tables with no
frame to hold my source-code...

Thanks again!
William.
___________________________________________________________________________________
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] 7+ messages in thread

* Re: how to reuse float numbers?
  2007-09-07  7:15 how to reuse float numbers? William S.
  2007-09-07 11:54 ` Wolfgang Schuster
@ 2007-09-07 16:17 ` William S.
  2007-09-10  5:43   ` Wolfgang Schuster
  1 sibling, 1 reply; 7+ messages in thread
From: William S. @ 2007-09-07 16:17 UTC (permalink / raw)
  To: ntg-context

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

On 9/7/07, William S. <loumzie@gmail.com> wrote:
> The guidelines specify that captions for code which is longer than one page
> or crosses page boundaries should be reprinted and the title changed to
> (continued).
>
> example:
>
> Program Segment 1.1: Hello World
>   #include <stdio.h>
>   main() {
>
> ...on next page...
>
> Program Segment 1.1: (continued)
>     printf("hello world!\n");
>   }
>

Thanks to Wolfgang's help the splitting problem is solved. However,
after the float is split, the captions get extra numbers (1.1.A,
1.1.B, etc).

I tried to "solve" this by using \setupfloatsplitting[conversions=...]
but even if I defined a conversion that prints nothing, the caption
would look like "Program Segment 1.1." (the final separator is still
printed).

I suppose a better way would be to override the command that makes the
captions (\setupcaption[ProgramSegment][command=...]) so that it
prints the real caption text in the first part, and "(continued)" in
the next parts.
However, I've searched the mailing list archive and I can't find an
example on what to put inside the command.

Can someone give me a clue as to what I should put inside the command
or maybe someone will have a better idea (maybe using
\setupfloatsplitting[inbetween=...])?

I've attached a slightly modified version of Wolfgang's document (I
added a conversion for the setupfloatsplitting).

Thanks,
William.

[-- Attachment #2: lst2.tex --]
[-- Type: application/x-tex, Size: 6130 bytes --]

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

* Re: how to reuse float numbers?
  2007-09-07 16:17 ` William S.
@ 2007-09-10  5:43   ` Wolfgang Schuster
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Schuster @ 2007-09-10  5:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/9/7, William S. <loumzie@gmail.com>:
> On 9/7/07, William S. <loumzie@gmail.com> wrote:
> > The guidelines specify that captions for code which is longer than one page
> > or crosses page boundaries should be reprinted and the title changed to
> > (continued).
> >
> > example:
> >
> > Program Segment 1.1: Hello World
> >   #include <stdio.h>
> >   main() {
> >
> > ...on next page...
> >
> > Program Segment 1.1: (continued)
> >     printf("hello world!\n");
> >   }
> >
>
> Thanks to Wolfgang's help the splitting problem is solved. However,
> after the float is split, the captions get extra numbers (1.1.A,
> 1.1.B, etc).
>
> I tried to "solve" this by using \setupfloatsplitting[conversions=...]
> but even if I defined a conversion that prints nothing, the caption
> would look like "Program Segment 1.1." (the final separator is still
> printed).

Hi William,

use

\setupfloatsplitting[conversions=numbers]

and

\setupcaptions[way=bytext]

The 1.1 is the normal float numbering, the 1, b, ... are the numbers
of every part of the splitted float.

> I suppose a better way would be to override the command that makes the
> captions (\setupcaption[ProgramSegment][command=...]) so that it
> prints the real caption text in the first part, and "(continued)" in
> the next parts.
> However, I've searched the mailing list archive and I can't find an
> example on what to put inside the command.

This seems to be not supported but you can try to look into core-tsp.tex,
the module where float splitting is implemented.

> Can someone give me a clue as to what I should put inside the command
> or maybe someone will have a better idea (maybe using
> \setupfloatsplitting[inbetween=...])?
>
> I've attached a slightly modified version of Wolfgang's document (I
> added a conversion for the setupfloatsplitting).
>
> Thanks,
> William.

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

end of thread, other threads:[~2007-09-10  5:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07  7:15 how to reuse float numbers? William S.
2007-09-07 11:54 ` Wolfgang Schuster
2007-09-07 12:44   ` William S.
2007-09-07 13:29     ` Wolfgang Schuster
2007-09-07 14:15       ` William S.
2007-09-07 16:17 ` William S.
2007-09-10  5:43   ` Wolfgang Schuster

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