ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* how to do adaptation
@ 2019-10-14 13:16 Susanne G. Loeber
  2019-10-14 20:07 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Susanne G. Loeber @ 2019-10-14 13:16 UTC (permalink / raw)
  To: ntg-context

Hi,
I am looking for ways to adapt the layout and content of texts while
using ConTeXt. Put simple: show part of a text and sort these parts
based on data from the user and the author (.dat file). The biggest
problem is not knowing which part of the text will be first and how
many parts will be shown.

So far, I am trying to get a hang of \setupdocument
(https://wiki.contextgarden.net/Project_structure), \startmode
(https://wiki.contextgarden.net/Modes), \definecolor
(https://wiki.contextgarden.net/Color) and \defineparagraphs
(https://wiki.contextgarden.net/Command/defineparagraphs)

I hope there are more ways to create adaptation.

I would also like to know whether certain combination don't work
together. For example, I cannot seem to get \doifmodeelse to work
inside a \defineparagraphs environment.

\defineparagraphs[BLpar][n=2, frame=on]
\setupparagraphs [BLpar][1][width=\dimexpr.3\textwidth]

\starttext

% Working
\enablemode[asg]

\doifmodeelse{asg} {\par First sentence} {\par Second sentence}
\disablemode[asg]
\doifmodeelse{asg} {\par First sentence} {\par Second sentence}
\doifnotmode{asg} {\par Third sentence}

% Not working
\enablemode[one]

\startBLpar
\doifmodeelse{one} {First sentence} {Second sentence} \disablemode[one]
\BLpar
% \disablemode[one] %% not helping
TOP1 paragraphs
\stopBLpar
% \disablemode[one] %% needed to make the example work

\startBLpar
\doifmodeelse{one} {First sentence} {Second sentence}
\BLpar
TOP2 paragraphs
\stopBLpar

\startBLpar
\doifnotmode{one} {Third sentence}
\BLpar
TOP3 paragraphs
\stopBLpar

\stoptext


Kind regards,
Susanne G. Loeber
___________________________________________________________________________________
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] 2+ messages in thread

* Re: how to do adaptation
  2019-10-14 13:16 how to do adaptation Susanne G. Loeber
@ 2019-10-14 20:07 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2019-10-14 20:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Susanne G. Loeber

Susanne G. Loeber schrieb am 14.10.2019 um 15:16:
> Hi,
> I am looking for ways to adapt the layout and content of texts while
> using ConTeXt. Put simple: show part of a text and sort these parts
> based on data from the user and the author (.dat file). The biggest
> problem is not knowing which part of the text will be first and how
> many parts will be shown.
Can you ask a separate question for each individual problem.
> So far, I am trying to get a hang of \setupdocument
> (https://wiki.contextgarden.net/Project_structure), \startmode
> (https://wiki.contextgarden.net/Modes), \definecolor
> (https://wiki.contextgarden.net/Color) and \defineparagraphs
> (https://wiki.contextgarden.net/Command/defineparagraphs)
>
> I hope there are more ways to create adaptation.
>
> I would also like to know whether certain combination don't work
> together. For example, I cannot seem to get \doifmodeelse to work
> inside a \defineparagraphs environment.
When you enable or disable a mode the state is local to the current group,
e.g. the state at the begin of a environment will be the same at the end
and changes in the environment are local to it. In most document this isn't
a problem because you enable/disable a mode at the begin of the document
and use the state at the whole document.

In your case you want the changed state to remain after the environment
has ended, to do this you have to use \globalenablemode[...] and
\globaldisablemode[...].

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

end of thread, other threads:[~2019-10-14 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 13:16 how to do adaptation Susanne G. Loeber
2019-10-14 20:07 ` 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).