ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Modes in tables
@ 2018-09-06  9:44 Jan Willem Flamma
  2018-09-06 16:53 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Willem Flamma @ 2018-09-06  9:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list members

I would like to disable to third column in the question when mode BL is not enabled.

When mode BL is enabled (using the toggle), the third column should of course appear again.

How can I achieve this?

Regards,
Jan Willem


MWE: 

\starttext

%Toggles
%\enablemode[BL]

\defineblock[question]
\defineblock[answer]

\hideblocks[question] 
\hideblocks[answer]     
 

\defineenumeration
    [question]
    [text=Question,
     after={\blank[2*big]},
     inbetween={\blank[nowhite]},
     way=bychapter,
     prefixsegments=chapter,
     prefix=yes]

     
\defineenumeration
    [answer]
    [counter=answer,
     text=,
     width=,
     before={\blank[nowhite]},
     after={\blank[nowhite]},
     indenting=no,
     titledistance=1cm,
     location=inmargin,
     alternative=left,
     headstyle=,
     way=bychapter,
     prefixsegments=chapter,
     prefix=yes]
     
     
\beginquestion
\startquestion
Calculate the hydrostatic pressure of the following fluid. 
\starttabulate[|lw(6cm)|lw(3cm)|\doifmode{BL}{p|}]
\NC Well depth                   \NC 10100 ft    \doifmode{BL}{\NC 3100 m}	     \NC \NR
\NC Fluid density                \NC 9.0 ppg     \doifmode{BL}{\NC 1.08 kg/l}	    \NC \NR
\stoptabulate
\stopquestion
\endquestion
\beginanswer
\startanswer
4726 psi\doifmode{BL}{ / 328 bar}
\stopanswer
\endanswer


\startsection[title=Questions]
    \useblocks[question]
    \startsubsubsection[title=Answers]
        \useblocks[answer]
    \stopsubsubsection
\stopsection

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Modes in tables
  2018-09-06  9:44 Modes in tables Jan Willem Flamma
@ 2018-09-06 16:53 ` Wolfgang Schuster
  2018-09-07 18:01   ` Jan Willem Flamma
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2018-09-06 16:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jan Willem Flamma

You can’t do this with tabulate but it’s possible with natural tables.

%\enablemode [BL]

\starttext

\startsetups [tablesetups]
     \setupTABLE [start]      [frame=off]
     \setupTABLE [column] [1] [width=6cm,align=flushleft]
     \setupTABLE [column] [2] [width=2cm,align=flushleft]
\stopsetups

\bTABLE [setups=tablesetups]
     \bTR
         \bTD Well depth \eTD
         \bTD 10100 ft \eTD
         \startmode [BL] \bTD \unit{3100 meter} \eTD \stopmode
     \eTR
     \bTR
         \bTD Fluid density \eTD
         \bTD 9.0 ppg \eTD
         \startmode [BL] \bTD \unit{1.08 kilogram per liter} \eTD \stopmode
     \eTR
\eTABLE

\stoptext

Wolfgang


Jan Willem Flamma schrieb am 06.09.18 um 11:44:
> Dear list members
>
> I would like to disable to third column in the question when mode BL is not enabled.
>
> When mode BL is enabled (using the toggle), the third column should of course appear again.
>
> How can I achieve this?
>
> Regards,
> Jan Willem
>
>
> MWE:
>
> \starttext
>
> %Toggles
> %\enablemode[BL]
>
> \defineblock[question]
> \defineblock[answer]
>
> \hideblocks[question]
> \hideblocks[answer]
>   
>
> \defineenumeration
>      [question]
>      [text=Question,
>       after={\blank[2*big]},
>       inbetween={\blank[nowhite]},
>       way=bychapter,
>       prefixsegments=chapter,
>       prefix=yes]
>
>       
> \defineenumeration
>      [answer]
>      [counter=answer,
>       text=,
>       width=,
>       before={\blank[nowhite]},
>       after={\blank[nowhite]},
>       indenting=no,
>       titledistance=1cm,
>       location=inmargin,
>       alternative=left,
>       headstyle=,
>       way=bychapter,
>       prefixsegments=chapter,
>       prefix=yes]
>       
>       
> \beginquestion
> \startquestion
> Calculate the hydrostatic pressure of the following fluid.
> \starttabulate[|lw(6cm)|lw(3cm)|\doifmode{BL}{p|}]
> \NC Well depth                   \NC 10100 ft    \doifmode{BL}{\NC 3100 m}	     \NC \NR
> \NC Fluid density                \NC 9.0 ppg     \doifmode{BL}{\NC 1.08 kg/l}	    \NC \NR
> \stoptabulate
> \stopquestion
> \endquestion
> \beginanswer
> \startanswer
> 4726 psi\doifmode{BL}{ / 328 bar}
> \stopanswer
> \endanswer
>
>
> \startsection[title=Questions]
>      \useblocks[question]
>      \startsubsubsection[title=Answers]
>          \useblocks[answer]
>      \stopsubsubsection
> \stopsection
>
> \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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Modes in tables
  2018-09-06 16:53 ` Wolfgang Schuster
@ 2018-09-07 18:01   ` Jan Willem Flamma
  2018-09-07 18:19     ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Willem Flamma @ 2018-09-07 18:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you Wolfgang.

When comparing the results between tabulate and TABLE, I noticed some different results in formatting.

1. When using TABLE the table text is slightly shifted to the right. My initial guess was that this is due to the frame thickness but setting rulethickness= 0pt did not solve this. 
How can I get the text in the table to align with the regular text?

2. In both cases column widths of 6cm and 3 cm have been set. Yet, the results show a difference in column width (not sure which one is correct)

3. The vertical space between the regular text and the start of the table varies. It is larger when using tabulate.

4. The vertical space between the lines in the table text also varies. It is larger when using TABLE.

(I left out the modes in MWE below because I don’t think it is relevant here.)

\starttext

\setupwhitespace[big]

\startsetups [tablesetups]
    \setupTABLE [start]      [frame=off, rulethickness=0pt]
    \setupTABLE [column] [1] [width=6cm,align=flushleft]
    \setupTABLE [column] [2] [width=3cm,align=flushleft]
\stopsetups

Calculate the hydrostatic pressure of the following fluid.
\par
\bTABLE [setups=tablesetups]
    \bTR
        \bTD Well depth     \eTD
        \bTD 10100 ft       \eTD
        \bTD 3100 m         \eTD
    \eTR
    \bTR
        \bTD Fluid density  \eTD
        \bTD 9.0 ppg        \eTD
        \bTD 1.08 kg/l      \eTD
    \eTR
\eTABLE

Calculate the hydrostatic pressure of the following fluid.
\starttabulate[|lw(6cm)|lw(3cm)|p|]
\NC Well depth          \NC 10100 ft    \NC 3100 m	        \NC \NR
\NC Fluid density       \NC 9.0 ppg     \NC 1.08 kg/l	    \NC \NR
\stoptabulate

\stoptext



> On 6 Sep 2018, at 18:53, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> You can’t do this with tabulate but it’s possible with natural tables.
> 
> %\enablemode [BL]
> 
> \starttext
> 
> \startsetups [tablesetups]
>     \setupTABLE [start]      [frame=off]
>     \setupTABLE [column] [1] [width=6cm,align=flushleft]
>     \setupTABLE [column] [2] [width=2cm,align=flushleft]
> \stopsetups
> 
> \bTABLE [setups=tablesetups]
>     \bTR
>         \bTD Well depth \eTD
>         \bTD 10100 ft \eTD
>         \startmode [BL] \bTD \unit{3100 meter} \eTD \stopmode
>     \eTR
>     \bTR
>         \bTD Fluid density \eTD
>         \bTD 9.0 ppg \eTD
>         \startmode [BL] \bTD \unit{1.08 kilogram per liter} \eTD \stopmode
>     \eTR
> \eTABLE
> 
> \stoptext
> 
> Wolfgang
> 
> 
> Jan Willem Flamma schrieb am 06.09.18 um 11:44:
>> Dear list members
>> 
>> I would like to disable to third column in the question when mode BL is not enabled.
>> 
>> When mode BL is enabled (using the toggle), the third column should of course appear again.
>> 
>> How can I achieve this?
>> 
>> Regards,
>> Jan Willem
>> 
>> 
>> MWE:
>> 
>> \starttext
>> 
>> %Toggles
>> %\enablemode[BL]
>> 
>> \defineblock[question]
>> \defineblock[answer]
>> 
>> \hideblocks[question]
>> \hideblocks[answer]
>>  
>> \defineenumeration
>>     [question]
>>     [text=Question,
>>      after={\blank[2*big]},
>>      inbetween={\blank[nowhite]},
>>      way=bychapter,
>>      prefixsegments=chapter,
>>      prefix=yes]
>> 
>>      \defineenumeration
>>     [answer]
>>     [counter=answer,
>>      text=,
>>      width=,
>>      before={\blank[nowhite]},
>>      after={\blank[nowhite]},
>>      indenting=no,
>>      titledistance=1cm,
>>      location=inmargin,
>>      alternative=left,
>>      headstyle=,
>>      way=bychapter,
>>      prefixsegments=chapter,
>>      prefix=yes]
>>            \beginquestion
>> \startquestion
>> Calculate the hydrostatic pressure of the following fluid.
>> \starttabulate[|lw(6cm)|lw(3cm)|\doifmode{BL}{p|}]
>> \NC Well depth                   \NC 10100 ft    \doifmode{BL}{\NC 3100 m}	     \NC \NR
>> \NC Fluid density                \NC 9.0 ppg     \doifmode{BL}{\NC 1.08 kg/l}	    \NC \NR
>> \stoptabulate
>> \stopquestion
>> \endquestion
>> \beginanswer
>> \startanswer
>> 4726 psi\doifmode{BL}{ / 328 bar}
>> \stopanswer
>> \endanswer
>> 
>> 
>> \startsection[title=Questions]
>>     \useblocks[question]
>>     \startsubsubsection[title=Answers]
>>         \useblocks[answer]
>>     \stopsubsubsection
>> \stopsection
>> 
>> \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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Modes in tables
  2018-09-07 18:01   ` Jan Willem Flamma
@ 2018-09-07 18:19     ` Wolfgang Schuster
  2018-09-10  9:49       ` Jan Willem Flamma
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2018-09-07 18:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jan Willem Flamma



Jan Willem Flamma schrieb am 07.09.18 um 20:01:
> Thank you Wolfgang.
>
> When comparing the results between tabulate and TABLE, I noticed some different results in formatting.
>
> 1. When using TABLE the table text is slightly shifted to the right. My initial guess was that this is due to the frame thickness but setting rulethickness= 0pt did not solve this.
> How can I get the text in the table to align with the regular text?

In a natural table each cell acts like \framed where you have a offset 
value on each side, to get rid of it set offset to 0pt.

\setupTABLE [start] [frame=off,rulethickness=0pt,offset=0pt]

> 2. In both cases column widths of 6cm and 3 cm have been set. Yet, the results show a difference in column width (not sure which one is correct)

Tabulate adds extra space between the columns but it can be disabled.

\starttabulate[|lw(6cm)j0|i0lw(3cm)|p|]

> 3. The vertical space between the regular text and the start of the table varies. It is larger when using tabulate.

Tabulate add by default a \blank before and after the table which can be 
disabled.

\starttabulate [...] [before=,after=]

or

\setuptabulate [before=,after=]

> 4. The vertical space between the lines in the table text also varies. It is larger when using TABLE.

Setting offset to 0pt reduces the vertical space in natural table but 
there will always be differences between different table types.


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Modes in tables
  2018-09-07 18:19     ` Wolfgang Schuster
@ 2018-09-10  9:49       ` Jan Willem Flamma
  2018-09-10 15:31         ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Willem Flamma @ 2018-09-10  9:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you again Wolfgang.

Yet another question: 

I like to get rid of the \par and tried integrating it into the tablesetups somehow. I've tried adding things like before={\blank} and before\par but couldn’t get it to work.


\starttext

\startsetups [tablesetups]
    
    \setupTABLE [start]      [frame=off,rulethickness=0pt,offset=0pt]
    \setupTABLE [column] [1] [width=6cm,align=flushleft]
    \setupTABLE [column] [2] [width=3cm,align=flushleft]
\stopsetups

Calculate the hydrostatic pressure of the following fluid.
\par    % <-- can I get rid of this par?
\bTABLE [setups=tablesetups]
    \bTR
        \bTD Well depth     \eTD
        \bTD 10100 ft       \eTD
        \bTD 3100 m         \eTD
    \eTR
    \bTR
        \bTD Fluid density  \eTD
        \bTD 9.0 ppg        \eTD
        \bTD 1.08 kg/l      \eTD
    \eTR
\eTABLE

\stoptext

> On 7 Sep 2018, at 20:19, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> 
> 
> Jan Willem Flamma schrieb am 07.09.18 um 20:01:
>> Thank you Wolfgang.
>> 
>> When comparing the results between tabulate and TABLE, I noticed some different results in formatting.
>> 
>> 1. When using TABLE the table text is slightly shifted to the right. My initial guess was that this is due to the frame thickness but setting rulethickness= 0pt did not solve this.
>> How can I get the text in the table to align with the regular text?
> 
> In a natural table each cell acts like \framed where you have a offset value on each side, to get rid of it set offset to 0pt.
> 
> \setupTABLE [start] [frame=off,rulethickness=0pt,offset=0pt]
> 
>> 2. In both cases column widths of 6cm and 3 cm have been set. Yet, the results show a difference in column width (not sure which one is correct)
> 
> Tabulate adds extra space between the columns but it can be disabled.
> 
> \starttabulate[|lw(6cm)j0|i0lw(3cm)|p|]
> 
>> 3. The vertical space between the regular text and the start of the table varies. It is larger when using tabulate.
> 
> Tabulate add by default a \blank before and after the table which can be disabled.
> 
> \starttabulate [...] [before=,after=]
> 
> or
> 
> \setuptabulate [before=,after=]
> 
>> 4. The vertical space between the lines in the table text also varies. It is larger when using TABLE.
> 
> Setting offset to 0pt reduces the vertical space in natural table but there will always be differences between different table types.
> 
> 
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Modes in tables
  2018-09-10  9:49       ` Jan Willem Flamma
@ 2018-09-10 15:31         ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2018-09-10 15:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jan Willem Flamma

Just use a empty line before the table.

Wolfgang


Jan Willem Flamma schrieb am 10.09.18 um 11:49:
> Thank you again Wolfgang.
>
> Yet another question:
>
> I like to get rid of the \par and tried integrating it into the tablesetups somehow. I've tried adding things like before={\blank} and before\par but couldn’t get it to work.
>
>
> \starttext
>
> \startsetups [tablesetups]
>      
>      \setupTABLE [start]      [frame=off,rulethickness=0pt,offset=0pt]
>      \setupTABLE [column] [1] [width=6cm,align=flushleft]
>      \setupTABLE [column] [2] [width=3cm,align=flushleft]
> \stopsetups
>
> Calculate the hydrostatic pressure of the following fluid.
> \par    % <-- can I get rid of this par?
> \bTABLE [setups=tablesetups]
>      \bTR
>          \bTD Well depth     \eTD
>          \bTD 10100 ft       \eTD
>          \bTD 3100 m         \eTD
>      \eTR
>      \bTR
>          \bTD Fluid density  \eTD
>          \bTD 9.0 ppg        \eTD
>          \bTD 1.08 kg/l      \eTD
>      \eTR
> \eTABLE
>
> \stoptext
>
>> On 7 Sep 2018, at 20:19, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
>>
>>
>>
>> Jan Willem Flamma schrieb am 07.09.18 um 20:01:
>>> Thank you Wolfgang.
>>>
>>> When comparing the results between tabulate and TABLE, I noticed some different results in formatting.
>>>
>>> 1. When using TABLE the table text is slightly shifted to the right. My initial guess was that this is due to the frame thickness but setting rulethickness= 0pt did not solve this.
>>> How can I get the text in the table to align with the regular text?
>> In a natural table each cell acts like \framed where you have a offset value on each side, to get rid of it set offset to 0pt.
>>
>> \setupTABLE [start] [frame=off,rulethickness=0pt,offset=0pt]
>>
>>> 2. In both cases column widths of 6cm and 3 cm have been set. Yet, the results show a difference in column width (not sure which one is correct)
>> Tabulate adds extra space between the columns but it can be disabled.
>>
>> \starttabulate[|lw(6cm)j0|i0lw(3cm)|p|]
>>
>>> 3. The vertical space between the regular text and the start of the table varies. It is larger when using tabulate.
>> Tabulate add by default a \blank before and after the table which can be disabled.
>>
>> \starttabulate [...] [before=,after=]
>>
>> or
>>
>> \setuptabulate [before=,after=]
>>
>>> 4. The vertical space between the lines in the table text also varies. It is larger when using TABLE.
>> Setting offset to 0pt reduces the vertical space in natural table but there will always be differences between different table types.
>>
>>
>> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2018-09-10 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06  9:44 Modes in tables Jan Willem Flamma
2018-09-06 16:53 ` Wolfgang Schuster
2018-09-07 18:01   ` Jan Willem Flamma
2018-09-07 18:19     ` Wolfgang Schuster
2018-09-10  9:49       ` Jan Willem Flamma
2018-09-10 15:31         ` 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).