ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Nested floats
@ 2012-03-09 16:38 Prashanth
  2012-03-10 13:29 ` Marco
  2012-03-10 13:49 ` Wolfgang Schuster
  0 siblings, 2 replies; 8+ messages in thread
From: Prashanth @ 2012-03-09 16:38 UTC (permalink / raw)
  To: ntg-context

Hi,

I need to create some small tables that are (possibly) next to each other.
Though I could make text flow around tables and appear to the left or
to the right of the table, I could not manage something like this:

+--------------------------------------+
|                  |                   |
| Table 1  content | Table 2  content  |
|                  |                   |
| Table 1 TITLE    | Table 2 TITLE     |
|                  |                   |
+------------------|-------------------+

So I tried to use nested floats to achieve this (floats because I want each
to have its own number and title).

Below my mail, I have pasted the code I used to accomplish this. I don't
understand why, but it starts numbering with 7 onwards. Is there a way I can
fix the numbering?
Best regards,
Prash
\setupheads[chapter][page=no]
\starttext
   \chapter{first}
   \section{1st section}
   hello

   \section{2nd section}
   hello again

   \placetable[here,none][]{}{
   \bTABLE[frame=off] \bTR \bTD
     \placetable[force][tab:first]{derivation for sentence}{
       \bTABLE[frame=off,align=center]
       \bTR      \bTD abc \eTD      \bTD def \eTD      \eTR
       \bTR      \bTD ghi \eTD      \bTD jkl \eTD      \eTR
       \eTABLE
     }
   \eTD \bTD
     \placetable[force][tab:second]{derivation for sentence}{
       \bTABLE[frame=off,align=center]
       \bTR      \bTD abc \eTD      \bTD def \eTD      \eTR
       \bTR      \bTD ghi \eTD      \bTD jkl \eTD      \eTR
       \eTABLE
     }
   \eTD \eTR \eTABLE
   }


   \chapter{Second}
   \placetable[here,none][]{}{
   \bTABLE[frame=off] \bTR \bTD
     \placetable[force][tab:third]{derivation for sentence}{
       \bTABLE[frame=off,align=center]
       \bTR      \bTD abc \eTD      \bTD def \eTD      \eTR
       \bTR      \bTD ghi \eTD      \bTD jkl \eTD      \eTR
       \eTABLE
     }
   \eTD \bTD
     \placetable[force][tab:fourth]{derivation for sentence}{
       \bTABLE[frame=off,align=center]
       \bTR      \bTD abc \eTD      \bTD def \eTD      \eTR
       \bTR      \bTD ghi \eTD      \bTD jkl \eTD      \eTR
       \eTABLE
     }
   \eTD \eTR \eTABLE
   }

   \placetable[here,none][]{}{
   \bTABLE[frame=off] \bTR \bTD
     \placetable[force][tab:fifth]{derivation for sentence}{
       \bTABLE[frame=off,align=center]
       \bTR      \bTD abc \eTD      \bTD def \eTD      \eTR
       \bTR      \bTD ghi \eTD      \bTD jkl \eTD      \eTR
       \eTABLE
     }
   \eTD \bTD
     \placetable[force][tab:sixth]{derivation for sentence}{
       \bTABLE[frame=off,align=center]
       \bTR      \bTD abc \eTD      \bTD def \eTD      \eTR
       \bTR      \bTD ghi \eTD      \bTD jkl \eTD      \eTR
       \eTABLE
     }
   \eTD \eTR \eTABLE
   }

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


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

* Re: Nested floats
  2012-03-09 16:38 Nested floats Prashanth
@ 2012-03-10 13:29 ` Marco
  2012-03-10 22:21   ` Prashanth
  2012-03-10 13:49 ` Wolfgang Schuster
  1 sibling, 1 reply; 8+ messages in thread
From: Marco @ 2012-03-10 13:29 UTC (permalink / raw)
  To: ntg-context

On 2012-03-09 Prashanth <prash.n.rao@gmail.com> wrote:

> I need to create some small tables that are (possibly) next to each other.
> Though I could make text flow around tables and appear to the left or
> to the right of the table, I could not manage something like this:

I would use combinations for that (see example below).

> So I tried to use nested floats to achieve this

Nesting floats is not a good idea.

> (floats because I want each to have its own number and title).

There are other ways to achieve that.


\setupheads [chapter] [page=no]

\startbuffer
  \bTABLE [frame=off, align=center]
    \bTR \bTD abc \eTD \bTD def \eTD \eTR
    \bTR \bTD ghi \eTD \bTD jkl \eTD \eTR
  \eTABLE
\stopbuffer

\starttext

\startchapter [title=First]
  \startsection [title=1st Section]
    \startplacetable
      \startcombination [2*1]
        {\getbuffer} {(a)}
        {\getbuffer} {(b)}
      \stopcombination
    \stopplacetable
  \stopsection
\stopchapter

\startchapter [title=Second]
  \startplacetable [location=right]
    \setupcombination [distance=2cm]
    \startcombination [2*2]
      {\getbuffer} {(a)}
      {\getbuffer} {(b)}
      {\getbuffer} {(c)}
      {\getbuffer} {(d)}
    \stopcombination
  \stopplacetable
  \input knuth
\stopchapter

\stoptext


Marco


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


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

* Re: Nested floats
  2012-03-09 16:38 Nested floats Prashanth
  2012-03-10 13:29 ` Marco
@ 2012-03-10 13:49 ` Wolfgang Schuster
  2012-03-10 14:47   ` Marco
  2012-03-10 22:33   ` Prashanth
  1 sibling, 2 replies; 8+ messages in thread
From: Wolfgang Schuster @ 2012-03-10 13:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 09.03.2012 um 17:38 schrieb Prashanth:

> Hi,
> 
> I need to create some small tables that are (possibly) next to each other.
> Though I could make text flow around tables and appear to the left or
> to the right of the table, I could not manage something like this:
> 
> +--------------------------------------+
> |                  |                   |
> | Table 1  content | Table 2  content  |
> |                  |                   |
> | Table 1 TITLE    | Table 2 TITLE     |
> |                  |                   |
> +------------------|-------------------+
> 
> So I tried to use nested floats to achieve this (floats because I want each
> to have its own number and title).

You can use floatcombinations: http://archive.contextgarden.net/message/20060411.201855.519a8b16.en.html

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


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

* Re: Nested floats
  2012-03-10 13:49 ` Wolfgang Schuster
@ 2012-03-10 14:47   ` Marco
  2012-03-10 22:33   ` Prashanth
  1 sibling, 0 replies; 8+ messages in thread
From: Marco @ 2012-03-10 14:47 UTC (permalink / raw)
  To: ntg-context

On 2012-03-10 Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:

> You can use floatcombinations:
> http://archive.contextgarden.net/message/20060411.201855.519a8b16.en.html

The example code in the mail give an error message:

! Use of \somelocalfloat doesn't match its definition.

system          > tex > error on line 3 in file floatcombi.tex: Use of  ...

1     \starttext
2       \startfloatcombination [2*2]
3 >>      \placefigure{alpha}{\externalfigure[cow.pdf][width=1cm]}

Example:

\starttext
  \startfloatcombination [2*2]
    \placefigure{alpha}{\externalfigure[cow.pdf][width=1cm]} 
    \placefigure{beta} {\externalfigure[cow.pdf][width=2cm]} 
    \placefigure{gamma}{\externalfigure[cow.pdf][width=3cm]} 
    \placefigure{delta}{\externalfigure[cow.pdf][width=4cm]} 
  \stopfloatcombination
\stoptext


Marco


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


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

* Re: Nested floats
  2012-03-10 13:29 ` Marco
@ 2012-03-10 22:21   ` Prashanth
  0 siblings, 0 replies; 8+ messages in thread
From: Prashanth @ 2012-03-10 22:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Marco,
I hesitate to use combinations because Table 1.1 (a) and Table 1.1 (b) 
are not always related to each other. But I will use combinations if 
everything else fails.

Do you have any intuitions as to why the numbering begins at 7? I tried 
to not use the outermost float ("\placetable[here,none][]{}{ ") and it 
still started numbering at 7. I believe this is an issue with nested 
tables, not nested floats.
Best regards,
Prash

On 10/03/12 14:29, Marco wrote:
> On 2012-03-09 Prashanth<prash.n.rao@gmail.com>  wrote:
>
>> I need to create some small tables that are (possibly) next to each other.
>> Though I could make text flow around tables and appear to the left or
>> to the right of the table, I could not manage something like this:
> I would use combinations for that (see example below).
>
>> So I tried to use nested floats to achieve this
> Nesting floats is not a good idea.
>
>> (floats because I want each to have its own number and title).
> There are other ways to achieve that.
>
>
> \setupheads [chapter] [page=no]
>
> \startbuffer
>    \bTABLE [frame=off, align=center]
>      \bTR \bTD abc \eTD \bTD def \eTD \eTR
>      \bTR \bTD ghi \eTD \bTD jkl \eTD \eTR
>    \eTABLE
> \stopbuffer
>
> \starttext
>
> \startchapter [title=First]
>    \startsection [title=1st Section]
>      \startplacetable
>        \startcombination [2*1]
>          {\getbuffer} {(a)}
>          {\getbuffer} {(b)}
>        \stopcombination
>      \stopplacetable
>    \stopsection
> \stopchapter
>
> \startchapter [title=Second]
>    \startplacetable [location=right]
>      \setupcombination [distance=2cm]
>      \startcombination [2*2]
>        {\getbuffer} {(a)}
>        {\getbuffer} {(b)}
>        {\getbuffer} {(c)}
>        {\getbuffer} {(d)}
>      \stopcombination
>    \stopplacetable
>    \input knuth
> \stopchapter
>
> \stoptext
>
>
> Marco
>
>
> ___________________________________________________________________________________
> 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  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Nested floats
  2012-03-10 13:49 ` Wolfgang Schuster
  2012-03-10 14:47   ` Marco
@ 2012-03-10 22:33   ` Prashanth
  2012-03-11  8:57     ` Wolfgang Schuster
  1 sibling, 1 reply; 8+ messages in thread
From: Prashanth @ 2012-03-10 22:33 UTC (permalink / raw)
  To: ntg-context

Hi Wolfgang,
This is exactly what I was looking for. However, it works only in mkii, 
not in mkiv. Searching though the mailinglist for floatcombinations, I 
came across this discussion ( 
http://archive.contextgarden.net/message/20100601.084655.c7d6e858.en.html). 
Taco's solution works just like Hans' code, but again, only in mkii.

Best regards,
Prash

On 10/03/12 14:49, Wolfgang Schuster wrote:
> Am 09.03.2012 um 17:38 schrieb Prashanth:
>
>> Hi,
>>
>> I need to create some small tables that are (possibly) next to each other.
>> Though I could make text flow around tables and appear to the left or
>> to the right of the table, I could not manage something like this:
>>
>> +--------------------------------------+
>> |                  |                   |
>> | Table 1  content | Table 2  content  |
>> |                  |                   |
>> | Table 1 TITLE    | Table 2 TITLE     |
>> |                  |                   |
>> +------------------|-------------------+
>>
>> So I tried to use nested floats to achieve this (floats because I want each
>> to have its own number and title).
> You can use floatcombinations: http://archive.contextgarden.net/message/20060411.201855.519a8b16.en.html
>
> 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  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Nested floats
  2012-03-10 22:33   ` Prashanth
@ 2012-03-11  8:57     ` Wolfgang Schuster
  2012-03-12 21:55       ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2012-03-11  8:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 10.03.2012 um 23:33 schrieb Prashanth:

> Hi Wolfgang,
> This is exactly what I was looking for. However, it works only in mkii, not in mkiv. Searching though the mailinglist for floatcombinations, I came across this discussion ( http://archive.contextgarden.net/message/20100601.084655.c7d6e858.en.html). Taco's solution works just like Hans' code, but again, only in mkii.

With a simple fix in strc-flt.mkvi \startcombination will work but still each figure is to wide and all of them won’t fit on the page.

\def\somelocalfloat % strc-flt.mkvi: was \def\somelocalfloat[#1]%
  {\doglobal\increment\noflocalfloats
   \savebox{localfloats}{\noflocalfloats}{\box\floatbox}}

\setuppapersize[A5][A4,landscape]

\starttext \showframe
 \startfloatcombination [2*2]
   \placefigure{alpha}{\externalfigure[cow.pdf][width=1cm]} 
   \placefigure{beta} {\externalfigure[cow.pdf][width=2cm]} 
   \placefigure{gamma}{\externalfigure[cow.pdf][width=3cm]} 
   \placefigure{delta}{\externalfigure[cow.pdf][width=4cm]} 
 \stopfloatcombination
\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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Nested floats
  2012-03-11  8:57     ` Wolfgang Schuster
@ 2012-03-12 21:55       ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2012-03-12 21:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 11-3-2012 09:57, Wolfgang Schuster wrote:
>
> Am 10.03.2012 um 23:33 schrieb Prashanth:
>
>> Hi Wolfgang,
>> This is exactly what I was looking for. However, it works only in mkii, not in mkiv. Searching though the mailinglist for floatcombinations, I came across this discussion ( http://archive.contextgarden.net/message/20100601.084655.c7d6e858.en.html). Taco's solution works just like Hans' code, but again, only in mkii.
>
> With a simple fix in strc-flt.mkvi \startcombination will work but still each figure is to wide and all of them won’t fit on the page.

I temporary fixed this but eventually there will be a better solution


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2012-03-12 21:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 16:38 Nested floats Prashanth
2012-03-10 13:29 ` Marco
2012-03-10 22:21   ` Prashanth
2012-03-10 13:49 ` Wolfgang Schuster
2012-03-10 14:47   ` Marco
2012-03-10 22:33   ` Prashanth
2012-03-11  8:57     ` Wolfgang Schuster
2012-03-12 21:55       ` 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).