将 m 列与 PsPicture 结合使用

将 m 列与 PsPicture 结合使用

根据一篇较早的帖子(看这里) 我正在尝试将 PsPicture 置于单元格的中心。我之前使用的代码 ( raisebox{0pt}[\height]{...}) 似乎不适用于此图片,因为图片上方和下方的空间不同:

在此处输入图片描述

梅威瑟:

\documentclass[a4paper,DIV=15,oneside,12pt]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{array}
\usepackage{setspace}
\usepackage{pst-all}
\usepackage{auto-pst-pdf}

\begin{document}
\onehalfspacing
\begin{tabular}{m{6.5cm}m{3cm}}
\toprule
\raisebox{0pt}[\dimexpr\height]{\begin{pspicture}[showgrid=false](1,0)(7,1.2)
\psline*[linewidth=2pt,linecolor=black](3.7,0)(4.3,0)(4,0.32)
\psline[linewidth=1.5pt](2,0.8)(2,0.35)(6,0.35)(6,0.8)
\psframe[linecolor=blue,fillstyle=solid,fillcolor=blue](1.1,0.85)(1.4,1.2)
\psframe[linecolor=blue,fillstyle=solid,fillcolor=blue](1.5,0.85)(1.8,1.2)
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](2.05,1){0.15}
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](2.4,1){0.15}
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](2.75,1){0.15}
%
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](5.3,1){0.15}
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](5.65,1){0.15}
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](6,1){0.15}
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](6.35,1){0.15}
\pscircle[linecolor=red,fillstyle=solid,fillcolor=red](6.7,1){0.15}
%
\psline[linewidth=2.1pt](1,0.79)(3,0.79)
\psline[linewidth=2.1pt](5,0.79)(7,0.79)
\end{pspicture}} &
$\displaystyle 2x + 3 = 5$
\\\bottomrule
\end{tabular}
\end{document}


我该如何修复它?

答案1

尝试这个:

     \documentclass[a4paper,DIV=15,oneside,12pt]{scrartcl}
     \usepackage[ngerman]{babel}
     \usepackage[utf8]{inputenc}
     \usepackage[T1]{fontenc}
     \usepackage{booktabs}
     \usepackage{graphicx}
     \usepackage{array}
     \usepackage{setspace}
     \usepackage{pst-all}
     \usepackage{auto-pst-pdf}
     \newcommand{\CenterObject}[1]{\ensuremath{\vcenter{\hbox{#1}}}}

     \begin{document}
     \onehalfspacing
     \begin{tabular}{m{6.5cm}m{3cm}}
     \toprule
     \raisebox{0pt}[\dimexpr\height]{
     \CenterObject{\begin{pspicture}[showgrid=false](1,0)(7,1.2)
     \psline*[linewidth=2pt,linecolor=black](3.7,0)(4.3,0)(4,0.32)
     \psline[linewidth=1.5pt](2,0.8)(2,0.35)(6,0.35)(6,0.8)
     \psframe[linecolor=blue,fillstyle=solid,fillcolor=blue](1.1,0.85)(1.4,1.2)
     \psframe[linecolor=blue,fillstyle=solid,fillcolor=blue](1.5,0.85)(1.8,1.2)
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](2.05,1){0.15}
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](2.4,1){0.15}
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](2.75,1){0.15}
     %
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](5.3,1){0.15}
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](5.65,1){0.15}
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](6,1){0.15}
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](6.35,1){0.15}
     \pscircle[linecolor=red,fillstyle=solid,fillcolor=red](6.7,1){0.15}
     %
     \psline[linewidth=2.1pt](1,0.79)(3,0.79)
     \psline[linewidth=2.1pt](5,0.79)(7,0.79)
     \end{pspicture}}} &
     $\displaystyle 2x + 3 = 5$
     \\\bottomrule
     \end{tabular}
     \end{document}

在此处输入图片描述

相关内容