테이블에서 여러 줄 표현식 정렬

테이블에서 여러 줄 표현식 정렬

나는 이것을 적절하게 정렬하는 데 매우 가깝지만 가장 오른쪽 셀은 위쪽 규칙과 같은 높이에 있는 반면 가장 왼쪽 및 중앙 셀에는 작은 양의 수직 공간이 있습니다. 정렬을 균일하게 만들려고 합니다(수직 공간을 제거하거나 행 전체에서 일관되게 유지).

나는 \parbox{}여러 줄 표현식이 테이블 내에 포함되고 수평으로 정렬되도록 허용했습니다.

\begin{table}[h]
\caption{Title of Table.}
\begin{tabularx}{\linewidth}{p{1.4cm} p{6.9cm} p{6.8cm}} 
\toprule
Head1 & Head2 & Head3 \\
\midrule
text   & text text text text &  \parbox{6.8cm}{$BZ, CY, CX, BZ, BX, AY, AZ, \\ CY, CZ, \ldots$ } \\
\bottomrule
\end{tabularx}
\end{table}

또한 이것이 중요한 경우를 대비해 APA 형식 테이블의 서문에 다음을 포함합니다.

\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
  singlelinecheck=false,labelsep=spaced,skip=0pt}
\captionsetup[figure]{labelsep=period,labelfont=it,justification=justified,
  singlelinecheck=false,font=doublespacing}

답변1

달성하려는 목표가 명확하지 않으므로 최소한의 완전한 예를 제공해야 합니다.

어쨌든, 다음과 같이 tabularray:

\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs} 
\usepackage{caption}
\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
    singlelinecheck=false,labelsep=spaced,skip=0pt}
\captionsetup[figure]{labelsep=period,labelfont=it,justification=justified,
    singlelinecheck=false,font=doublespacing}

\begin{document}
    \begin{table}[h]
        \caption{Title of Table.}
        \begin{tblr}{colspec={Q[1.4cm]Q[6.9cm]X[mode=math]}} 
            \toprule
            Head1 & Head2 & Head3 \\
            \midrule
            text   & text text text text & {BZ, CY, CX, \\ BZ, BX, AY,\\ AZ, CY, CZ, \ldots} \\
            \bottomrule
        \end{tblr}
    \end{table}
\end{document}

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

답변2

환경 이 제대로 작동하려면 -column을 tabularx사용해야 합니다 . X하나도 없으면 그냥 일반 tabular. 둘째, 변경하려는 사항은 인라인 수학 요소 목록이 깨지지 않는다는 것입니다 ,. (예를 들어)의 콘텐츠를 사용하여 관리 방법을 변경해야 합니다."인라인 수학 모드에서 ','에 줄 바꿈을 허용하면 인용이 끊어집니다.:

\documentclass{article}

\usepackage{tabularx,booktabs}

% https://tex.stackexchange.com/a/19100/5764
\mathchardef\breakingcomma\mathcode`\,
{\catcode`,=\active
  \gdef,{\breakingcomma\discretionary{}{}{}}
}
\newcommand{\mathlist}[1]{\mathcode`\,=\string"8000 #1}

\begin{document}

\begin{table}
  \caption{Table caption}
  \begin{tabularx}{\linewidth}{ p{14mm} p{69mm} X } 
    \toprule
    Head1 & Head2 & Head3 \\
    \midrule
    text & text text text text & $\mathlist{BZ, CY, CX, BZ, BX, AY, AZ, CY, CZ, \ldots}$ \\
    \bottomrule
  \end{tabularx}
\end{table}

\end{document}

답변3

https://tex.stackexchange.com/a/467445/197451

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

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}

\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}
    \begin{table}[h]
        \caption{Title of Table.}
\setlength{\extrarowheight}{2pt}
        \begin{tabularx}{\linewidth}{ccC} 
            \toprule
            Head1 & Head2 & Head3 \\
            \midrule
            text   & text text text text &{{\parbox{3cm}{$BZ, CY, CX, BZ, BX,\\ AY, 
            AZ, CY, CZ, \ldots$ }}} \\
            \bottomrule
        \end{tabularx}
    \end{table}
    \begin{table}[h]
                \caption{Title of Table.}
        \begin{tabularx}{\textwidth}{ccC} 
            \toprule
            Head1 & Head2 & Head3 \\
            \midrule
            text   & text text text text &  {{$BZ, CY, CX, BZ, BX, AY, AZ, CY, CZ, 
            \ldots$ }} \\
            \bottomrule
        \end{tabularx}
    \end{table}
\end{document} 

답변4

여러 줄의 텍스트가 있는 의 기준선 \parbox은 가장 아래쪽 행의 기준선이며, 전체 상자가 기준선보다 높은 높이를 제공합니다. 이러한 상자는 기준선이 아닌 상단에 정렬되어 위의 규칙에 어긋나는 것처럼 보입니다.

해결책은 맨 위 행의 (가상) 기준선이 다른 열의 기준선과 정렬되도록 텍스트의 첫 번째 줄에 "스트럿"을 포함하는 것입니다. Plain TeX은 이를 위한 \strut매크로 를 제공합니다 .\mathstrut

text & \strut text text text text &
$\mathlist{\mathstrut BZ, CY, CX, BZ, BX, AY, AZ, CY, CZ, \ldots}$ \\

또한보십시오Bussproofs와 동일한 추론선 간격.

관련 정보