You can use TikZ
with the overlay
option and a correct anchor. That would look like this:
\documentclass{article}
\usepackage{tikz}
\newcommand\mybox[2][]{\tikz[overlay]\node[fill=blue!20,inner sep=2pt, anchor=text, rectangle, rounded corners=1mm,#1] {#2};\phantom{#2}}
\begin{document}
\noindent
this is some text \mybox[fill=blue!20]{box} text\\
this is some text box text
\end{document}
You can specify extra options (like I have done here for the color). By using the overlay
option and the text
anchor we ensure correct placement and no influence on spacing. The phantom
is added to get the normal spacing for the content of the box. This is the result of the example code:
Edit: To show that the vertical spacing is not affected either, consider the following:
\documentclass{article}
\usepackage{tikz}
\newcommand\mybox[2][]{\tikz[overlay]\node[fill=blue!20,inner sep=2pt, anchor=text, rectangle, rounded corners=1mm,#1] {#2};\phantom{#2}}
\begin{document}
\begin{minipage}{0.4\textwidth}
\noindent
this is some text \mybox[fill=blue!20]{box} text\\
this is some text box text
\end{minipage}
\begin{minipage}{0.4\textwidth}
\noindent
this is some text box text\\
this is some text box text
\end{minipage}
\end{document}
Which results in:
As far as I understand, you dislike TikZ, but accept any LaTeX packages.
In the following solution all parameters are exemplary, as I don't know the proper usage of your orbital. You can certainly customize them.
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{ulem}
\usepackage{graphics}
\begin{document}
\def\orbud{\scalebox{3}{\sout{$\;\upharpoonleft \,\downharpoonright\;$}\quad } }
\def\orbu{\scalebox{3}{\sout{$\;\;\upharpoonleft \;\;$}\quad }}
All parameters are to customize
\bigskip
\begin{tabular}{c}
\orbud \orbu\\[2em]
\orbu \orbu \orbu
\end{tabular}
\end{document}
Best Answer
I adapted the solution from the attached link, to draw an
\fbox
instead of\underline
. In addition, I had to add\mathord
to make the\fbox
-es across the definitions to have equal widths. (not sure if I did this right though)The commands:
\up
: up spin electron only\dwn
: down spin electron only\updwn
: up and down spin electrons (filled)\emp
: no electrons (unfilled)Edit:
Updated code for the boxes to be attached to each other, with equal line widths. Usage is still the same as above. The lines are thicker now because two
fbox
-es are being drawn. If you want to stick to the oldfbox
line width, uncomment the\setlength\fboxrule{0.2pt}
line.