ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: Jorge Manuel <desdechaves@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: Seeking Advice on Electron Configuration Notation in ConTeXt
Date: Wed, 30 Oct 2024 00:22:57 +0100	[thread overview]
Message-ID: <086ea6cd-3b59-44ae-8236-0c31a5dfc346@xs4all.nl> (raw)
In-Reply-To: <b1cba8a2-8d43-4524-bb2e-34dcbf24c3bf@Spark>

On 10/29/2024 11:33 PM, Jorge Manuel wrote:
> Hello everyone,
> 
> I’m searching for an efficient way to represent electronic 
> configurations in subshell and orbital notation within ConTeXt. I found 
> similar examples discussed on StackExchange, which you can see here:
> 
> Atomic electronic configuration with small boxes <https:// 
> tex.stackexchange.com/questions/372581/atomic-electronic-configuration- 
> with-small-boxes/372598#372598>: https://tex.stackexchange.com/ 
> questions/372581/atomic-electronic-configuration-with-small- 
> boxes/372598#372598 <https://tex.stackexchange.com/questions/372581/ 
> atomic-electronic-configuration-with-small-boxes/372598#372598>
> 
> Box and arrow notation of writing electron configuration
> https://tex.stackexchange.com/questions/616989/box-and-arrow-notation- 
> of-writing-electron-configuration <https://tex.stackexchange.com/ 
> questions/616989/box-and-arrow-notation-of-writing-electron-configuration>
> 
> Ideally, I’d like to use a package similar to atoms.sty for this 
> purpose. Does anyone know of a straightforward approach to achieve this 
> in ConTeXt?
> 
> Thank you very much for any guidance or examples!

It's no problem to come up with something as this kind of stuff is 
rather trivial but (as always with these things in context) the question 
is "what is the nicest interface?".

\definesymbol[electronu][\m{\upharpoonleft}]
\definesymbol[electrond][\m{\downharpoonright}]
\definesymbol[electronb][\m{\upharpoonleft\downharpoonright}]

\starttexdefinition protected electrons#1
     \dontleavehmode
     \doloopovermatch {.} {#1} {
         \inframed
           [width=\lineheight,height=\lineheight]
           {\symbol[electron##1]}
         \hskip-\linewidth
     }
     \unskip
\stoptexdefinition

\electrons{bddb}

\electrons{uddbuud}

Don't look at other packages, just think about what is best and most 
natural for the field, reading the source, and intreface wise fits into 
context (looks ok in the source, not like some hack). The above is just 
an example. We can always make clever parsers in lua but we need specs 
and examples first. Like, do you want to color specific electrons? Maybe 
this is enough:

\definesymbol[electronB][\m{\red \symbol[electronb]}]
\definesymbol[electronD][\m{\blue\symbol[electrond]}]

\electrons{uddBbuDd}

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 / 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
___________________________________________________________________________________

  reply	other threads:[~2024-10-29 23:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5e4e292b-6d11-4b37-b00d-2e1aefdfe4b6@Spark>
2024-10-29 22:33 ` [NTG-context] " Jorge Manuel
2024-10-29 23:22   ` Hans Hagen [this message]
2024-10-30  0:21     ` [NTG-context] " Bruce Horrocks
2024-10-30 10:14       ` Hans Hagen
2024-10-30 10:25       ` Hans Hagen
2024-10-30 20:35         ` Wolfgang Schuster
2024-10-30 20:41           ` Hans Hagen
2024-10-30 21:07             ` Wolfgang Schuster
2024-10-30 21:45               ` Hans Hagen
2024-10-31 11:34                 ` Bruce Horrocks
2024-10-31 12:13                   ` Hans Hagen via ntg-context
2024-10-31 15:25                   ` Jorge Manuel
2024-10-31 15:28                     ` Hans Hagen via ntg-context
2024-10-31 15:47                   ` Henning Hraban Ramm
2024-10-31 16:39                     ` vm via ntg-context
2024-10-31 17:02                       ` Henning Hraban Ramm
2024-10-31 17:38                         ` vm via ntg-context
2024-10-31 18:01                           ` Henning Hraban Ramm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=086ea6cd-3b59-44ae-8236-0c31a5dfc346@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=desdechaves@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).