[texhax] Defining an intermediate bond

Philip G. Ratcliffe philip.ratcliffe at uninsubria.it
Thu Oct 16 12:27:45 CEST 2008


> The following code in my LaTeX documents provides proper 
> typesetting of 
> single/double/triple chemical bonds
> it is both robust and pleasing to the eye & can be used 
> inside/outside mathmode
> 
> However I need a new bond type, \bond4, which draws a bond 
> intermediate between single and double, say a line topped by 
> a dotted or dashed line 
> 
> So, suggestions please, for TeX commands in ????? below
> 
> \def\bond#1{\relax
>    \hbox \bgroup
>       \kern 0.1em
>       \setbox0=\hbox{X}%
>       \vbox to \ht0 \bgroup
>          \vss
>          \ifcase#1
>          \or
>             \hrule width 0.8em depth 0pt height 0.05em
>          \or
>             \hrule width 0.8em depth 0pt height 0.05em
>             \vskip 0.2em
>             \hrule width 0.8em depth 0pt height 0.05em
>          \or
>             \hrule width 0.8em depth 0pt height 0.05em
>             \vskip 0.2em
>             \hrule width 0.8em depth 0pt height 0.05em
>             \vskip 0.2em
>             \hrule width 0.8em depth 0pt height 0.05em
>          \or
>             ??????????????????????????????????????
>             \vskip 0.2em
>             \hrule width 0.8em depth 0pt height 0.05em
>          \fi
>          \vss
>          \egroup
>       \kern 0.1em
>       \egroup
>    }%
> ------------------------------------------------------
> \begin{document}
> ...
> $$\mathrm{C\bond4C}$$

Try

  \hbox to 0.8em{\kern-0.06em\hbox to 0.901em{\cleaders \hbox to
0.225em{\hss.\hss}\hfill}\hss}%

in place of the question marks - it's a variation on the theme of \dotfill.

Cheers,  Phil



More information about the texhax mailing list