ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \centerline vs. \midaligned vs. \startalignment[middle]
@ 2013-06-26 12:07 Procházka Lukáš Ing. - Pontex s. r. o.
  2013-06-26 12:46 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-06-26 12:07 UTC (permalink / raw)
  To: ConTeXt

Hello,

there are several similar commands to produce text (or another object) to be centered on the line.

What are differences (or intended usage) among \centerline, \midaligned, \startalignment[middle]?

(NB: \centerline has no its-own page on wiki, but it is used at several places in wiki samples.

\centerline was also mentioned here in the mailing list, when I was trying to center "tabulate" - and neither \midaligned nor \startalignment[middle] combined with \dontleavehmode worked.)

TIA.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

* Re: \centerline vs. \midaligned vs. \startalignment[middle]
  2013-06-26 12:07 \centerline vs. \midaligned vs. \startalignment[middle] Procházka Lukáš Ing. - Pontex s. r. o.
@ 2013-06-26 12:46 ` Wolfgang Schuster
  2013-06-26 13:00   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2013-06-26 12:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 26.06.2013 um 14:07 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz>:

> Hello,
> 
> there are several similar commands to produce text (or another object) to be centered on the line.
> 
> What are differences (or intended usage) among \centerline, \midaligned, \startalignment[middle]?
> 
> (NB: \centerline has no its-own page on wiki, but it is used at several places in wiki samples.
> 
> \centerline was also mentioned here in the mailing list, when I was trying to center "tabulate" - and neither \midaligned nor \startalignment[middle] combined with \dontleavehmode worked.)

The three commands

  - \leftline,
  - \rightline and
  - \centerline

are copied from plain TeX and allow you to center short text which fits on a single line but it isn’t recommended to use them because ConTeXt has it’s own alternative for them. The replacement commands are

  - \leftaligned,
  - \rightaligned and
  - \midaligned.

Even though each command is only meant for short text you use the \\ command to put text into several lines, e.g.

  \starttext
  \midaligned{One\\Two\\Three}
  \stoptext

creates three lines for the input. In recent installations you can write

  \startlinealignment[left|middle|right]
  …
  \stopalignment

as a alternative to \leftaligned etc.

With the alignment environment you can change the alignment of the text for a certain region. Unlike the line alignment environment you can use text which covers more than a single line.

  \starttext
  \input knuth\par
  \startalignment[middle]
  \input knuth\par
  \stopalignment
  \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] 6+ messages in thread

* Re: \centerline vs. \midaligned vs. \startalignment[middle]
  2013-06-26 12:46 ` Wolfgang Schuster
@ 2013-06-26 13:00   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2013-06-26 13:10     ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-06-26 13:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Hello,

thanks for explanation.

I also wrote a sample code which should typeset a midaligned table via Lua using "tabulate".

But I'm not able to achieve the goal - what am I doing wrong?

----
\starttext
   T

   \startluacode
     local f = function()
       context.starttabulate{"|rw(2cm)|rw(2cm)|"}
         context.NC()
         context("A")
         context.NC()
         context("B")
         context.NC()
         context.NR()
       context.stoptabulate()
     end

     f()

     context("U\\par")

     context.startalignment{"middle"}
       context("V") -- OK, "V" is successfully midaligned
     context.stopalignment()

     context.startalignment{"middle"}
       f() -- Wrong, table is not midaligned
     context.stopalignment()

     context.startalignment{"middle"}
       context.dontleavehmode()
       f() -- Wrong, too, table is still not midaligned (?!)
     context.stopalignment()

     -- context.midaligned(f) -- This breaks Ctx!
   \stopluacode
\stoptext
----

Best regards,

Lukas


On Wed, 26 Jun 2013 14:46:32 +0200, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

>
> Am 26.06.2013 um 14:07 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz>:
>
>> Hello,
>>
>> there are several similar commands to produce text (or another object) to be centered on the line.
>>
>> What are differences (or intended usage) among \centerline, \midaligned, \startalignment[middle]?
>>
>> (NB: \centerline has no its-own page on wiki, but it is used at several places in wiki samples.
>>
>> \centerline was also mentioned here in the mailing list, when I was trying to center "tabulate" - and neither \midaligned nor \startalignment[middle] combined with \dontleavehmode worked.)
>
> The three commands
>
>   - \leftline,
>   - \rightline and
>   - \centerline
>
> are copied from plain TeX and allow you to center short text which fits on a single line but it isn’t recommended to use them because ConTeXt has it’s own alternative for them. The replacement commands are
>
>   - \leftaligned,
>   - \rightaligned and
>   - \midaligned.
>
> Even though each command is only meant for short text you use the \\ command to put text into several lines, e.g.
>
>   \starttext
>   \midaligned{One\\Two\\Three}
>   \stoptext
>
> creates three lines for the input. In recent installations you can write
>
>   \startlinealignment[left|middle|right]
>   …
>   \stopalignment
>
> as a alternative to \leftaligned etc.
>
> With the alignment environment you can change the alignment of the text for a certain region. Unlike the line alignment environment you can use text which covers more than a single line.
>
>   \starttext
>   \input knuth\par
>   \startalignment[middle]
>   \input knuth\par
>   \stopalignment
>   \stoptext
>
> Wolfgang


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

[-- Attachment #2: t.mkiv --]
[-- Type: application/octet-stream, Size: 800 bytes --]

\starttext
  T

  \startluacode
    local f = function()
      context.starttabulate{"|rw(2cm)|rw(2cm)|"}
        context.NC()
        context("A")
        context.NC()
        context("B")
        context.NC()
        context.NR()
      context.stoptabulate()
    end

    f()

    context("U\\par")

    context.startalignment{"middle"}
      context("V") -- OK, "V" is successfully midaligned
    context.stopalignment()

    context.startalignment{"middle"}
      f() -- Wrong, table is not midaligned
    context.stopalignment()

    context.startalignment{"middle"}
      context.dontleavehmode()
      f() -- Wrong, too, table is still not midaligned (?!)
    context.stopalignment()

    -- context.midaligned(f) -- This breaks Ctx
  \stopluacode
\stoptext

[-- Attachment #3: t.pdf --]
[-- Type: application/pdf, Size: 5200 bytes --]

[-- Attachment #4: Type: text/plain, Size: 485 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \centerline vs. \midaligned vs. \startalignment[middle]
  2013-06-26 13:00   ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2013-06-26 13:10     ` Wolfgang Schuster
  2013-06-26 13:30       ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2013-06-26 13:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 26.06.2013 um 15:00 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz>:

> Hello,
> 
> thanks for explanation.
> 
> I also wrote a sample code which should typeset a midaligned table via Lua using "tabulate".
> 
> But I'm not able to achieve the goal - what am I doing wrong?

Use the solution in the following mail which deals with the same problem: http://www.ntg.nl/pipermail/ntg-context/2013/073795.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] 6+ messages in thread

* Re: \centerline vs. \midaligned vs. \startalignment[middle]
  2013-06-26 13:10     ` Wolfgang Schuster
@ 2013-06-26 13:30       ` Procházka Lukáš Ing. - Pontex s. r. o.
  2013-06-26 13:36         ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2013-06-26 13:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

On Wed, 26 Jun 2013 15:10:43 +0200, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

> Use the solution in the following mail which deals with the same problem: http://www.ntg.nl/pipermail/ntg-context/2013/073795.html
>
> Wolfgang

the following code seems to work:

----
...
     context.startplacetable({location = "here,force,none"})
       f()
     context.stopplacetable()
...
----

I guess:

- "here" and "force" to make the content inside start/stop-placetable non-floating,
- "none" to disable caption.

Thanks again.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka [mailto:LPr@pontex.cz]
Pontex s. r. o.      [mailto:pontex@pontex.cz] [http://www.pontex.cz]
Bezová 1658
147 14 Praha 4

Tel: +420 244 062 238
Fax: +420 244 461 038

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

* Re: \centerline vs. \midaligned vs. \startalignment[middle]
  2013-06-26 13:30       ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2013-06-26 13:36         ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2013-06-26 13:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 26.06.2013 um 15:30 schrieb Procházka Lukáš Ing. - Pontex s. r. o. <LPr@pontex.cz>:

> Hello,
> 
> On Wed, 26 Jun 2013 15:10:43 +0200, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
> 
>> Use the solution in the following mail which deals with the same problem: http://www.ntg.nl/pipermail/ntg-context/2013/073795.html
>> 
>> Wolfgang
> 
> the following code seems to work:
> 
> ----
> ...
>    context.startplacetable({location = "here,force,none"})
>      f()
>    context.stopplacetable()
> ...
> ----
> 
> I guess:
> 
> - "here" and "force" to make the content inside start/stop-placetable non-floating,

You need only “force”. The here keyword places the float only when there is enough space, otherwise
it moves it to another location but force keeps it at the position.

> - "none" to disable caption.

Yes.

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

end of thread, other threads:[~2013-06-26 13:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 12:07 \centerline vs. \midaligned vs. \startalignment[middle] Procházka Lukáš Ing. - Pontex s. r. o.
2013-06-26 12:46 ` Wolfgang Schuster
2013-06-26 13:00   ` Procházka Lukáš Ing. - Pontex s. r. o.
2013-06-26 13:10     ` Wolfgang Schuster
2013-06-26 13:30       ` Procházka Lukáš Ing. - Pontex s. r. o.
2013-06-26 13:36         ` 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).