ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem with \definehead
@ 2011-06-23  9:03 Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-23 10:27 ` Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-23 12:17 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-06-23  9:03 UTC (permalink / raw)
  To: ConTeXt

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

Hello,

please look at the following minimal example:

----
\definehead[chapterMiddle][chapter]
\setuphead[chapterMiddle][align=middle]

\definehead[sectionMiddle][section] % Try to comment this line!

\definecombinedlist[content][part,chapter,chapterMiddle]
\setupcombinedlist[content][alternative=c]

\setuplist
   [chapter,chapterMiddle]
   [alternative=b,before=\blank,after=\blank,style=bold]

% Commands

\def\startTitlePage{
   \bgroup
     \let\chapter=\chapterMiddle
}

\def\stopTitlePage{%
   \egroup
   \page
}

%%%

\starttext
   \placecontent % = TOC
   \page

   \chapter{Cha1}

   \startTitlePage
     \chapter{Cha2}
   \stopTitlePage
\stoptext
----

Its goal is to define \(start/stop)TitlePage command in which heads will be centred (although they are not mid-aligned by default).

(I don't know if my approach is the best - I'm using \chapterMiddle instead of \chapter for this, which is defined as mid-aligned).

A \chapterMiddle is derrived from \chapter and has middle alignment.

I would need to do a similar thing with \sectionMiddle.

The problem is that when I derive a next style - "\definehead[sectionMiddle][section]" (try to comment the proper line), look of the TOC changes (?!) - some extra space before "Cha2" appears; see both test21.pdf and test22.pdf.

So how to keep the same look of the TOC?

And - would you recommend any better solution how to define \(start/stop)command which would force heads to be mid-aligned?

(All compiled with the latest beta, WinXP.)

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

[-- Attachment #2: test21.pdf --]
[-- Type: application/pdf, Size: 7722 bytes --]

[-- Attachment #3: test22.pdf --]
[-- Type: application/pdf, Size: 7722 bytes --]

[-- Attachment #4: test2.mkiv --]
[-- Type: application/octet-stream, Size: 625 bytes --]

\definehead[chapterMiddle][chapter]
\setuphead[chapterMiddle][align=middle]

%\definehead[sectionMiddle][section] % Try to comment this line!

\definecombinedlist[content][part,chapter,chapterMiddle]
\setupcombinedlist[content][alternative=c]

\setuplist
  [chapter,chapterMiddle]
  [alternative=b,before=\blank,after=\blank,style=bold]

% Commands

\def\startTitlePage{
  \bgroup
    \let\chapter=\chapterMiddle
}

\def\stopTitlePage{%
  \egroup
  \page
}

%%%

\starttext
  \placecontent % = TOC
  \page

  \chapter{Cha1}

  \startTitlePage
    \chapter{Cha2}
  \stopTitlePage
\stoptext

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

* Re: Problem with \definehead
  2011-06-23  9:03 Problem with \definehead Procházka Lukáš Ing. - Pontex s. r. o.
@ 2011-06-23 10:27 ` Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-23 12:17 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-06-23 10:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

... A simplified piece of code - the result still depends on presence of "\definehead[sectionMiddle][section]":

----
\definehead[chapterMiddle][chapter]
\setuphead[chapterMiddle][align=middle]

\definehead[sectionMiddle][section] % Try to comment this line!

\definecombinedlist[content][chapter,chapterMiddle]

%%%

\starttext
   \placecontent
   \page

   \chapter{Cha1}
   \chapterMiddle{ChaM}
   \chapter{Cha3}
\stoptext
----

Any idea?

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

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

\definehead[chapterMiddle][chapter]
\setuphead[chapterMiddle][align=middle]

\definehead[sectionMiddle][section] % Try to comment this line!

\definecombinedlist[content][chapter,chapterMiddle]

%%%

\starttext
  \placecontent
  \page

  \chapter{Cha1}
  \chapterMiddle{ChaM}
  \chapter{Cha3}
\stoptext

[-- Attachment #3: test21.pdf --]
[-- Type: application/pdf, Size: 6222 bytes --]

[-- Attachment #4: test22.pdf --]
[-- Type: application/pdf, Size: 6221 bytes --]

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

* Re: Problem with \definehead
  2011-06-23  9:03 Problem with \definehead Procházka Lukáš Ing. - Pontex s. r. o.
  2011-06-23 10:27 ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2011-06-23 12:17 ` Wolfgang Schuster
  2011-06-23 13:07   ` Procházka Lukáš Ing. - Pontex s. r. o.
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Schuster @ 2011-06-23 12:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 23.06.2011 um 11:03 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

> Its goal is to define \(start/stop)TitlePage command in which heads will be centred (although they are not mid-aligned by default).
> 
> (I don't know if my approach is the best - I'm using \chapterMiddle instead of \chapter for this, which is defined as mid-aligned).
> 
> A \chapterMiddle is derrived from \chapter and has middle alignment.
> 
> I would need to do a similar thing with \sectionMiddle.
> 
> The problem is that when I derive a next style - "\definehead[sectionMiddle][section]" (try to comment the proper line), look of the TOC changes (?!) - some extra space before "Cha2" appears; see both test21.pdf and test22.pdf.
> 
> So how to keep the same look of the TOC?
> 
> And - would you recommend any better solution how to define \(start/stop)command which would force heads to be mid-aligned?

Don’t misuse headings for your titlepage. As a titlepage is something special
you can use \midaligned, \definedfont etc. to format it, e.g.

\starttext

\starttextmakeup[align=middle]

\definedfont[SansBold sa 2]My Document

\stoptextmakeup

…

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

* Re: Problem with \definehead
  2011-06-23 12:17 ` Wolfgang Schuster
@ 2011-06-23 13:07   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 0 replies; 4+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2011-06-23 13:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> Don’t misuse headings for your titlepage. As a titlepage is something special
> you can use \midaligned, \definedfont etc. to format it, e.g.

Thanks for the answer, but -

- to describe better my situation:

I'm not creating a typical book, but a special kind of report, with many code generated by Lua, many \typefiles and many included PDFs.

And here, there are heads being used as:

- "normal" heads (left-aligned; appended by normal text) and
- "title-like" heads (mid-aligned) which should stand alone on a page (e.g. being appended by other pdf documents on the next page).

Both kinds of heads should be numbered and should be involved to TOC; so in this point of view, they have the same status.

So e.g.:

--- (page) ---
Chapter 1      <- Normally left-aligned
Section 1.1    <- Normally left-aligned

Some text
some text
some text
some text

--- (page) ---

   Chapter 2    <- Mid-aligned
  Section 2.1   <- Mid-aligned



--- (page) ---

+------------+
| Another    |
| pdf        |
+------------+



--- (page) ---


So "Chapter 1" and "Section 1.1" are "normal" heads, probably typeset by \chapter and \section.

As my primary intention was not to "force" normal heads to be aligned otherwise, I derived new head styles \chapterMiddle and \sectionMiddle, which are used to generate "Chapter 2" and "Section 2.1".

But the problem is that TOC becomes visually "crashed" once \sectionMiddle has been defined.

So how to solve it?

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

end of thread, other threads:[~2011-06-23 13:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-23  9:03 Problem with \definehead Procházka Lukáš Ing. - Pontex s. r. o.
2011-06-23 10:27 ` Procházka Lukáš Ing. - Pontex s. r. o.
2011-06-23 12:17 ` Wolfgang Schuster
2011-06-23 13:07   ` Procházka Lukáš Ing. - Pontex s. r. o.

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