tabularx를 사용하여 3열 테이블을 작성하는 방법

tabularx를 사용하여 3열 테이블을 작성하는 방법

tabularx를 사용하여 간단한 3열 테이블을 작성하려고 하는데 테이블이 눈에 띄게 제대로 작동하지 않기 때문에 코드의 일부 측면을 오해하고 있는 것 같습니다.
간격 오류가 있는 테이블

내 목표는 세 개의 동일한 열 너비를 갖는 것이지만, 무엇을 시도해도 선이 일치하지 않는 것 같습니다. (텍스트를 중앙에 배치하고 '정보'를 한 단어로 유지하는 작업도 해야 하지만 그런 문제는 비교적 사소한 것입니다!)

테이블을 생성하는 코드는 다음과 같습니다.

    \caption{Common Curriculum}
    \centering
    \begin{tabularx}{0.9\linewidth}[ht]{||p{0.3\linewidth} | p{0.3\linewidth} | p{0.3\linewidth}||} 
        \hline
        Physical Concepts & Mathematical Skills and Notation & Application in Quantum Information  \\  
        \hline\hline
        1 & 6 & 87837  \\ 
        \hline
        2 & 7 & 78  \\
        \hline
        3 & 545 & 778  \\
        \hline
        4 & 545 & 18744  \\
        \hline
        5 & 88 & 788  \\ 
        \hline
    \end{tabularx}
    \label{tab:CommonCurr}.
\end{table}

{\textwidth}대신 사용해 보았습니다 {0.9\linewidth}. 나는 또한 텍스트 너비의 1/3을 사용해 보았지만 수평선이 테이블 너머로 확장되어 반대 문제가 발생했기 때문에 그 아이디어의 문제는 반올림 때문이라고 가정했습니다.

어떤 도움이라도 주시면 감사하겠습니다!

답변1

다음 테이블 형식이 마음에 들었을지 궁금합니다.

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

위의 "전문적인" 테이블을 Az 쓰기는 tabularray라이브러리(동일한 이름의 패키지를 로드하는)가 있는 패키지와 조금 더 좁은 테이블에 사용됩니다.

\documentclass{article}
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document}
    \begin{table}[ht]
\caption{Common Curriculum}
\label{tab:CommonCurr}
    \centering
\begin{tblr}{width=0.75\linewidth,
             colspec = {X[c] 
                        X[c, si={table-format=3.0}] 
                        X[c, si={table-format=5.0}]},
             row{even}  = {belowsep=-2pt},
             row{1} = {guard, c}
             }
    \toprule
{Physical\\ Concepts}
    & Mathematical Skills and Notation 
        & Application in Quantum Information  \\
    \midrule
1   & 6     & 87837     \\
2   & 7     & 78        \\
3   & 545   & 778       \\
4   & 545   & 18744     \\
5   & 88    & 788       \\
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

그러나 질문에 표시된 것처럼 수평선과 수직선의 "감옥"에 있는 각 셀을 더 선호하는 경우 MWE는 다음과 같습니다.

\documentclass{article}
\usepackage[skip=0.33\baselineskip]{caption}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\begin{document}
    \begin{table}[ht]
\caption{Common Curriculum}
\label{tab:CommonCurr}
    \centering
\begin{tblr}{width=0.75\linewidth,
             hlines, vlines,
             colspec = {X[c] 
                        X[c, si={table-format=3.0}] 
                        X[c, si={table-format=5.0}]},
             row{1} = {guard, c}
             }
{Physical\\ Concepts}
    & Mathematical Skills and Notation 
        & Application in Quantum Information  \\
1   & 6     & 87837     \\
2   & 7     & 78        \\
3   & 545   & 778       \\
4   & 545   & 18744     \\
5   & 88    & 788       \\
\end{tblr}
    \end{table}
\end{document}

테이블은 다음보다:

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

관련 정보