ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* why does not this style work?
@ 2008-10-26 15:55 Ruini Xue
  2008-10-26 16:19 ` Zhichu Chen
  2008-10-26 16:46 ` Zhichu Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Ruini Xue @ 2008-10-26 15:55 UTC (permalink / raw)
  To: ntg-context

I want to use a dedicated font size for the chapter title, so I wrote this 
piece of code:

%%%%%%%%%%%%%%%%%%
\def\mybig%
  {\dosingleempty\dosanhao}
\def\dosanhao[#1]%
  {\switchtobodyfont[24pt]}

\setuphead
   [chapter]
   [style=\mybig]
 
\starttext
\chapter{hello, world}

\stoptext
%%%%%%%%%%%%%%%%%

However, the error is:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Use of \dosanhao doesn't match its definition.
\doifnextcharelse ...token =#1\def \!!stringa {#2}
                                                  \def \!!stringb {#3}\futur...
\@@kochapterstyle ->\mybig 
                           \bf 
\doconvertfont #1->\edef \p!defined {#1
                                       }\ifx \p!defined \empty \else \@EA \d...
\dosetfontattribute ...me #1#2\@EA \endcsname \fi 
                                                  \empty 
\doplaceheadnumbertext ...bute {\??ko #1}\c!style 
                                                  \dosetcolorattribute {\??k...
\dodododoconstructhead ...{\finalsectionnumber }}}
                                                  \writesection {#1}{#3}{#4}...
l.11 \chapter{hello, world}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If I replace the \mybig with \switchtobodyfont in style=xx, it works fine. 
What's the difference between  them? and why the former does not work?

-- ruini







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

* Re: why does not this style work?
  2008-10-26 15:55 why does not this style work? Ruini Xue
@ 2008-10-26 16:19 ` Zhichu Chen
  2008-10-26 16:46 ` Zhichu Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Zhichu Chen @ 2008-10-26 16:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Ruini,

Since \dosanhao has nothing to do with it's argument, why not just define like
\def\mybig
  {\switchtobodyfont[24pt]}

On Sun, Oct 26, 2008 at 3:55 PM, Ruini Xue <xueruini@gmail.com> wrote:
> I want to use a dedicated font size for the chapter title, so I wrote this
> piece of code:
>
> %%%%%%%%%%%%%%%%%%
> \def\mybig%
>  {\dosingleempty\dosanhao}
> \def\dosanhao[#1]%
>  {\switchtobodyfont[24pt]}
>
> \setuphead
>   [chapter]
>   [style=\mybig]
>
> \starttext
> \chapter{hello, world}
>
> \stoptext
> %%%%%%%%%%%%%%%%%
>
> However, the error is:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> ! Use of \dosanhao doesn't match its definition.
> \doifnextcharelse ...token =#1\def \!!stringa {#2}
>                                                  \def \!!stringb {#3}\futur...
> \@@kochapterstyle ->\mybig
>                           \bf
> \doconvertfont #1->\edef \p!defined {#1
>                                       }\ifx \p!defined \empty \else \@EA \d...
> \dosetfontattribute ...me #1#2\@EA \endcsname \fi
>                                                  \empty
> \doplaceheadnumbertext ...bute {\??ko #1}\c!style
>                                                  \dosetcolorattribute {\??k...
> \dodododoconstructhead ...{\finalsectionnumber }}}
>                                                  \writesection {#1}{#3}{#4}...
> l.11 \chapter{hello, world}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> If I replace the \mybig with \switchtobodyfont in style=xx, it works fine.
> What's the difference between  them? and why the former does not work?
>
> -- ruini
>
>
>
>
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
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] 3+ messages in thread

* Re: why does not this style work?
  2008-10-26 15:55 why does not this style work? Ruini Xue
  2008-10-26 16:19 ` Zhichu Chen
@ 2008-10-26 16:46 ` Zhichu Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Zhichu Chen @ 2008-10-26 16:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Ruini,

by the way, maybe this is what you wanted:

==================================
\unexpanded\def\mybig
   {\dosingleempty\dosanhao}
\unexpanded\def\dosanhao[#1]%
  {\iffirstargument
     \switchtobodyfont[#1]%
   \else
     \switchtobodyfont[24pt]%
   \fi}

\setuphead
  [chapter]
  [style={\mybig[44pt]}]

\starttext
\chapter{hello, world}
\stoptext
==================================

On Sun, Oct 26, 2008 at 3:55 PM, Ruini Xue <xueruini@gmail.com> wrote:
> I want to use a dedicated font size for the chapter title, so I wrote this
> piece of code:
>
> %%%%%%%%%%%%%%%%%%
> \def\mybig%
>  {\dosingleempty\dosanhao}
> \def\dosanhao[#1]%
>  {\switchtobodyfont[24pt]}
>
> \setuphead
>   [chapter]
>   [style=\mybig]
>
> \starttext
> \chapter{hello, world}
>
> \stoptext
> %%%%%%%%%%%%%%%%%
>
> However, the error is:
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> ! Use of \dosanhao doesn't match its definition.
> \doifnextcharelse ...token =#1\def \!!stringa {#2}
>                                                  \def \!!stringb {#3}\futur...
> \@@kochapterstyle ->\mybig
>                           \bf
> \doconvertfont #1->\edef \p!defined {#1
>                                       }\ifx \p!defined \empty \else \@EA \d...
> \dosetfontattribute ...me #1#2\@EA \endcsname \fi
>                                                  \empty
> \doplaceheadnumbertext ...bute {\??ko #1}\c!style
>                                                  \dosetcolorattribute {\??k...
> \dodododoconstructhead ...{\finalsectionnumber }}}
>                                                  \writesection {#1}{#3}{#4}...
> l.11 \chapter{hello, world}
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> If I replace the \mybig with \switchtobodyfont in style=xx, it works fine.
> What's the difference between  them? and why the former does not work?
>
> -- ruini
>
>
>
>
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>



-- 
Best Regards
Chen
----------------------------------------------------------------

          Zhi-chu Chen | Shanghai Synchrotron Radiation Facility
         No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China
             tel: 086 21 5955 3405 | zhichu.chen.googlepages.com
                                               | www.sinap.ac.cn
----------------------------------------------------------------
___________________________________________________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2008-10-26 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-26 15:55 why does not this style work? Ruini Xue
2008-10-26 16:19 ` Zhichu Chen
2008-10-26 16:46 ` Zhichu Chen

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