изменение того, как указан mnode, изменяет центрирование в psmatrix

изменение того, как указан mnode, изменяет центрирование в psmatrix

Я использую pstricks и psmatrix с некоторой частотой для генерации различных фигур. Одна из вещей, с которой я всегда боролся, — это как явно контролировать радиус (скажем) узлов окружности. Чтобы задать радиус, мне нужно использовать mnode=Circle вместо mnode=circle. Однако я заметил, что когда я использую mnode=Circle, «центрирование» текста/символа внутри узла «смещается» на некоторую ощутимую величину (чтобы подтвердить, что это «не только я», я попросил 3-4 разных студентов в моем классе посмотреть, и все они пришли к одному и тому же выводу).

Следующий MWE демонстрирует проблему — первый рисунок использует mnode=circle (все аккуратно отцентрировано внутри узлов), второй рисунок использует mnode=Circle (все не отцентрировано). Возможно, это немного занудно с моей стороны, но вот так...

Предложения? Исправления!?

Спасибо...

\documentclass[10pt,letterpaper,oneside]{article}

\usepackage[dvips,top=1.2in,bottom=0.65in,left=1.0in,right=1.0in,includefoot]{geometry}

\usepackage{pst-node,pstricks-add,pst-func}
% set up float for putting figures where you want them
\usepackage{float}


\begin{document}

Using \texttt{circle}:

\begin{figure}[H]
\centering
\newpsstyle{Cempty}{fillstyle=solid,mnode=none}
\newpsstyle{Cfill}{fillstyle=solid,fillcolor=blue!7,shadow=false}
\rule[1.8cm]{0.0pt}{3.0cm}
\psscalebox{0.935}{
$
\psmatrix[colsep=1cm,rowsep=1cm,
    arrowscale=1.5,mnode=circle]
 [style=Cempty] ~ &  [name=N1,style=Cfill] \phi_tp_t & [style=Cempty]  ~\\
[name=N2,style=Cfill] \phi_. p_t &  [style=Cempty] ~ & [name=N3,style=Cfill]  \phi_t p_. \\
 [style=Cempty] ~ &  [name=N4,style=Cfill] \phi_.{p_.} &  [style=Cempty] ~
% node connections
\psset{nodesep=5pt,arrows=->}
\ncline[linecolor=red,linewidth=.05cm]{N1}{N2}
\nbput*[nrot=0]{\textbf{?}}
\ncline[linestyle=dashed]{N1}{N3}
\ncline[linestyle=dashed]{N1}{N4}
\ncline[linestyle=dashed]{N2}{N4}
\ncline[linecolor=red,linewidth=.05cm]{N3}{N4}
\naput*[nrot=0]{\textbf{?}}
\endpsmatrix
$
}
\end{figure}


Using \texttt{Circle}, in order to control radius of the nodes:

\begin{figure}[H]
\centering
\newpsstyle{Cempty}{fillstyle=solid,mnode=none}
\newpsstyle{Cfill}{fillstyle=solid,fillcolor=blue!7,shadow=false}
\rule[1.8cm]{0.0pt}{3.0cm}
\psscalebox{0.935}{
$
\psmatrix[colsep=1cm,rowsep=1cm,
    arrowscale=1.5,mnode=Circle,radius=0.55cm]
 [style=Cempty] ~ &  [name=N1,style=Cfill] \phi_tp_t & [style=Cempty]  ~\\
[name=N2,style=Cfill] \phi_. p_t &  [style=Cempty] ~ & [name=N3,style=Cfill]  \phi_t p_. \\
 [style=Cempty] ~ &  [name=N4,style=Cfill] \phi_.{p_.} &  [style=Cempty] ~
% node connections
\psset{nodesep=5pt,arrows=->}
\ncline[linecolor=red,linewidth=.05cm]{N1}{N2}
\nbput*[nrot=0]{\textbf{?}}
\ncline[linestyle=dashed]{N1}{N3}
\ncline[linestyle=dashed]{N1}{N4}
\ncline[linestyle=dashed]{N2}{N4}
\ncline[linecolor=red,linewidth=.05cm]{N3}{N4}
\naput*[nrot=0]{\textbf{?}}
\endpsmatrix
$
}
\end{figure}


\end{document} 

решение1

Кажется, \Circlenodeцентрируется на базовой линии, а не в центре содержимого. Обходной путь состоит в том, чтобы поместить содержимое в \raisebox{\depth}. Это утомительно, но вы можете определить макрос быстрого доступа:

\documentclass[10pt,letterpaper,oneside]{article}

\usepackage[dvips,top=1.2in,bottom=0.65in,left=1.0in,right=1.0in,includefoot]{geometry}

\usepackage{pstricks-add,pst-func,}
% set up float for putting figures where you want them \usepackage{float}

\begin{document}

Using \texttt{circle}:

\begin{figure}[H]
\centering
\newpsstyle{Cempty}{fillstyle=solid,mnode=none}
\newpsstyle{Cfill}{fillstyle=solid,fillcolor=blue!7,shadow=false}
\rule[1.8cm]{0.0pt}{3.0cm}
\psscalebox{0.935}{
$
\psmatrix[colsep=1cm,rowsep=1cm,
    arrowscale=1.5,mnode=circle, radius = 1cm]
 [style=Cempty] ~ & [name=N1,style=Cfill] \phi_tp_t & [style=Cempty] ~\\
[name=N2,style=Cfill] \phi_. p_t & [style=Cempty] ~ & [name=N3,style=Cfill] \phi_t p_. \\
 [style=Cempty] ~ & [name=N4,style=Cfill] \phi_.{p_.} & [style=Cempty] ~
% node connections
\psset{nodesep=5pt,arrows=->}
\ncline[linecolor=red,linewidth=.05cm]{N1}{N2}
\nbput*[nrot=0]{\textbf{?}}
\ncline[linestyle=dashed]{N1}{N3}
\ncline[linestyle=dashed]{N1}{N4}
\ncline[linestyle=dashed]{N2}{N4}
\ncline[linecolor=red,linewidth=.05cm]{N3}{N4}
\naput*[nrot=0]{\textbf{?}}
\endpsmatrix
$
}
\end{figure}


Using \texttt{Circle}, in order to control radius of the nodes:

\begin{figure}[H]
\centering
\newpsstyle{Cempty}{fillstyle=solid,mnode=none}
\newpsstyle{Cfill}{fillstyle=solid,fillcolor=blue!7,shadow=false}
\rule[1.8cm]{0.0pt}{3.0cm}
\psscalebox{0.935}{
$
\psmatrix[colsep=1cm,rowsep=1cm,
 arrowscale=1.5,mnode=Circle, radius=0.55cm]%,C
 [style=Cempty] ~ &[name=N1,style=Cfill]\raisebox{\depth}{$ \phi_tp_t $} & [style=Cempty] ~\\
[name=N2,style=Cfill] \raisebox{\depth}{$ \phi_. p_t $} & [style=Cempty] ~ & [name=N3,style=Cfill] \raisebox{\depth}{$ \phi_t p_. $} \\
 [style=Cempty] ~ & [name=N4,style=Cfill] \raisebox{\depth}{$ \phi_.{p_.} $} & [style=Cempty] ~
% node connections
\psset{nodesep=5pt,arrows=->}
\ncline[linecolor=red,linewidth=.05cm]{N1}{N2}
\nbput*[nrot=0]{\textbf{?}}
\ncline[linestyle=dashed]{N1}{N3}
\ncline[linestyle=dashed]{N1}{N4}
\ncline[linestyle=dashed]{N2}{N4}
\ncline[linecolor=red,linewidth=.05cm]{N3}{N4}
\naput*[nrot=0]{\textbf{?}}
\endpsmatrix
$
}
\end{figure}

\end{document} 

введите описание изображения здесь

решение2

Похоже на ошибку и будет исправлена. Обновите текущий дистрибутив TeX. Для TeXLive он доступен с сегодняшнего дня. Если вы не можете обновиться, используйте следующее исправление:

\documentclass[10pt,letterpaper,oneside]{article}
\usepackage{pst-node}
\makeatletter
\def\Circlenode@ii#1{%
    \begingroup
    \pst@useboxpar
    \pst@dima=\dimexpr\ht\pst@hbox-\dp\pst@hbox
    \divide\pst@dima\tw@
    \pssetlength\pst@dimb\psk@radius
    \setbox\pst@hbox=\hbox{%
        \Cnodeput@iv{#1}%
        \pscircle(.5\wd\pst@hbox,\pst@dima){\pst@dimb}%
        \box\pst@hbox}%
    \ifPst@nodealign \psboxseptrue \fi
    \ifpsboxsep \psCirclebox@sep \fi
    \leavevmode
    \ifPst@nodealign\pst@nodealign\fi
    \box\pst@hbox
    \endgroup}
\makeatother

\begin{document}
    Using \texttt{Circle}, in order to control radius of the nodes:

\newpsstyle{Cempty}{mnode=none}
\newpsstyle{Cfill}{fillstyle=solid,fillcolor=blue!7}
%
$
\psmatrix[colsep=1cm,rowsep=1cm,arrowscale=1.5,mnode=Circle,radius=0.55cm,
    emnode=p]
        &  [name=N1,style=Cfill] \phi_tp_t         &          [style=Cempty]~        \\
           [name=N2,style=Cfill] \phi_. p_t        &      & [name=N3,style=Cfill]  \phi_t p_. \\
        &  [name=N4,style=Cfill] \strut\phi_.{p_.} &  [style=Cempty]~
            % node connections
            \psset{nodesep=5pt,arrows=->}
            \ncline[linecolor=red,linewidth=.05cm]{N1}{N2}
            \nbput*[nrot=0]{\textbf{?}}
            \ncline[linestyle=dashed]{N1}{N3}
            \ncline[linestyle=dashed]{N1}{N4}
            \ncline[linestyle=dashed]{N2}{N4}
            \ncline[linecolor=red,linewidth=.05cm]{N3}{N4}
            \naput*[nrot=0]{\textbf{?}}
\endpsmatrix
$   

\end{document} 

введите описание изображения здесь

Связанный контент