Re: [NTG-context] new upload

2022-01-23 Thread kauśika via ntg-context
On Sunday, January 23, 2022 1:28:52 PM IST hanneder--- via ntg-context wrote:
> When using these fonts regularly, one notices very erratic formatting
> phenomena that must have to
> do with the Devanagarī font, or its interaction with (Xe)TeX. Perhaps
> this is the same phenomenon
> seen from the user side.
> 
> In my case things improved when I switched to Adishila (in XeTeX):
> 
> \newfontfamily\sanskritfont[Script=Devanagari,Mapping=RomDev,Scale=1.45]{Adi
> shilaSan}
> 
> This is, to my taste, the nicest Sanskrit font, but it is difficult to
> decide between Adishila and
> Shobhika.

Adishila is a great font too and comes in many more styles (letter press, etc) 
than Shobhika. However the latter has more conjuncts. For example:
ङ्क्ल 
ङ्ग्ध्व
appear as halant forms in Adishila while they are proper conjuncts in 
Shobhika. Of course, these are rare conjuncts, so …

Anyway, in ConTeXt Adishila works well with 
features=devanagari-one

> I cannot say how thrilled I am about the Indic support, thanks a lot
> to Kaushika!

It is very much an ongoing effort. I am working on some proper documentation 
soon to serve as a guide for fonts (what works, what doesn't, fixes, hacks, 
etc). But mostly it is in a very usable state (for the most part).

I am very much a non-expert and helping in very little ways. It is Hans in the 
background who is doing all the really important things with the code, design 
and engineering of the system. So really, we should thank him!

kauśika


___
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
___


Re: [NTG-context] new upload

2022-01-22 Thread kauśika via ntg-context
On Saturday, January 22, 2022 12:58:05 AM IST Hans Hagen via ntg-context 
wrote:
> - initial indic transliteration support .. recent indic (font)
> experiences and transliteration tricks will be eplained by kauśika

Recently when we were troubled by incorrect rendering of certain conjuncts in 
malayalam, Hans added a new font-feature. More below*, but first some 
background: from my testing, the main reason for the problems with fonts seems 
to come from the varied interpretations and/or implementations of OTF 
specification. To add to this complexity there are two script tags (v1, v2 in 
OTF and -one, -two in ConTeXt) for each writing system (script). While there 
are fonts which work very well right away many others have issues and the 
feature was added to somewhat alleviate these issues.

*The feature is 'indic'. It has two aspects: 'movematra' and 'conjuncts'.

conjuncts takes values: mixed | continue | quit | auto
movematra takes values: default | leftbeforebase | auto

By default 
indic=auto 
for indic scripts. So this "should work" in most cases. 

In case there are issues, I have seen that the following approach usually 
yields best result in debugging:
 • try to switch between the -one and -two version of the features (i.e. use 
the v1 or v2 OTF script tag): some fonts may have some rules defined only under 
one of the script tags. (I am not an expert in fonts but with my testing of 
free fonts I have seen this). 
 • if that does not fix (the particular issue), revert to a working feature and 
then set the indic feature as indic={movematra=default,conjuncts=quit} to see
 • Please see:
 https://www.mail-archive.com/ntg-context@ntg.nl/msg99691.html
 issues usually have a pattern (across languages/scripts so some hacks might 
work)

For conjuncts, 'mixed' and 'auto' are synonymous. Setting conjuncts=mixed 
ensures that for some fonts conjuncts with the reph forms are rendered 
correctly. (This was tested with a relatively new font in malayalam using the 
mlm2 script tag).

For problematic fonts, if one can identify which conjuncts work under which 
script tag and/or with what settings for indic, then, using ConTeXt feature 
sets one can easily fix rendering in documents by doing, for instance
 {\feature[=][devanagari-two] …}, and/or
 {\feature[=][devanagari-one] …} accordingly
 See the comprehensive wiki page: 
 https://wiki.contextgarden.net/Featuresets 
for more details on how such feautresets might be built and applied.

Now, a brief note on the transliterations macros. First, one specifies that 
indic transliteration is desired with:
\usetransliteration[indic]

Now, one can transliterate sanskrit to and from various forms by using

\transliterate[scheme]{ … }
where scheme is one of:
• iast to deva
• deva to iast
• deva to mlym
which are respectively the following schemes :
• IAST → Devanagari
• Devanagari → IAST
• Devanagari → Malayalam
More schemes will be added in the near future for various other indic scripts 
as well. Currently there is only support for sanskrit language, which we can 
extend to other languages (wherever the script allows).

Additionally, there is also 
\definetransliteration[…][…]
which can be used to define a specific transliteration block.

So, one just sets vector accordingly to get the desired transliteration block. 
Please see below a minimal example for both:

% SOF
\usetransliteration[indic]
\definetransliteration
[MyIASTtoDeva]
[color=blue,
 style=bold,
 language=sa,
 vector={iast to deva}]

\starttransliteration[MyIASTtoDeva]%[color=green]   can set a new color here 
idaṁ śarīraṁ kaunteya kṣetramityabhidīyate.
etadyo vetti taṁ prāhuḥ kṣetrajña iti tadvidaḥ. 
\stoptransliteration

\transliteration[MyIASTtoDeva]{idaṁ śarīraṁ kaunteya kṣetramityabhidīyate}

% or directly 
\transliterate[iast to deva]{idaṁ śarīraṁ kaunteya kṣetramityabhidīyate}
% EOF

kauśika


___
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
___


Re: [NTG-context] new upload

2022-01-22 Thread kauśika via ntg-context
On Saturday, January 22, 2022 3:55:12 PM IST Hans Hagen via ntg-context wrote:
> Is there a font out there that supports all these scripts in one font?

Shobhika font is a free font that has some of the largest number of glyphs 
(i.e has many conjuncts) for the Devanagari script.
https://github.com/Sandhi-IITBombay/Shobhika

The font also has a good Latin component based on PT Serif. This Latin part 
has good support for the roman (IAST) transliteration for Sanskrit. But 
strictly only the IAST spec character for Sanskrit are available.

It also has glyphs for some commonly used mathematical symbols.

Noto Serif Devanagari is also decent for just Devanagari (not sure of the IAST 
part).

As for Sans typefaces, Mukta Devanagari is a free font:
https://github.com/EkType/Mukta

Of these, Shobhika has the best conjunct coverage. I will shortly update the 
wiki with a much more exhaustive list and report here.
 
kauśika


___
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
___


Re: [NTG-context] new upload

2022-01-21 Thread kauśika via ntg-context
On Saturday, January 22, 2022 1:07:22 PM IST Richard Mahoney via ntg-context 
wrote:
> I'm wondering, how have you found the new
> input/translation method with "Shobhika Regular," a font a few of us
> might be keen to use?

I have myself been using Shobhika with relative success for quite some time 
now. Due to its great conjunct support, it is a good font as well. In ConTeXt 
it is advisable to use it with the deva script tag. So, with 
features=devanagari-one

Please note that it is missing some IAST glyphs
ḻ (=ळ) l̥ ,are just two examples.
[For roman transliteration (IAST), I have seen that the Brill font has very 
good glyph coverage but it does not have vedic accents IIRC.]

However, there is one (minor) issue in the devanagari side of things:
See here (long read): 
https://www.mail-archive.com/ntg-context@ntg.nl/msg99691.html

TLDR: there are one set of conjuncts which don't work right-away, namely the 
र-based conjunct forms with the following consonant: छ, ट, ठ, ड, ढ with post-
base and below-base vowel marks, namely  ी, ा, ौ,  ु  and   ू 
For example छ्री will not render as expected in ConTeXt (with devanagari-one). 
To 
fix this one can temporarily switch to the devanagari-two feature set as 
follows
{\feature[=][devanagari-two] छ्री}
which can be wrapped into a macro.

Otherwise, all the features work well.

Best,
kauśika


___
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
___


Re: [NTG-context] new upload

2022-01-21 Thread kauśika via ntg-context
On Saturday, January 22, 2022 11:36:57 AM IST Aditya Mahajan via ntg-context 
wrote:
> I finally thought that I'd try out how typesetting Hindi works with ConTeXt,
> but I don't get the correct output.
> 
> Input: आदित्य (See complete attached file)
> 
> Output: See attached.
> 
> Note that ि  "vowel sign I" should be attached to  द "letter  da" but it is
> attached to  य "letter ya". Do I need to enable a particular feature?

Unfortunately some fonts don't work properly in ConTeXt. Noto Sans Devanagari 
is one of them. The accompanying serif font (Noto Serif Devanagari) works just 
fine (mostly, there are problems with that as well). 

In this specific case, there does not seem to be any fix (at least that I could 
find).

I am trying to test many fonts and come up with a list of fonts which work, 
partially work, don't work, etc. and fixes wherever possible.

kauśika


___
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
___


Re: [NTG-context] Align table (framed) top

2022-01-04 Thread kauśika via ntg-context
On Tuesday, January 4, 2022 4:24:22 PM IST Mikael Sundqvist via ntg-context 
wrote:
> What is the correct way to get the last line, "The last foo",
> to automatically be placed below the second table?

There is only one table in your example.

> I still want the first line of the table to align vertically with the text
> Bar.

If you don't need a table, the following achieves the same:

\starttext
Foofoo

Bar
\framed[width=2cm,align=normal,location=top]{this is a long sentence}\par
The last foo
\stoptext

Best,
kauśika


___
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
___


Re: [NTG-context] Resetcounter in custom enumeration environment

2022-01-03 Thread kauśika via ntg-context
On Monday, January 3, 2022 4:34:50 PM IST kauśika wrote:
> If 'Exercises' and 'Answers to exercises' are some head structure (assuming
> unnumbered since they are so in your example):
> \definehead[exercises][subject]
> \definehead[answers][subject]
> then you can simply do
> \setupenumeration[uppgift]
> [alternative=left,
>  width=1cm,
>  text=,
>  after={\blank[2*big]},
>  way=bysubject]
> and ConTeXt will automatically restart the number at every new subject
> block.

In this case you would have something like :

\startexercise[title={Exercises}]
\startuppgift
  first exercise
\stopuppgift

\startuppgift
  second exercise
\stopuppgift
\stopexercise

\startanswers
\startuppgift
  answer to first exercise
\stopuppgift

\startuppgift
  answer to second exercise
\stopuppgift
\stopanswers

kauśika


___
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
___


Re: [NTG-context] Resetcounter in custom enumeration environment

2022-01-03 Thread kauśika via ntg-context
On Monday, January 3, 2022 4:21:27 PM IST Jan-Erik Hägglöf via ntg-context 
wrote:
> I want a simple solution to reset the counter so it achieves the following
> result:
> 
> Exercises
> 
> 1 First exercise
> 
> 2 Second exercise
> 
> Answers to exercises
> 
> 1 Answers to first exercise
> 
> 2 Answers to second exercise

After all, one can do
\resetcounter[uppgift] 
before 'Answers to exercises'.

If 'Exercises' and 'Answers to exercises' are some head structure (assuming 
unnumbered since they are so in your example):
\definehead[exercises][subject]
\definehead[answers][subject]
then you can simply do 
\setupenumeration[uppgift]
[alternative=left,
 width=1cm,
 text=,
 after={\blank[2*big]},
 way=bysubject]
and ConTeXt will automatically restart the number at every new subject block.

Best,
kauśika


___
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
___


Re: [NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2022-01-01 Thread kauśika via ntg-context
On Saturday, January 1, 2022 3:45:36 PM IST Hans Hagen wrote:
> \starteffect is kind of old (comes from mkii), but you could use the
> pseudo font feature effect in mkiv / lmtx which then makes a real font
> instance instead of mixing in some pdf magic

Thanks for the explanations Hans! Happy new year wishes to you!

kauśika


___
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
___


Re: [NTG-context] Asking context to switch to a different font for a single character in many places

2022-01-01 Thread kauśika via ntg-context
On Saturday, January 1, 2022 1:37:49 PM IST Ajith R wrote:
> This doesn't print the open box. If I remove the definefontfamily
> command or define font family using only Latin Modern, open box is
> printed, but not the title.
> 
> What am I missing?

Try with the following:

\definefallbackfamily
  [malayalam]
  [serif]
  [TeX Gyre Pagella][range=controlpictures,force=yes]
\definefontfamily
  [malayalam]
  [serif]
  [RIT Rachana][features=malayalam-two]

\setupbodyfont[malayalam]


I have tested that this works on my system. Ensure that the TeX Gyre Pagella 
font is available on your system (ConTeXt ships with a copy of this font). If 
it still does not work check the log file for any messages regarding fallback 
font.

kauśika


___
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
___


Re: [NTG-context] Malayalam conjuncts

2021-12-31 Thread kauśika via ntg-context
On Friday, December 31, 2021 6:22:15 PM IST Ajith R via ntg-context wrote:
> The conjuncts that are not formed
> correctly are those where the second component is ര U+0D30, followed by
> a symbol that is shown on the right side of the conjunct viz ാ U+0D3E,
> ി U+0D3F, ീ U+0D40, ു  U+0D41, ൂ U+0D42. If no symbols follow, or
> symbols follow on the left or on both sides, the conjunct is well
> formed.In the minimum working example given 5 is well formed, while the
> first conjunct in 6 is well formed and second ill formed conjunct.

I have been using ConTeXt to typeset documents in several Indic languages and 
have run into similar issues (in many languages). Please see this for a 
similar issue in some conjuncts for Devanagari:
https://www.mail-archive.com/ntg-context@ntg.nl/msg99691.html

For what its worth, I have not had issues with some fonts while issues with 
others persist. Some of these issues we can work around as I have pointed out 
in the above posting.

In almost all cases I encountered no issues while using Xe(La)Tex. Based on 
some advise from Hans and reading about these OTF features and their 
implementations in Indic fonts, I think these issues might be due to 
differences in implementation. [Not entirely sure since I am a novice]. My 
guess is that Harfbuzz (which is what Xe(La)TeX uses by default) uses some 
heuristics to work out these conjuncts (?!).

To answer your specific question regarding the conjuncts in the given words you 
have to use some Unicode hacking to get what you want in ConTeXt.

In each of the following ZWS refers to the Unicode character (zero-width space 
U+200B)

1. ശ്രീ 
This is typeset correctly by writing  
ശ്ര + 
ZWS (U+200B) + 
ീ

2. അശ്രു
Typeset correctly with
അശ്ര + 
ZWS (U+200B) + 
​ൂ

3. ശുശ്രൂഷ
Typeset correctly with
ശുശ്ര +
ZWS (U+200B) + 
ൂ +
ഷ

4. പ്രാസം
Typeset correctly with
പ്ര + 
ZWS (U+200B) + 
ാ +
സം

5. പ്രേയസി (rendered correctly as entered; no hacks necessary)

6. പ്രോഗ്രാം
Typeset correctly with
പ്രൊ +
ഗ്ര + 
ZWS (U+200B) +
ാ +‌
ം
where the last character is the Malayalam Anusvara.

Consider yet another example:
സാന്ദ്രാനന്ദാഅവബൊധാത്മകമ്

Here the 'ന്ദ്രാ' conjunct is not typeset in ConTeXt. To fix this I do 
ന്ദ്ര +
ZWS (U+200B) +
​ാ

This is what I have been doing to ensure correct typesetting of Malayalam and 
other Indic languages in ConTeXt. Honestly, it is inconvenient since the .tex 
files containing Unicode are no longer sanitary. However, ConTeXt has so many 
remarkable features that the very thought of having to go back to (Xe)LaTeX 
(just for harfbuzz rendering) causes me immense pain. As far as I am 
concerned, in every other way ConTeXt simply has no match in the (Xe)LaTeX 
world. In my usage of ConTeXt for my academic work (in English with lots of 
mathematics) I have encountered no issues. Even if I did there was always some 
legitimate (non-hacky) fix for it. For me personally, the rendering in Indic 
languages is the only pain point with ConTeXt (which I am willing to live 
with).

So I am willing to live with the drawbacks till the day they are hopefully 
fixed. Anyway, I hope you can use these fixes temporarily. For example, if your 
editor supports it, you can replace all glyphs with this issue with the 
corresponding recipe involving ZWS.

Dear Hans and other developers of ConTeXt, LuaTeX, 
If you happen to see this please look into the font system (where it concerns 
Indic systems). The present issue is very similar to the one I posted about 
earlier:
https://www.mail-archive.com/ntg-context@ntg.nl/msg99691.html
I have described the issue and the hacks to fix it the best I can. In case 
there is any other information that I can provide please let me know.

Best,
kauśika


___
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
___


Re: [NTG-context] Asking context to switch to a different font for a single character in many places

2021-12-31 Thread kauśika via ntg-context
On Friday, December 31, 2021 6:30:26 PM IST Ajith R via ntg-context wrote:
> Is it possible to instruct Context to use a font in general, except for
> a single character?

Since you have mentioned elsewhere that you have \definefontfamily[…] you can 
set a fallback font family with \definefallbackfamily[…] and choose a font 
which has the character you want:

⋮
\definefallbackfamily[mainfont][rm][Latin Modern]
[range=controlpictures,force=yes]
\definefontfamily[mainfont] […]
⋮
\setupbodyfont[mainfont]

The 'controlpictures' Unicode block (≡ U+2400 – U+243F) contains the character 
you want.

kauśika


___
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
___


Re: [NTG-context] aligning Malayalam horizontally across column

2021-12-31 Thread kauśika via ntg-context
On Friday, December 31, 2021 6:25:01 PM IST Ajith R via ntg-context wrote:
> The problems are that - a) the group, with the two short paras get
> separated into different columns and sometimes pages. How can I prevent
> that? In other words, how do I tell Context that this should be treated
> as cohesive unit? b) The horizontal space doesn't align across columns.
> This probably is because the different conjuncts in each of these lines
> have different heights. How can I ask Context to treat each of these
> cohesive units as having the same height?

Your example is not clear enough for me to address b). I think I understand 
what problem you have described in a).

If you want to explicitly typeset paragraphs into a columnar format, use 
'paragraphs':

\defineparagraphs[mypar][n=5]
\setupparagraphs[mypar][1][width=…]
\setupparagraphs[mypar][2][width=…]
\setupparagraphs[mypar][3][width=…]
\setupparagraphs[mypar][4][width=…]
\setupparagraphs[mypar][5][width=…]

Now, you can do
\startmypar
this is the first column
\mypar
and here is the second column
\mypar
the third column is here
\mypar
and the fourth column is here
\mypar
and the last (fifth) column
\stopmypar

[If you end up using this you will have to "denote columns" in your script-
generated file by using \mypar]

Look into the options of \setupparagraphs for more details (there is a height 
option as well). If the height varies due to the formation of conjuncts, I 
think you are better off using "(natural) tables" :
https://wiki.contextgarden.net/TABLE
In particular, setting align=lohi for the two columns concerned should work. 
Again, your example is not clear enough for me to suggest much.

kauśika


___
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
___


Re: [NTG-context] Malayalam character overlapping with footnote number

2021-12-31 Thread kauśika via ntg-context
On Friday, December 31, 2021 6:28:30 PM IST Ajith R via ntg-context wrote:
> One character,  ഼ U+0D3C, when used in \footnote[഼ ]{the foot note},
> overlaps with the footnote number. How can I ask Context to provide
> extra space between the character and the footnote number?

The optional argument to \footnote is a (cross-)reference to the footnote 
itself. If you want to adjust spacing look set the appropriate options for 
\setupnotation[footnote]

kauśika


___
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
___


Re: [NTG-context] Malayalam hyphenation

2021-12-31 Thread kauśika via ntg-context
On Friday, December 31, 2021 6:26:36 PM IST Ajith R via ntg-context wrote:
> In most paragraphs, the sentences go beyond the right margin. How can I ask
> Context to break the word at the margin, without hyphenating every word
> manually?

Malayalam hyphenation may be invoked by setting the language appropriately. 
For quite some time now, ConTeXt ships with the patterns for Malayalam. Simply 
write 
\language[ml]
in your document head.

kauśika


___
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
___


Re: [NTG-context] Table of Contents Header?

2021-12-30 Thread kauśika via ntg-context
On Friday, December 31, 2021 7:53:08 AM IST Michael Urban via ntg-context 
wrote:
> Or is there some more foolproof way of getting those headers into the right
> place?

Here is something I quickly wrote up:

First, define some labels for the columns of the ToC —
\definesynonyms[toclabel][toclabel][\TOCLabel]
\setupsynonyms[toclabel][textstyle=\sc]
\toclabel{TOCNumberLabel}{Chapter}
\toclabel{TOCTitleLabel}{Title}
\toclabel{TOCPageLabel}{Page}
Then compute the width of the chapter-number and page-number labels
\setwidthof\TOCLabel{TOCNumberLabel}\to\TOCNumberLabelWidth
\setwidthof\TOCLabel{TOCPageLabel}\to\TOCPageLabelWidth
and define a 'paragraphs' block with 3 columns with a separation of 1em between 
each column
\defineparagraphs
[TOCpar]
[n=3]
\setupparagraphs
[TOCpar]
[each]
[distance=1em]
Set the width of the first column to the width of the label (and center chapter 
number)
\setupparagraphs
[TOCpar]
[1]
[width=\dimexpr\TOCNumberLabelWidth,
 align=middle]
and similarly for the third column (and center the page number)
\setupparagraphs
[TOCpar]
[3]
[width=\dimexpr\TOCPageLabelWidth,
 align=middle]
Finally, wrap it all up in the macro 
\define[3]\TOCEntry{%
\startTOC
#1 \TOCpar #2 \TOCpar #3%
\stopTOC%
}
and indicate the command to use in the setup 
\setuplist
[chapter]
[alternative=interactive,
 command=\TOCEntry,
 after=\endgraf] % required

The ToC along with column labels is placed with 
\TOCLabel{TOCNumberLabel}%
\hfill\TOCLabel{TOCTitleLabel}\hfill%
\TOCLabel{TOCPageLabel}
\placecontent

Of course, you can choose to not set the 'align' keys in \setupparagraphs[TOC] 
if center alignment is not required/desired.

Hope this helps.

Best,
kauśika


___
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
___


Re: [NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2021-12-30 Thread kauśika via ntg-context
On Friday, December 31, 2021 7:43:21 AM IST kauśika wrote:
> Dear list,
> 
> I have the following graphic
> 
> \startuseMPgraphic{TitleGraphic}
> draw outlinetext.b (\MPstring{TitleText})
> (withcolor "titlefg")
> (withcolor "titleoutline");
> \stopuseMPgraphic
> 
> which I tried to use as follows to produce a stylized 'title' head:
> 
> \setupMPtext{TitleText}{%
> \starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
> \useMPgraphic{TitleGraphic}
> 
> [colors "titlefg" and "titleoutline" are set using \definecolor]
> 
> But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does
> not work with 'outlinetext' method in the MPgraphic. I have verified that
> the desired effect is produced using 'textext' method instead. But in that
> case I have to cheat (i.e draw twice; once with blownup) to get the text
> outline.
> 
> Now, if I write instead
> 
> \setupMPtext{TitleText}{%
> \kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
> \useMPgraphic{TitleGraphic}
> 
> then the desired effect is produced. As such, my purpose is served well by
> using \kerncharacters.
> 
> Nonetheless, I request your kind help in understanding why this is happening
> and/or if I am doing something wrong.
> 
> Thanks,
> kauśika

Please read '\setupMPtext' as '\setMPtext' in the above. Apologies for the 
typos.

kauśika


___
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
___


[NTG-context] [MetaFun] Trying to understand outlinetext, 'stretch' effect and \kerncharacters

2021-12-30 Thread kauśika via ntg-context
Dear list,

I have the following graphic

\startuseMPgraphic{TitleGraphic}
draw outlinetext.b (\MPstring{TitleText})
(withcolor "titlefg")
(withcolor "titleoutline");
\stopuseMPgraphic

which I tried to use as follows to produce a stylized 'title' head:

\setupMPtext{TitleText}{%
\starteffect[stretch]\bfc\namedstructurevariable{title}{title}\stopeffect}
\useMPgraphic{TitleGraphic}

[colors "titlefg" and "titleoutline" are set using \definecolor]

But, the 'stretch' effect caused by \starteffect[stretch]…\stopeffect does not 
work with 'outlinetext' method in the MPgraphic. I have verified that the 
desired effect is produced using 'textext' method instead. But in that case I 
have to cheat (i.e draw twice; once with blownup) to get the text outline.

Now, if I write instead 

\setupMPtext{TitleText}{%
\kerncharacters[0.15]\bfc\namedstructurevariable{title}{title}}
\useMPgraphic{TitleGraphic}

then the desired effect is produced. As such, my purpose is served well by 
using \kerncharacters.

Nonetheless, I request your kind help in understanding why this is happening 
and/or if I am doing something wrong.

Thanks,
kauśika


___
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
___


Re: [NTG-context] Enumeration numbering in the left margin

2021-11-20 Thread kauśika via ntg-context
On Saturday, November 20, 2021 8:34:52 PM IST Wolfgang Schuster wrote:
> Provide a complete minimal example to increase your chances for an answer.
> 
> Wolfgang

I was inspecting this just now and figured out that in one of the 
\defineenumeration I was inheriting another enumeration block which had the 
width parameter set.

So I rewrote the definition without inheriting anything. Now, 
alternative=leftmargin works just as expected. No problems.

My apologies to all for the oversight.

kauśika


___
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
___


Re: [NTG-context] Enumeration numbering in the left margin

2021-11-20 Thread kauśika via ntg-context
On Saturday, November 20, 2021 11:31:24 AM IST kauśika wrote:
> Dear list,
> 
> I have the following enumeration block.
> 
> \defineenumeration[verse]
> \setupenumeration[verse]
>   [alternative=leftmargin,
>text=,
>width=fit,
>distance=1em,
>way=bysection]
> 
> I actually want to (flush) left align the enumeration's number inside the
> left margin and give it a blue color. But even if I have
>\setupmargindata[inleftmargin][color=bblue4,align=flushleft]
> there is no alignment, no color.
> 
> However, if I do
> \setupenumeration[verse]
>   [alternative=leftmargin,
>text=,
>width=\leftmarginwidth,
>headcolor=bblue4,
>distance=0em,
>way=bysection]
> I am able to get the desired effect.
> 
> Is this the 'correct' way to do it? I mean to ask, am I doing something
> wrong with \setupmargindata or is this expected behaviour.
> 
> Thanks,
> kauśika

Also 
\setupenumeration[verse]
  [alternative=left,
   text=,
   headcommand=\inleftmargin,
   distance=0em,
   way=bysection]
along with
   \setupmargindata[inleftmargin][color=bblue4,align=flushleft]
achieves the required effect. 

So then am I using alternative=leftmargin incorrectly?

Thanks,
kauśika


___
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
___


[NTG-context] Enumeration numbering in the left margin

2021-11-19 Thread kauśika via ntg-context
Dear list,

I have the following enumeration block.

\defineenumeration[verse]
\setupenumeration[verse]
  [alternative=leftmargin,
   text=,
   width=fit,
   distance=1em,
   way=bysection]

I actually want to (flush) left align the enumeration's number inside the left 
margin and give it a blue color. But even if I have 
   \setupmargindata[inleftmargin][color=bblue4,align=flushleft]
there is no alignment, no color.

However, if I do 
\setupenumeration[verse]
  [alternative=leftmargin,
   text=,
   width=\leftmarginwidth,
   headcolor=bblue4,
   distance=0em,
   way=bysection]
I am able to get the desired effect.

Is this the 'correct' way to do it? I mean to ask, am I doing something wrong 
with \setupmargindata or is this expected behaviour.

Thanks,
kauśika


___
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
___


Re: [NTG-context] Achieving the effect of \overset outside math mode

2021-11-11 Thread kauśika via ntg-context
On Friday, November 12, 2021 11:04:20 AM IST Wolfgang Schuster via ntg-context 
wrote:
> Aditya Mahajan via ntg-context schrieb am 12.11.2021 um 05:45:
> > On Fri, 12 Nov 2021, kauśika via ntg-context wrote:
> >> Dear list,
> >> 
> >> I don't have a MWE per se, but as the title suggests, I want to be able
> >> to
> >> achieve the effect of \overset outside math mode. As I understand,
> >> \overset
> >> itself is implemented using \mathop and \limits.
> >> 
> >> Currently to achieve this I have defined some macros using \offset thus :
> >> \define[1]\pabv{\dontleavehmode\offset[width=0em,y=-16pt,x=3pt]{#1}}
> >> Unfortunately, I have to hard code the x values. So I have define several
> >> such macros with different offsets. Not an elegant solution, but it is
> >> what I could muster.
> >> 
> >> So, my objective is to place a smaller piece of text above another larger
> >> piece of text so that the text above is centered w.r.t the text below.
> > 
> > Wolfgang has a ruby module, which provides this feature.
> > 
> > https://ctan.org/pkg/context-ruby
> > 
> > Doc:
> > https://ctan.org/tex-archive/macros/context/contrib/context-ruby/doc/cont
> > ext/third/ruby
> Use the built-in \ruby function, the module broke at some point after
> Hans added a similar function himself and I never fixed my own code
> afterwards.
> 
> 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
> 
> ___

Thanks Aditya and Wolfgang! I am now using the \ruby function in LMTX to 
achieve this.

Thanks,
kauśika


___
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
___


Re: [NTG-context] Achieving the effect of \overset outside math mode

2021-11-11 Thread kauśika via ntg-context
On Friday, November 12, 2021 11:04:20 AM IST Wolfgang Schuster via ntg-context 
wrote:
> Aditya Mahajan via ntg-context schrieb am 12.11.2021 um 05:45:
> > On Fri, 12 Nov 2021, kauśika via ntg-context wrote:
> >> Dear list,
> >> 
> >> I don't have a MWE per se, but as the title suggests, I want to be able
> >> to
> >> achieve the effect of \overset outside math mode. As I understand,
> >> \overset
> >> itself is implemented using \mathop and \limits.
> >> 
> >> Currently to achieve this I have defined some macros using \offset thus :
> >> \define[1]\pabv{\dontleavehmode\offset[width=0em,y=-16pt,x=3pt]{#1}}
> >> Unfortunately, I have to hard code the x values. So I have define several
> >> such macros with different offsets. Not an elegant solution, but it is
> >> what I could muster.
> >> 
> >> So, my objective is to place a smaller piece of text above another larger
> >> piece of text so that the text above is centered w.r.t the text below.
> > 
> > Wolfgang has a ruby module, which provides this feature.
> > 
> > https://ctan.org/pkg/context-ruby
> > 
> > Doc:
> > https://ctan.org/tex-archive/macros/context/contrib/context-ruby/doc/cont
> > ext/third/ruby
> Use the built-in \ruby function, the module broke at some point after
> Hans added a similar function himself and I never fixed my own code
> afterwards.
> 
> 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
> 
> ___

Thanks Aditya and Wolfgang! After following Rik's initial response, I am now 
using the \ruby function in LMTX to achieve this.

Thanks,
kauśika


___
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
___


Re: [NTG-context] Achieving the effect of \overset outside math mode

2021-11-11 Thread kauśika via ntg-context
On Friday, November 12, 2021 8:32:17 AM IST Rik Kabel via ntg-context wrote:
> Search for defineruby on the mailing list archives.
> 
> --
> Rik

Dear Rik,

First of all, thank you for the quick response! Wow! With the very first search 
result itself, I was able to achieve what I wanted.

ConTeXt is a gift that keeps on giving! Simply fantastic! This made my day!

Many thanks, 
kauśika


___
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
___


Re: [NTG-context] Achieving the effect of \overset outside math mode

2021-11-11 Thread kauśika via ntg-context
On Friday, November 12, 2021 8:17:24 AM IST kauśika wrote:
> Dear list,
> 
> I don't have a MWE per se, but as the title suggests, I want to be able to 
> achieve the effect of \overset outside math mode. As I understand, \overset 
> itself is implemented using \mathop and \limits. 
> 
> Currently to achieve this I have defined some macros using \offset thus :
> \define[1]\pabv{\dontleavehmode\offset[width=0em,y=-16pt,x=3pt]{#1}}
> Unfortunately, I have to hard code the x values. So I have define several 
> such 
> macros with different offsets. Not an elegant solution, but it is what I 
> could 
> muster.
> 
> So, my objective is to place a smaller piece of text above another larger 
> piece of text so that the text above is centered w.r.t the text below.
> 
> Please advise.
> 
> Thanks,
> kauśika

I was able to get some working examples using the second answer here:
https://tex.stackexchange.com/questions/42456/creating-non-math-mode-substitutes-for-overset-and-underset-not-dependent-on-t

But, I was just curious if there is a more elegant ConTeXt specific way to 
achieve this.

Thanks,
kauśika


___
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
___


[NTG-context] Achieving the effect of \overset outside math mode

2021-11-11 Thread kauśika via ntg-context
Dear list,

I don't have a MWE per se, but as the title suggests, I want to be able to 
achieve the effect of \overset outside math mode. As I understand, \overset 
itself is implemented using \mathop and \limits. 

Currently to achieve this I have defined some macros using \offset thus :
\define[1]\pabv{\dontleavehmode\offset[width=0em,y=-16pt,x=3pt]{#1}}
Unfortunately, I have to hard code the x values. So I have define several such 
macros with different offsets. Not an elegant solution, but it is what I could 
muster.

So, my objective is to place a smaller piece of text above another larger 
piece of text so that the text above is centered w.r.t the text below.

Please advise.

Thanks,
kauśika


___
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
___