为纽曼投影添加了一只眼睛

为纽曼投影添加了一只眼睛

为了更好地理解纽曼投影中的视觉轴,我想添加一个象征性的眼睛(在搜索时,我发现了这段代码:眼睛的符号(寻找图书馆))如下图所示,位于图的中间 在此处输入图片描述

用 绘制分子后\chemfig,眼睛的添加是在右下方完成的,而不是像希望的那样在轴上完成的:

    \documentclass[border=3mm]{standalone}
\usepackage{chemmacros}
\usepackage{chemfig}

\newcommand*\lateraleye{%
       \scalebox{0.15}{
    \tikzset{every picture/.style={line width=0.75pt}} 
    \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
    \draw  [line width=1.5]  (300,100.33) .. controls (326,122) and (352,135) .. (378,139.33) .. controls (352,143.67) and (326,156.67) .. (300,178.33) ;
    \draw  [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ,fill opacity=1 ] (308.94,116.33) .. controls (313.87,116.33) and (317.86,125.51) .. (317.85,136.83) .. controls (317.84,148.15) and (313.84,157.33) .. (308.91,157.33) .. controls (303.99,157.32) and (300,148.14) .. (300.01,136.82) .. controls (300.02,125.5) and (304.02,116.32) .. (308.94,116.33) -- cycle ;
    \draw  [draw opacity=0][line width=1.5]  (314.84,166.6) .. controls (311.87,164.64) and (309.14,162.18) .. (306.76,159.24) .. controls (295.12,144.82) and (296.6,124.33) .. (310.07,113.45) .. controls (311.48,112.32) and (312.96,111.33) .. (314.5,110.49) -- (331.14,139.55) -- cycle ; \draw  [line width=1.5]  (314.84,166.6) .. controls (311.87,164.64) and (309.14,162.18) .. (306.76,159.24) .. controls (295.12,144.82) and (296.6,124.33) .. (310.07,113.45) .. controls (311.48,112.32) and (312.96,111.33) .. (314.5,110.49) ;
    \draw  [fill={rgb, 255:red, 255; green, 255; blue, 255 }  ,fill opacity=1 ] (304.43,124.2) .. controls (306.09,124.25) and (307.32,128.01) .. (307.18,132.6) .. controls (307.05,137.19) and (305.59,140.88) .. (303.93,140.83) .. controls (302.27,140.78) and (301.03,137.02) .. (301.17,132.43) .. controls (301.31,127.83) and (302.76,124.15) .. (304.43,124.2) -- cycle ;
    \end{tikzpicture}
    }\,}
\begin{document}

    \chemfig{H-[:60]{\color{purple}C}(<[:140,,,,green]{\color{green}H})(<:[:115,,,,magenta]{\color{magenta}H})-{\color{cyan}C}(<[:-75,,,,blue]{\color{blue}OH})(<:[:-45,,,,brown]{\color{brown}H})-[:60,,,,red]{\color{red}H}}
    \lateraleye{}
    \end{document}

在此处输入图片描述

我怎样才能移动图中的眼睛\chemfig

答案1

您可以将 chemfig 放在\vcentered中\hbox

在此处输入图片描述

\[\vcenter{\hbox{\chemfig{H-[:60]{\color{purple}C}(<[:140,,,,green]{\color{green}H})(<:[:115,,,,magenta]{\color{magenta}H})-{\color{cyan}C}(<[:-75,,,,blue]{\color{blue}OH})(<:[:-45,,,,brown]{\color{brown}H})-[:60,,,,red]{\color{red}H}}}}
\lateraleye{}\]

无关,但眼睛的代码过于复杂。这是一个更简单的版本:

在此处输入图片描述

\documentclass{article}
\usepackage{chemfig}

\newcommand{\eyel}{40} % increase (up to 45) for shorter eyelashes
\colorlet{eyecolor}{green!60!black}

\newcommand*\lateraleye{%
  \scalebox{0.4}[.5]{\tikz[line cap=round, line join=round]{
    \draw(225:1) arc (225:270:1) arc (90:135:1) (270-\eyel:1) arc (180-\eyel/2:180+\eyel/2:{sqrt(2-2*cos(\eyel))}); % outline
    \draw[eyecolor, fill=eyecolor]({-sqrt(2-2*cos(\eyel))},-1) arc(-180:180:.07 and .15); % iris
    \fill[white, shift={(.03,.03)}] ({-sqrt(2-2*cos(\eyel))},-1)circle[x radius=.02, y radius=.05]; % accent
  }}
}
\begin{document}

\[
  \vcenter{\hbox{\chemfig{H-[:60]{\color{purple}C}(<[:140,,,,green]{\color{green}H})(<:[:115,,,,magenta]{\color{magenta}H})-{\color{cyan}C}(<[:-75,,,,blue]{\color{blue}OH})(<:[:-45,,,,brown]{\color{brown}H})-[:60,,,,red]{\color{red}H}}}}
  \hspace{.5cm}\lateraleye
\]
    
\end{document}

答案2

诀窍是重写分子的代码,使得第一个原子是左边的 C。分子代码中的第一个原子始终位于基线上:

\documentclass[border=3mm]{standalone}
\usepackage{chemfig}

\newcommand*\lateraleye{%
    \begin{tikzpicture}[x=0.75pt, y=0.75pt, yscale=-0.15, xscale=0.15]
    \draw[very thin]  (300,100.33) .. controls (326,122) and (352,135) .. (378,139.33) .. controls (352,143.67) and (326,156.67) .. (300,178.33) ;
    \fill (308.94,116.33) .. controls (313.87,116.33) and (317.86,125.51) .. (317.85,136.83) .. controls (317.84,148.15) and (313.84,157.33) .. (308.91,157.33) .. controls (303.99,157.32) and (300,148.14) .. (300.01,136.82) .. controls (300.02,125.5) and (304.02,116.32) .. (308.94,116.33) -- cycle ;
    \draw[very thin] (314.84,166.6) .. controls (311.87,164.64) and (309.14,162.18) .. (306.76,159.24) .. controls (295.12,144.82) and (296.6,124.33) .. (310.07,113.45) .. controls (311.48,112.32) and (312.96,111.33) .. (314.5,110.49) ; 
    \fill[white] (304.43,124.2) .. controls (306.09,124.25) and (307.32,128.01) .. (307.18,132.6) .. controls (307.05,137.19) and (305.59,140.88) .. (303.93,140.83) .. controls (302.27,140.78) and (301.03,137.02) .. (301.17,132.43) .. controls (301.31,127.83) and (302.76,124.15) .. (304.43,124.2) -- cycle ;
    \end{tikzpicture}%
}

\begin{document}

    \chemfig{{\color{purple}C}(-[:240]H)(<[:140,,,,green]{\color{green}H})(<:[:115,,,,magenta]{\color{magenta}H})-{\color{cyan}C}(<[:-75,,,,blue]{\color{blue}OH})(<:[:-45,,,,brown]{\color{brown}H})-[:60,,,,red]{\color{red}H}}
    \lateraleye

\end{document}

(我还稍微简化了眼睛图标的代码。)

在此处输入图片描述

相关内容