SOS 如何将文本与这个特定的 \newcolumntype 垂直对齐?

SOS 如何将文本与这个特定的 \newcolumntype 垂直对齐?

我想垂直对齐文本“肌肉系统”,该文本以淡紫色突出显示。我定义了一种新的列类型,但本网站上的相关问题无济于事。提前谢谢您!

    \documentclass{book}
    \usepackage{dcolumn}
    \usepackage{tabularx} 
    \usepackage{color, colortbl}
    \definecolor{LavenderBlue}{rgb}{0.85,0.85,1}

    \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

    \begin{document}

    \begin{table}[!h]
    \renewcommand\arraystretch{1.1}
        \centering
         \small
                \begin{tabular}{|P{4cm}|P{7cm}|}
        \hline 
    System & Effects \\
    \hline
        Circulatory system & Pericarditis, heart failure, hypertension \\ \hline
Blood tissue & Anemia \\ \hline
Gastrointestinal system & Nausea, loss of appetite, diarrhoea, stomatitis \\ \hline
Nervous system  & Somnolence, apathy, amnesia \\ \hline
\rowcolor{LavenderBlue}
Muscular system & Cramps, alteration of sensitivity, alteration of neuromuscular excitability \\ \hline
Skeletal system & Changes in bone metabolism, joint inflammation \\ \hline
Integumentary system & Pallor, itching, yellowish colour \\ \hline  
\end{tabular}
\caption{Effects caused by renal dysfunctions on the systems of the human body.}
\label{effectbody}
 \end{table}

   \end{document}

答案1

在 MWE 中用 \newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}替换将得到以下结果:\newcolumntype{P}[1]{>{\centering\arraybackslash}m{#1}}在此处输入图片描述

一般来说,p单元格是顶部对齐的,m单元格是垂直居中的,并且b单元格将其内容与单元格底部对齐。

相关内容