ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: 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 21:35:27 +0100	[thread overview]
Message-ID: <ac22ae55-f282-cc1c-94dd-a169dc2558a9@gmail.com> (raw)
In-Reply-To: <4fcac5ba-c08d-4752-a152-513c4e346d18@xs4all.nl>

Hans Hagen schrieb am 30.10.2024 um 11:25:
> On 10/30/2024 1:21 AM, Bruce Horrocks wrote:
>>
>>
>>> On 29 Oct 2024, at 23:22, Hans Hagen <j.hagen@xs4all.nl> wrote:
>>>
>>> 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
>>> -----------------------------------------------------------------
>>
>> Also, as per the images in the StackExchange question, try adding 
>> this to the previous example:
>>
>> %% start %%
>> Nitrogen: \vbox to 
>> \lineheight{\placeontopofeachother{\electrons{b}}{\tfx 1s}}
>>       \vbox to \lineheight{\placeontopofeachother{\electrons{b}}{\tfx 
>> 2s}}
>>       \vbox to 
>> \lineheight{\placeontopofeachother{\electrons{uuu}}{\tfx 2p}}
>> %% end %%
>>
>> As Hans says, a parser is relatively easy, so the above can be made 
>> much less verbose if the layout is suitable. I think the message is: 
>> you don’t need to blindly copy \subshells if there is something 
>> easier to enter with less chance of error.
>
> A bit more low level but we're in educational mode anyway:
>
> \starttexdefinition protected electrons#1#2

I would make the second argument optional.

\starttexdefinition protected tolerant electrons #=#=

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
___________________________________________________________________________________

  reply	other threads:[~2024-10-30 20:39 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   ` [NTG-context] " Hans Hagen
2024-10-30  0:21     ` Bruce Horrocks
2024-10-30 10:14       ` Hans Hagen
2024-10-30 10:25       ` Hans Hagen
2024-10-30 20:35         ` Wolfgang Schuster [this message]
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=ac22ae55-f282-cc1c-94dd-a169dc2558a9@gmail.com \
    --to=wolfgang.schuster.lists@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).