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
___________________________________________________________________________________