开发者

LaTeX table cells content vertical alignment problem

开发者 https://www.devze.com 2023-01-02 22:47 出处:网络
I\'d like to align text in right cell of table created below, to be vertically align to the top. How to do that ?

I'd like to align text in right cell of table created below, to be vertically align to the top. How to do that ?

\begin{tabular}{l|p{3cm}}
    \rule{2cm}{5cm} & Top align content ? \\
\end{tabular}

Regards开发者_开发问答


Answer to second qeustion You should make your table in the first cell to be top aligned.

If you write

\begin{tabular}{|l|}  
    \hline text \\ text \\ text\\ text \\ \hline 
\end{tabular}

then you get a center aligned table.

Write

\begin{tabular}{p{1cm}|p{3cm}}  
    \vtop{\vskip 0pt \vskip -\ht\strutbox 
    \begin{tabular}{|l|}  
        \hline text \\ text \\ text\\ text \\ \hline 
    \end{tabular}\vskip -\dp\strutbox }%
    & Top align content ? \\  
\end{tabular} 


\begin{tabular}{l|p{3cm}} 
    \vrule width 2cm height \ht\strutbox depth 5cm & Top align content ! \\ 
\end{tabular} 
0

精彩评论

暂无评论...
验证码 换一张
取 消