ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Concerning dictionaries. glossaries and related in ConTeXt
@ 2021-11-26 11:22 Jairo A. del Rio via ntg-context
  2021-11-26 12:24 ` Hans Hagen via ntg-context
  2021-11-26 13:15 ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 4+ messages in thread
From: Jairo A. del Rio via ntg-context @ 2021-11-26 11:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jairo A. del Rio


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

Hi, list. I want to know how I should handle alphabetically sorted data in
ConTeXt. So far, I'm abusing registers in order to get simple glossaries,
but I prefer to manage data with tools such as JabRef rather than manually
typing entries inside a document. I attach an example of what I achieved:

\unprotect
\mainlanguage[\s!es]
\enableexperiments[fonts.compact]
\setupbodyfont[computer-modern-unicode]
\setuphead[chapter]
  [\c!alternative=\v!middle]
\defineregister[Russian]
\setupregister[Russian]
  [\c!expansion=\v!yes,
   \c!balance=\v!no,
   \c!n=2,
   \c!command=\Words,
   \c!pagenumber=\v!no,
   \c!language=\s!ru]
\def\Ruso[#1]%
  {\begingroup
   \getdummyparameters[word=,category=,meaning=,#1]%
   \Russian[\dummyparameter{word}]%
   {\bold{\dummyparameter{word}}
   \italic{\dummyparameter{category}}
   \dummyparameter{meaning}}%
   \endgroup}
\protect
\Ruso
    [word=исчисление,
     category=n. neutr.,
     meaning=cálculo]
\Ruso
    [word=вероятность,
     category=n. fem.,
     meaning=probabilidad]
\Ruso
    [word=обозначать,
     category=v.,
     meaning=denotar]
\Ruso
    [word=область,
     category=n. fem,
     meaning={región, área}]
\Ruso
    [word=событие,
     category=n. neutr.,
     meaning=evento]
\Ruso
    [word=определение,
     category=n. neutr.,
     meaning=definición]
\Ruso
    [word=знание,
     category=n. neutr,,
     meaning=conocimiento]
\Ruso
    [word=бесконечно,
     category=adv.,
     meaning=infinitamente]
\Ruso
    [word=сборник,
     category=n. masc.,
     meaning={colección, compilación, compendio}]
\Ruso
    [word=неравенство,
     category=n. neutr.,
     meaning=desigualdad]
\starttext
\starttitle[title=Ruso-español]
\placeRussian
\stoptitle
\stoptitle
\stoptext

Reading the manuals, I find that the publication mechanism for bibliography
kinda fits my needs (using ConTeXt to sort and type data generated via
external software) but, unlike registers, it doesn't seem to include
options for alphabetical headers. Is it fine to keep using registers in
this case? Is there a better mechanism for this task in ConTeXt? Thank you
in advance.

Best regards,

Jairo

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

[-- Attachment #2: Type: text/plain, Size: 493 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] 4+ messages in thread

* Re: Concerning dictionaries. glossaries and related in ConTeXt
  2021-11-26 11:22 Concerning dictionaries. glossaries and related in ConTeXt Jairo A. del Rio via ntg-context
@ 2021-11-26 12:24 ` Hans Hagen via ntg-context
  2021-11-26 13:15 ` Hans Hagen via ntg-context
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-26 12:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

On 11/26/2021 12:22 PM, Jairo A. del Rio via ntg-context wrote:
> Hi, list. I want to know how I should handle alphabetically sorted data 
> in ConTeXt. So far, I'm abusing registers in order to get simple 
> glossaries, but I prefer to manage data with tools such as JabRef rather 
> than manually typing entries inside a document. I attach an example of 
> what I achieved:
> 
> \unprotect
> \mainlanguage[\s!es]
> \enableexperiments[fonts.compact]
> \setupbodyfont[computer-modern-unicode]
> \setuphead[chapter]
>    [\c!alternative=\v!middle]
> \defineregister[Russian]
> \setupregister[Russian]
>    [\c!expansion=\v!yes,
>     \c!balance=\v!no,
>     \c!n=2,
>     \c!command=\Words,
>     \c!pagenumber=\v!no,
>     \c!language=\s!ru]
> \def\Ruso[#1]%
>    {\begingroup
>     \getdummyparameters[word=,category=,meaning=,#1]%
>     \Russian[\dummyparameter{word}]%
>     {\bold{\dummyparameter{word}}
>     \italic{\dummyparameter{category}}
>     \dummyparameter{meaning}}%
>     \endgroup}
> \protect
> \Ruso
>      [word=исчисление,
>       category=n. neutr.,
>       meaning=cálculo]
> \Ruso
>      [word=вероятность,
>       category=n. fem.,
>       meaning=probabilidad]
> \Ruso
>      [word=обозначать,
>       category=v.,
>       meaning=denotar]
> \Ruso
>      [word=область,
>       category=n. fem,
>       meaning={región, área}]
> \Ruso
>      [word=событие,
>       category=n. neutr.,
>       meaning=evento]
> \Ruso
>      [word=определение,
>       category=n. neutr.,
>       meaning=definición]
> \Ruso
>      [word=знание,
>       category=n. neutr,,
>       meaning=conocimiento]
> \Ruso
>      [word=бесконечно,
>       category=adv.,
>       meaning=infinitamente]
> \Ruso
>      [word=сборник,
>       category=n. masc.,
>       meaning={colección, compilación, compendio}]
> \Ruso
>      [word=неравенство,
>       category=n. neutr.,
>       meaning=desigualdad]
> \starttext
> \starttitle[title=Ruso-español]
> \placeRussian
> \stoptitle
> \stoptitle
> \stoptext
> 
> Reading the manuals, I find that the publication mechanism for 
> bibliography kinda fits my needs (using ConTeXt to sort and type data 
> generated via external software) but, unlike registers, it doesn't seem 
> to include options for alphabetical headers. Is it fine to keep using 
> registers in this case? Is there a better mechanism for this task in 
> ConTeXt? Thank you in advance.
you can also use:

     \setregisterentry
       [Russian]
       [keys={\dummyparameter{word}},
        entries={\bold{\dummyparameter{word}}
         \italic{\dummyparameter{category}}
         \dummyparameter{meaning}}]%

no need for c! v! s! unless you make a multi-userinterface style

anyway, makes me wonder if we should have a horizontal register variant

\setupregister
   [Russian][2]
   [textstyle=bold]

\setupregister
   [Russian][3]
   [textstyle=italic]

so that we keep stuff on one line

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Concerning dictionaries. glossaries and related in ConTeXt
  2021-11-26 11:22 Concerning dictionaries. glossaries and related in ConTeXt Jairo A. del Rio via ntg-context
  2021-11-26 12:24 ` Hans Hagen via ntg-context
@ 2021-11-26 13:15 ` Hans Hagen via ntg-context
  2021-11-26 13:58   ` Jairo A. del Rio via ntg-context
  1 sibling, 1 reply; 4+ messages in thread
From: Hans Hagen via ntg-context @ 2021-11-26 13:15 UTC (permalink / raw)
  To: Jairo A. del Rio via ntg-context, Wolfgang Schuster; +Cc: Hans Hagen

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

Hi,

kind of like this but maybe we need to go setups as we do with lists and 
sections adn such

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

[-- Attachment #2: regtest.tex --]
[-- Type: text/plain, Size: 4223 bytes --]

\pushoverloadmode \unprotect

\newconditional\c_strc_registers_traditional \settrue\c_strc_registers_traditional

\permanent\protected\def\startregisterentry#1% todo: level
  {\typo_injectors_check_register
   \begingroup
   \dostarttagged\t!registerentry\empty
   \global\setconstant\c_strc_registers_page_state\zerocount
   \ifconditional\c_strc_registers_traditional
     \hangindent\d_strc_registers_hangindent
     \hangafter \c_strc_registers_hangafter
   \else
     \namedregisterparameter\currentnestedregister\c!left\relax
   \fi
   \typo_injectors_mark_register}

\permanent\protected\def\stopregisterentry
  {\ifconditional\c_strc_registers_traditional
     \endgraf
   \else
     \namedregisterparameter\currentnestedregister\c!right\relax
   \fi
   \global\setconstant\c_strc_registers_page_state\zerocount
   \dostoptagged
   \endgroup}


\permanent\protected\def\usenestedregisterstyleandcolor#1#2% will change
  {\useregisterstyleandcolor#1#2%
   % how about style
   \ifconditional\c_strc_registers_text_interaction
     \ifempty\currentcolorparameter \else
       \resetinteractionparameter\c!color
       \resetinteractionparameter\c!contrastcolor
     \fi
   \fi}

\permanent\protected\def\startregisterentries#1% depth
  {\ifconditional\c_strc_registers_traditional
     \endgraf
   \fi
   \begingroup
   \c_strc_register_level\ifnum#1>\c_strc_registers_maxlevel\c_strc_registers_maxlevel\else#1\fi\relax
   \dostarttagged\t!registerentries\empty
   \pushmacro\currentregister % bah
   \edef\currentregister{\currentregister:\number\c_strc_register_level}%
   \let\currentnestedregister\currentregister
   \usenestedregisterstyleandcolor\c!textstyle\c!textcolor
   \ifnum\c_strc_register_level>\plusone
     \advance\leftskip\d_strc_registers_distance\relax
   \fi
   \d_strc_registers_hangindent\registerparameter\c!distance\relax
   \c_strc_registers_hangafter \plusone
   \ifconditional\c_strc_registers_traditional
     \blank[\v!samepage]%
   \fi
   \popmacro\currentregister}

\def\c!textalternative{textalternative}

\appendtoks
    \doifelse{\registerparameter\c!textalternative}\v!horizontal
      \setfalse\settrue\c_strc_registers_traditional
\to \everysetupregister

\protect \popoverloadmode

\starttext

\mainlanguage[es]
\enableexperiments[fonts.compact]
\setupbodyfont[dejavu] % computer-modern-unicode]
\setuphead[chapter]
  [alternative=middle]
\defineregister[Russian]
\setupregister[Russian]
  [expansion=yes,
   balance=no,
   n=2,
   command=\Words,
   pagenumber=no,
   language=ru]

\def\Ruso[#1]%
  {\begingroup
   \getdummyparameters
     [word=,
      category=,
      meaning=,
      #1]%
   \setregisterentry
     [Russian]
     [keys={\dummyparameter{word}},
      entries:1={\dummyparameter{word}},
      entries:2={\dummyparameter{category}},
      entries:3={\dummyparameter{meaning}}]%
   \endgroup}

\setupregister
  [Russian]
  [textalternative=horizontal,
   distance=0pt]

\setupregister
  [Russian][2]
  [distance=0pt,
   textstyle=bold,
   left={, }]

\setupregister
  [Russian][3]
  [distance=0pt,
   textstyle=italic,
   left={, }]


\starttext

\Ruso
    [word=исчисление,
     category=n. neutr.,
     meaning=cálculo]
\Ruso
    [word=вероятность,
     category=n. fem.,
     meaning=probabilidad]
\Ruso
    [word=обозначать,
     category=v.,
     meaning=denotar]
\Ruso
    [word=область,
     category=n. fem,
     meaning={región, área}]
\Ruso
    [word=событие,
     category=n. neutr.,
     meaning=evento]
\Ruso
    [word=определение,
     category=n. neutr.,
     meaning=definición]
\Ruso
    [word=знание,
     category=n. neutr,,
     meaning=conocimiento]
\Ruso
    [word=бесконечно,
     category=adv.,
     meaning=infinitamente]
\Ruso
    [word=сборник,
     category=n. masc.,
     meaning={colección, compilación, compendio}]
\Ruso
    [word=неравенство,
     category=n. neutr.,
     meaning=desigualdad]

\starttitle[title=Ruso-español]
    \placeRussian
\stoptitle

\stoptext

[-- Attachment #3: Type: text/plain, Size: 493 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] 4+ messages in thread

* Re: Concerning dictionaries. glossaries and related in ConTeXt
  2021-11-26 13:15 ` Hans Hagen via ntg-context
@ 2021-11-26 13:58   ` Jairo A. del Rio via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: Jairo A. del Rio via ntg-context @ 2021-11-26 13:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jairo A. del Rio


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

Nice. Looks interesting and, if I understand correctly, entries are
open-ended, which turns out to be useful to customize dictionaries. It
would be a profitable addition! Thank you very much.

Regards,

Jairo

El vie, 26 de nov. de 2021 a la(s) 08:16, Hans Hagen via ntg-context (
ntg-context@ntg.nl) escribió:

> Hi,
>
> kind of like this but maybe we need to go setups as we do with lists and
> sections adn such
>
> Hans
>
>
> -----------------------------------------------------------------
>                                            Hans Hagen | PRAGMA ADE
>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
>
> -----------------------------------------------------------------___________________________________________________________________________________
> 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
>
> ___________________________________________________________________________________
>

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

[-- Attachment #2: Type: text/plain, Size: 493 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] 4+ messages in thread

end of thread, other threads:[~2021-11-26 13:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 11:22 Concerning dictionaries. glossaries and related in ConTeXt Jairo A. del Rio via ntg-context
2021-11-26 12:24 ` Hans Hagen via ntg-context
2021-11-26 13:15 ` Hans Hagen via ntg-context
2021-11-26 13:58   ` Jairo A. del Rio via ntg-context

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