tabularx 테이블에서 여러 열 셀을 수직으로 정렬하려면 어떻게 해야 합니까?

tabularx 테이블에서 여러 열 셀을 수직으로 정렬하려면 어떻게 해야 합니까?

테이블 의 오른쪽 상단 셀을 중앙(수직 및 수평)으로 맞추려고 하는데 tabularx수평으로만 정렬할 수 있습니다. 내 서문에 필요한 패키지를 가져왔습니다. 정의 방법은 다음과 같습니다 Y.

\newcolumntype{Y}{>{\centering\arraybackslash}X}

그리고 이것은 내 코드입니다:

\begin{table}[H]
    \centering
    \begin{tabularx}{\textwidth}{|*{6}{Y|}}
        \hline
        Concentration of L-Ascorbic Acid in the Reaction Mixture$\;/\;\mathrm{M}$ & \multicolumn{5}{c|}{$\frac{1}{t_{1/2}}\;/\;s^{-1}$} \\
        \hline
    \end{tabularx}
\end{table}

답변1

댓글이 너무 길어요...

귀하의 의견이 더 명확해지려면 테이블 코드 부분을 더 많은 행으로 확장한 다음 문제를 보여주는 MWE(Minimal Working example, 작지만 완전한 문서)로 확장하십시오.

지금까지 우리는 당신의 문제가 무엇인지 추측할 수 있을 뿐입니다. 코드 조각을 사용하여 세 가지 가능한 예를 보여 드리겠습니다.

\documentclass{article}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{tabularray}

\begin{document}
\begin{table}[ht]
\caption{With your code fragment}
    \centering
\setlength\extrarowheight{2pt}
    \begin{tabularx}{\textwidth}{|*{6}{Y|}}
        \hline
Concentration of L-Ascorbic Acid in the Reaction Mixture$\;/\;\mathrm{M}$ 
    & \multicolumn{5}{c|}{$\frac{1}{t_{1/2}}\;/\;s^{-1}$} \\
        \hline
    \end{tabularx}
\end{table}

\begin{table}[ht]
\caption{With your code fragment when  is added an empty row}
\renewcommand\tabularxcolumn[1]{m{#1}}
    \centering
\setlength\extrarowheight{2pt}
    \begin{tabularx}{\textwidth}{|*{6}{Y|}}
        \hline
Concentration of L-Ascorbic Acid in the Reaction Mixture$\;/\;\mathrm{M}$
    & \multicolumn{5}{c|}{$\frac{1}{t_{1/2}}\;/\;s^{-1}$} \\
        \hline
    &   &   &   &   &   \\
        \hline
    \end{tabularx}
\end{table}


\begin{table}[ht]
    \centering
\caption{You may looking for such table}
    \begin{tblr}{hlines, vlines,
                 colspec={l X[c, mode=dmath]},
                 rowsep={5pt}
                 }
Concentration of L-Ascorbic Acid in the Reaction Mixture/$\mathrm{M}$
    &   \frac{1}{t_{1/2}};s^{-1}        \\
    \end{tblr}
\end{table}
\end{document}

여기에 이미지 설명을 입력하세요

테이블 사용에 대한 컨텍스트를 추가하십시오. 즉, 테이블이 무엇을 좋아해야 하는지 명확히 하십시오.

관련 정보