我需要在垂直轴中输入值:这是我的尝试
\documentclass{article}
\usepackage{modiagram}
\usepackage[version=3]{mhchem}
\usetikzlibrary{positioning}
\usepackage{chemmacros}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{axis line style/.style={thin, gray, -stealth}}
\newcommand*{\TickSize}{2pt}%
\begin{document}
\pagestyle{empty}
\begin{figure}[p]
\centering
\MOsetup{
names,
names-style = {
text height = 2.5ex,
text depth = .5ex,
draw = blue!80,
yshift=-1cm,
rounded corners
}
}
\begin{MOdiagram}[style=fancy,labels,names,names-style-add={draw=blue,fill=blue!20},AO-width=10pt,lines={gray,thin}]
\atom[\ch{I}]{left}{
2s={0.5;pair},
label = { 2sleft = {5s} },
2p = {5;pair,pair,up},
label = { 2pxleft = {$5\text{p}_x$} },
label = { 2pyleft = {$5\text{p}_y$} },
label = { 2pzleft = {$5\text{p}_z$} }
}
\atom[\ch{Cl}]{right}{
2s={-0.5;pair},
2p = {4;pair,pair,up},
label = { 2sright = {3s} },
label = { 2pxright = {$3\text{p}_x$} },
label = { 2pyright= {$3\text{p}_y$} },
label = { 2pzright = {$3\text{p}_z$} }
}
\molecule[\ch{ICl}]{
2sMO, 2pMO = {;pair,pair,pair,pair,pair},
label = { 2sigma = {$\sigma_s$} },
label = { 2sigma* = {$\sigma_s^*$} },
label = { 2psigma = {$\sigma_{z}$}},
label = { 2psigma* = {$\sigma_{z}^*$}},
label = { 2piy = {$\pi_{x}$}},
label = { 2piz = {$\pi_{y}$}},
label = { 2piy* = {$\pi_{x}^*$}},
label = { 2piz* = {$\pi_{y}^*$}},
}
\draw[axis line style] (-1.25,-2.5) -- (-1.25,7.5);
\foreach \y/\ytext in {0,...,10}
\draw[shift={(-1.25,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
\end{MOdiagram}
\caption{MO diagram of \ch{ICl}. Created by Marco Atzori with \LaTeX}
\end{figure}
\end{document}
如您所见,值数组超出了轴的范围。我该如何让它适合轴呢?
先感谢您
答案1
我将循环从 10 修改为 7。并且我将零放在蓝色节点文本的底部,不知道这是否是适合您的位置。
\foreach \y/\ytext in {0,...,10}
\draw[shift={(-1.25,\y-3)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
\documentclass{article}
\usepackage{modiagram}
\usepackage[version=3]{mhchem}
\usetikzlibrary{positioning}
\usepackage{chemmacros}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{axis line style/.style={thin, gray, -stealth}}
\newcommand*{\TickSize}{2pt}%
\begin{document}
\pagestyle{empty}
\begin{figure}[p]
\centering
\MOsetup{
names,
names-style = {
text height = 2.5ex,
text depth = .5ex,
draw = blue!80,
yshift=-1cm,
rounded corners
}
}
\begin{MOdiagram}[style=fancy,labels,names,names-style-add={draw=blue,fill=blue!20},AO-width=10pt,lines={gray,thin}]
\atom[\ch{I}]{left}{
2s={0.5;pair},
label = { 2sleft = {5s} },
2p = {5;pair,pair,up},
label = { 2pxleft = {$5\text{p}_x$} },
label = { 2pyleft = {$5\text{p}_y$} },
label = { 2pzleft = {$5\text{p}_z$} }
}
\atom[\ch{Cl}]{right}{
2s={-0.5;pair},
2p = {4;pair,pair,up},
label = { 2sright = {3s} },
label = { 2pxright = {$3\text{p}_x$} },
label = { 2pyright= {$3\text{p}_y$} },
label = { 2pzright = {$3\text{p}_z$} }
}
\molecule[\ch{ICl}]{
2sMO, 2pMO = {;pair,pair,pair,pair,pair},
label = { 2sigma = {$\sigma_s$} },
label = { 2sigma* = {$\sigma_s^*$} },
label = { 2psigma = {$\sigma_{z}$}},
label = { 2psigma* = {$\sigma_{z}^*$}},
label = { 2piy = {$\pi_{x}$}},
label = { 2piz = {$\pi_{y}$}},
label = { 2piy* = {$\pi_{x}^*$}},
label = { 2piz* = {$\pi_{y}^*$}},
}
\draw[axis line style] (-1.25,-2.5) -- (-1.25,7.5);
\foreach \y/\ytext in {0,...,10}
\draw[shift={(-1.25,\y-3)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
\end{MOdiagram}
\caption{MO diagram of \ch{ICl}. Created by Marco Atzori with \LaTeX}
\end{figure}
\end{document}