오른쪽 정렬된 tabularx 헤더 아래의 테이블 데이터 가운데 맞춤

오른쪽 정렬된 tabularx 헤더 아래의 테이블 데이터 가운데 맞춤

"21"이 헤더 아래 중앙에 오도록 다음 테이블을 정렬하려고 합니다.

\begin{table}[h]
\centering
\begin{tabularx}{1.09\textwidth}{|cll>{\raggedleft\arraybackslash}X|}
\hline
\textbf{ID}     & \textbf{Severity}     & \textbf{Vulnerability}       &
\textbf{Occurrences} \\
\hline
111111         & Lorem                 & Lorem ipsum dolor sit amet & 21 \\
\hline
\end{tabularx}
\caption{example}
\label{table:example}
\end{table}

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

\centering마지막 열 대신에 머리글 아래에 숫자를 가운데에 배치 할 수 있지만 \raggedleft머리글이 너무 왼쪽으로 치우치게 되므로 머리글을 위 그림과 같이 만들고 싶습니다.

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

어쨌든 이 두 가지의 조합을 얻을 수 있나요? 헤더는 첫 번째 그림과 같이 오른쪽에 정렬되지만 숫자는 두 번째 그림과 같이 헤더 아래 중앙에 정렬됩니다.

답변1

X나는 4번째 셀 대신 3번째 셀에 colum 유형을 사용하겠습니다 : \begin{tabularx}{1.09\textwidth}{|clXc|}. 그런 \makecell[r]{\textbf{Occurrences}}다음 헤더를 오른쪽 정렬할 수 있습니다.

\documentclass{article}

\usepackage{tabularx}
\usepackage{makecell}

\begin{document}
\begin{table}[h]
\centering
\begin{tabularx}{1.09\textwidth}{|clXc|}
\hline
\textbf{ID}     & \textbf{Severity}     & \textbf{Vulnerability}       &
\makecell[r]{\textbf{Occurrences}} \\
\hline
111111         & Lorem                 & Lorem ipsum dolor sit amet & 21 \\
\hline
\end{tabularx}
\caption{example}
\label{table:example}
\end{table}
\end{document}

관련 정보