ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* structureuservariable in ToC
@ 2018-01-14 20:44 Henning Hraban Ramm
  2018-01-23 20:16 ` Henning Hraban Ramm
  2018-01-23 20:24 ` Wolfgang Schuster
  0 siblings, 2 replies; 8+ messages in thread
From: Henning Hraban Ramm @ 2018-01-14 20:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Now, my second issue with user variables:

"""
\define[1]\ChapterTocEntry{%
  \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }%
  #1%
  \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}

\setuplist[chapter][textcommand=\ChapterTocEntry]

\starttext
\completelist[chapter][criterium=all]

\startchapter[
  title={The Use of Typefaces}][%
  author={Hermann Zapf},
  subtitle={Ein zapfiges Zitat}]

\input zapf

\stopchapter

\startchapter[
  title={Sheep and Goats}][%
  author={Siegfried Tufte},
  subtitle={Tofte Tufte-Zitat}]

\input tufte

\stopchapter

\stoptext
"""

I’m trying to get author and subtitle into the ToC (while in the content, subtitle goes to the margin and author to the end of the chapter).
But in this example, both are empty (but not empty enough for doifnotempty), while in my actual project I always get author and subtitle from the first chapter.
I guess this is an expansion problem?


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

* Re: structureuservariable in ToC
  2018-01-14 20:44 structureuservariable in ToC Henning Hraban Ramm
@ 2018-01-23 20:16 ` Henning Hraban Ramm
  2018-01-23 20:24 ` Wolfgang Schuster
  1 sibling, 0 replies; 8+ messages in thread
From: Henning Hraban Ramm @ 2018-01-23 20:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Some hint on that would be nice.
Is it maybe related to the "Registers and getparameters" problem?
I tried a few things WRT expansion, but it seems like I didn’t find the right command in the right place.

Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

Am 2018-01-14 um 21:44 schrieb Henning Hraban Ramm <texml@fiee.net>:

> Now, my second issue with user variables:
> 
> """
> \define[1]\ChapterTocEntry{%
>  \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }%
>  #1%
>  \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
> 
> \setuplist[chapter][textcommand=\ChapterTocEntry]
> 
> \starttext
> \completelist[chapter][criterium=all]
> 
> \startchapter[
>  title={The Use of Typefaces}][%
>  author={Hermann Zapf},
>  subtitle={Ein zapfiges Zitat}]
> 
> \input zapf
> 
> \stopchapter
> 
> \startchapter[
>  title={Sheep and Goats}][%
>  author={Siegfried Tufte},
>  subtitle={Tofte Tufte-Zitat}]
> 
> \input tufte
> 
> \stopchapter
> 
> \stoptext
> """
> 
> I’m trying to get author and subtitle into the ToC (while in the content, subtitle goes to the margin and author to the end of the chapter).
> But in this example, both are empty (but not empty enough for doifnotempty), while in my actual project I always get author and subtitle from the first chapter.
> I guess this is an expansion problem?
> 
> 
> Greetlings, Hraban
> ---
> http://www.fiee.net
> http://wiki.contextgarden.net
> GPG Key ID 1C9B22FD

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

* Re: structureuservariable in ToC
  2018-01-14 20:44 structureuservariable in ToC Henning Hraban Ramm
  2018-01-23 20:16 ` Henning Hraban Ramm
@ 2018-01-23 20:24 ` Wolfgang Schuster
  2018-01-24  7:51   ` Henning Hraban Ramm
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2018-01-23 20:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 444 bytes --]


> Henning Hraban Ramm <mailto:texml@fiee.net>
> 14. Januar 2018 um 21:44
> Now, my second issue with user variables:
>
> """
> \define[1]\ChapterTocEntry{%
> \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf 
> }%
> #1%
> \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
To access the variables in a list you have to use the 
\structurelistuservariable command.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1452 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: structureuservariable in ToC
  2018-01-23 20:24 ` Wolfgang Schuster
@ 2018-01-24  7:51   ` Henning Hraban Ramm
  2018-01-24 15:42     ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Henning Hraban Ramm @ 2018-01-24  7:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2018-01-23 um 21:24 schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:

>> Henning Hraban Ramm 14. Januar 2018 um 21:44
>> Now, my second issue with user variables:
>> 
>> """
>> \define[1]\ChapterTocEntry{%
>> \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }%
>> #1%
>> \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
> To access the variables in a list you have to use the \structurelistuservariable command.

Thank you, now I have:

\define[1]\ChapterTocEntry{%
  \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }%
  #1%
  \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}

But author/subtitle still don’t show up in the ToC.

Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

* Re: structureuservariable in ToC
  2018-01-24  7:51   ` Henning Hraban Ramm
@ 2018-01-24 15:42     ` Wolfgang Schuster
  2018-01-24 18:05       ` Henning Hraban Ramm
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2018-01-24 15:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 541 bytes --]


> Henning Hraban Ramm <mailto:texml@fiee.net>
> 24. Januar 2018 um 08:51
>
> Thank you, now I have:
>
> \define[1]\ChapterTocEntry{%
> \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf 
> }%
> #1%
> \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
>
> But author/subtitle still don’t show up in the ToC.

You’re still using the wrong command to print the variables.

\setuplist --> \structurelistuservariable
\setuphead --> \structureuservariable

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1570 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: structureuservariable in ToC
  2018-01-24 15:42     ` Wolfgang Schuster
@ 2018-01-24 18:05       ` Henning Hraban Ramm
  2018-01-24 18:18         ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Henning Hraban Ramm @ 2018-01-24 18:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Am 2018-01-24 um 16:42 schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:

>> Henning Hraban Ramm 24. Januar 2018 um 08:51
>> 
>> Thank you, now I have:
>> 
>> \define[1]\ChapterTocEntry{%
>> \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }%
>> #1%
>> \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
>> 
>> But author/subtitle still don’t show up in the ToC.
> 
> You’re still using the wrong command to print the variables.
> 
> \setuplist --> \structurelistuservariable
> \setuphead --> \structureuservariable

Aaargh, I’m blind, sorry, I changed only half of the occurrencies.

Everything’s ok now, _if_ author and subtitle are defined.

But \structurelistuservariable{something} seems to be never empty in the sense of \ifempty - I get those \crlf also for chapters without i.e. where I didn’t define those or set them to {}.


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

[-- Attachment #2: marginsubtitle.tex --]
[-- Type: application/octet-stream, Size: 2862 bytes --]

% chapter titling should look like:

%
% Chapter title           subtitle
%                         subtitle
%                         in the margin
%
% here starts the text
%
%

% table of contents should look like:

% Author Name
% Chapter title                 123
% subtitle


\usemodule[visual]

\setuplayout[
    backspace=21mm,
    topspace=12mm,
    width=117mm,
    height=270mm,
    header=15mm,
    headerdistance=2mm,
    footer=5mm,
    footerdistance=4mm,
    rightmargindistance=5mm,
    rightmargin=55mm,
    leftmargindistance=5mm,
    leftmargin=55mm,
    %leftmargin=0mm,
    outermargindistance=5mm,
    outermargin=55mm,
    innermargin=0mm,
    grid=yes,
    location=doublesided,
]
\setuppagenumbering[alternative=doublesided]
\setupalign[flushleft,hz,hanging]

\definebodyfontenvironment[9pt][interlinespace=4mm]
\definebodyfontenvironment[12pt][interlinespace=5mm]
\setupbodyfontenvironment[default][em=italic]
\definehighlight[emph][style=\em]
\definefont[ChapterTitleFont][Serif at 28pt][10mm]
\definefont[SectionTitleFont][Serif at 10pt][4mm]

\setupindenting[yes, 2.5em, first] %, next]


\setuphead[
  align={flushleft,nothyphenated},
	tolerance=verytolerant,
	grid=line,
	number=no]

\setupheadertexts[][part]
\define[2]\PartCmd{\relax} % part is only used as rubric
\setuphead[part][
  placehead=yes,
  location=none,
  page=no,
  number=no,
  command=\PartCmd,
]

\define[2]\ChapterCmd{%
  \inouter{\framed[frame=off,align=flushleft]{%
    %\startlinecorrection
    \switchtobodyfont[rm,12pt] % interlinespacing should also adapt
    \structureuservariable{subtitle}}%
    %\stoplinecorrection
    }
  \framed[width=\textwidth,frame=off,align=flushleft]{\ChapterTitleFont #2}
}
\setuphead[chapter][
  page=right,
  style={\ChapterTitleFont},
  interlinespacing=10mm,
  grid=both,
  before={},
  %after={\inouter{\structureuservariable{subtitle}}},
  command=\ChapterCmd,
  ]

\setuphead[section][
  page=no,
  style={\tf},
  before={\blank[small]\testpage[4]},
  after={\blank[small]},
  ]


% Table of contents

\define[1]\ChapterTocEntry{%
  \doifnotempty{%
    \structurelistuservariable{author}%
    }{%
    \structurelistuservariable{author}\crlf%
    }#1\doifnotempty{%
    \structurelistuservariable{subtitle}%
    }{%
    \crlf\structurelistuservariable{subtitle}%
    }%
  }
\setuplist[chapter][%
  margin=2em,
  textcommand=\ChapterTocEntry]

\starttext

\placelist[part,chapter][criterium=all]

\startpart[title={My Rubric}]

\dorecurse{3}{
  \startchapter[title={C \fakewords{2}{10}}]%
  [subtitle={S \fakewords{5}{10}},author={A\fakewords{2}{3}}]

    \fakewords{10}{100}

    \dorecurse{3}{
    \startsection[title={S \fakewords{1}{10} \recurselevel}]
      \fakewords{10}{300}

    \stopsection}

  \stopchapter}

\startchapter[title={Without author and subtitle}]

\input zapf

\stopchapter

\stoppart

\stoptext

[-- Attachment #3: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: structureuservariable in ToC
  2018-01-24 18:05       ` Henning Hraban Ramm
@ 2018-01-24 18:18         ` Wolfgang Schuster
  2018-01-24 22:05           ` Henning Hraban Ramm
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2018-01-24 18:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1073 bytes --]

> Henning Hraban Ramm <mailto:texml@fiee.net>
> 24. Januar 2018 um 08:51
>
> Thank you, now I have:
>
> \define[1]\ChapterTocEntry{%
> \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf 
> }%
> #1%
> \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
>
> But author/subtitle still don’t show up in the ToC.
Use the \doiftext check or replace \structurelistuservariable (which is 
never empty because
it is tagged) with \rawstructurelistuservariable (which isn’t tagged and 
contains only the content
of the variable).


\define[3]\SectionListCommand
   {\doiftextelse{\structurelistuservariable{test}}{YES}{NO}%
    \endgraf}

% \define[3]\SectionListCommand
%   {\doifsomethingelse{\rawstructurelistuservariable{test}}{YES}{NO}%
%    \endgraf}

\setuplist[section][alternative=command,command=\SectionListCommand]

\starttext

\placelist[section]

\startsection[title=X][test=A] \stopsection

\startsection[title=Y] \stopsection

\startsection[title=Z][test=B] \stopsection

\stoptext


Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2200 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: structureuservariable in ToC
  2018-01-24 18:18         ` Wolfgang Schuster
@ 2018-01-24 22:05           ` Henning Hraban Ramm
  0 siblings, 0 replies; 8+ messages in thread
From: Henning Hraban Ramm @ 2018-01-24 22:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2018-01-24 um 19:18 schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:

>> Henning Hraban Ramm 24. Januar 2018 um 08:51
>> 
>> Thank you, now I have:
>> 
>> \define[1]\ChapterTocEntry{%
>> \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }%
>> #1%
>> \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
>> 
>> But author/subtitle still don’t show up in the ToC.
> Use the \doiftext check or replace \structurelistuservariable (which is never empty because
> it is tagged) with \rawstructurelistuservariable (which isn’t tagged and contains only the content
> of the variable).

Thank you so much! You saved my day/night/toc ;)


Grüßlinge, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

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

end of thread, other threads:[~2018-01-24 22:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-14 20:44 structureuservariable in ToC Henning Hraban Ramm
2018-01-23 20:16 ` Henning Hraban Ramm
2018-01-23 20:24 ` Wolfgang Schuster
2018-01-24  7:51   ` Henning Hraban Ramm
2018-01-24 15:42     ` Wolfgang Schuster
2018-01-24 18:05       ` Henning Hraban Ramm
2018-01-24 18:18         ` Wolfgang Schuster
2018-01-24 22:05           ` Henning Hraban Ramm

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