[NTG-context] Re: How to set section title based on section content?

2024-03-09 Thread Wolfgang Schuster

Joel via ntg-context schrieb am 09.03.2024 um 16:01:

How to set section title based on section content?

I have a document that has some structures like this:

\starttext

\startsection[title={Animals}]

\event{\input knuth }

\stopsection

\startsection[title={Books}]

\event{\input knuth }

\stopsection

\stoptext

The event macro runs a bunch of conditionals, deciding which content to 
place inside the section. It places any one of neary 200 possible 
different types of content there.


Sadly when I wrote the code, I thought generic titles would be okay. Now 
I realize I need to be more specific, giving titles that match the 
content inside. I could move the section titles inside the \event macro, 
but it means rewriting ~200 other macros.


In other words, how do I define a section title by defining it somewhere 
in the content of the \event macro?


\starttext

\startsection[\whatistitle] %<-- would display "Neon Tetras"

\event{\thetitleis{Neon Tetras}\input knuth }

\stopsection

\startsection[\whatistitle] %<-- would display "Detective Stories"

\event{\thetitleis{Detective Stories}\input knuth }

\stopsection

\stoptext


When each section contains nothing except the \event command I would 
remove the section titles from the document itself and place them as 
part of the \event command.


\define[1]\Event
  {\startsection[title={#1}]
   \input{knuth}
   \stopsection}

\starttext

\Event{Neon Tetras}

\Event{Detective Stories}

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: \em issue in MkXL (2024.03.05 11:26)

2024-03-09 Thread Wolfgang Schuster

Pablo Rodriguez via ntg-context schrieb am 08.03.2024 um 19:39:

On 3/8/24 19:09, Wolfgang Schuster wrote:

Pablo Rodriguez via ntg-context schrieb am 08.03.2024 um 18:50:

[...]
LMTX gets b, c and d in slanted form.

LuaTeX gets only b and c in slanted form.

[...]
I get b and d in italic which is the expected output.


Sorry, my LuaTeX is getting slanted b and d ("c" was my typo).

But I see what was causing my issue (line from
~/texmf/texmf-local/cont-loc.mkxl):

   \enableexperiments[fonts.compact]

Which seeems weird to me. Or at least, I thought I read that Hans
enabled it by default in LMTX.


AFAIR Hans uses the setting in his own documents.


Then my question is whether this was caused by simply enabling compact
fonts or by doing it twice.


The results happen when you use compact mode and is a result of 
\glyphslant which keeps the value of the italic style even when you 
switch back to the upright style.


\enableexperiments[fonts.compact]

\definefontfamily[mainface][rm][TeX Gyre Termes]
  [it={style:regular, features:{default,slanted}},
   sl={style:regular, features:{default,slanted}}]

\setupbodyfont[mainface]

\starttext
\tf h\showcurrentfont[]\crlf
\it h\showcurrentfont[]\crlf
%\glyphslant\zerocount
\tf h\showcurrentfont[]\crlf
\it h\showcurrentfont[]
\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] How to set section title based on section content?

2024-03-09 Thread Joel via ntg-context
How to set section title based on section content?

I have a document that has some structures like this:

\starttext

\startsection[title={Animals}]

\event{\input knuth }

\stopsection

\startsection[title={Books}]

\event{\input knuth }

\stopsection

\stoptext

The event macro runs a bunch of conditionals, deciding which content to place 
inside the section. It places any one of neary 200 possible different types of 
content there.

Sadly when I wrote the code, I thought generic titles would be okay. Now I 
realize I need to be more specific, giving titles that match the content 
inside. I could move the section titles inside the \event macro, but it means 
rewriting ~200 other macros.

In other words, how do I define a section title by defining it somewhere in the 
content of the \event macro?

\starttext

\startsection[\whatistitle] %<-- would display "Neon Tetras"

\event{\thetitleis{Neon Tetras}\input knuth }

\stopsection

\startsection[\whatistitle] %<-- would display "Detective Stories"

\event{\thetitleis{Detective Stories}\input knuth }

\stopsection

\stoptext





___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] weird character normalization in the wiki

2024-03-09 Thread Pablo Rodriguez via ntg-context
Dear list,

https://wiki.contextgarden.net/Greek#Monotonic_and_Acute_Accent includes
two samples that should display the difference betweeen the monotonic
accent and the polytonic acute accent (which generate two different
characters for each such accented vowel).

Excluding other implications, these are two different characters. In
some fonts each pair of different characters for each accented letter
lead to the same glyph, in other fonts those glyphs are different.

This sample shows the difference (there should display two slightly
different accents [unless there is some character normalization on the
way]):

  \definefontfamily[mainface][rm][EBGaramond]
  \setupbodyfont[mainface, 500pt]
  \definecolor [tred]  [r=1,t=.5,a=1]
  \definecolor [tblue] [b=1,t=.25,a=1]
  \starttext
  \startTEXpage[offset=1ex]
  \startoverlay
{\color[tred]{Ά}}
{\color[tblue]{Ά}}
  \stopoverlay
  \stopTEXpage
  \stoptext

The problem that I have is tricky. Thanks to character normalization (at
least in Firefox), searching for "á" will also find "a" (unless “Match
diacritics” is enabled).

I’m afraid the wiki is performing some character normalization, which
renders samples in
https://wiki.contextgarden.net/Greek#Monotonic_and_Acute_Accent useless.

Searching for "Ά" in https://wiki.contextgarden.net/Greek should give
not more than 4 matches (not case-sensitive and with “Match diacritics”
[or similar filter for your browser] enabled). I‘m afraid I get none.

While editing the article searching for "Ά" (case-insensitive and not
normalizing characters), gave me 4 matches, but only in the source (no
ocurrence was found in the preview).

Once changes are saved, "Ά" occurrences dissapear (since they seem to be
normalized).

Sure, they may be a workaround to type codepoints instead of characters
(such as with \utfchar{0x1fbb}, but wouln’t it be possible to disable
that character normalization in the wiki?

Many thanks for your help,

Pablo
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___