라텍스 테이블이 페이지 너비를 벗어납니다.

라텍스 테이블이 페이지 너비를 벗어납니다.

내가 지금 직면하고 있는 상황에 대한 최소한의 실제 사례는 다음과 같습니다.

\begin{table}
\centering

\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\multicolumn{1}{p{2cm}}{\centering Mass ($h^{-1}\;M_{\odot}$)}
& \multicolumn{1}{p{2cm}}{\centering $z$}
& \multicolumn{1}{p{2cm}}{\centering $r_{0}$} & 
$\gamma$ & $r_{0} \: (\gamma=2.0)$ & $N_{clusters}$ & bias \\ 
\hline
$M_{halo}>2\times10^{13}$ & $0.1<z_c<0.4$ & 9.89$\pm$0.20 & 1.76$\pm$0.05
             & 9.53$\pm$0.29 & 10492 & 1.81$\pm$0.03 \\ [1ex] 
        & $0.4<z_c<0.7$ & 10.22$\pm$0.14 & 1.84$\pm$0.04 & 10.01$\pm$0.17 & 27224 & 2.00$\pm$0.03 \\ [1ex] 
        & $0.7<z_c<1.0$ & 11.10$\pm$0.15 & 1.87$\pm$0.04 & 10.85$\pm$0.17 & 35133 & 2.52$\pm$0.02 \\ [1ex] 
        & $1.0<z_c<1.3$ & 11.62$\pm$0.23 & 1.98$\pm$0.05 & 11.58$\pm$0.19 & 31815 & 3.01$\pm$0.06 \\ [1ex] 
        & $1.3<z_c<1.6$ & 12.41$\pm$0.42 & 2.13$\pm$0.09 & 12.49$\pm$0.52 & 22978 & 3.37$\pm$0.19 \\ [1ex] 
        & $1.6<z_c<2.1$ & 14.78$\pm$0.21 & 2.06$\pm$0.05 & 14.78$\pm$0.22 & 18931 & 4.65$\pm$0.23 \\ [1ex] \hline \noalign{\vskip 0.1cm}    

\end{tabular} 

\caption{The best-fit values of the parameters of the real-space correlation function $\xi(r)$ for the light-cone at different (1) mass thresholds and (2) redshift ranges. For each sample we quote (3) the correlation length $r_{0}$, (4) slope $\gamma$, (5) correlation length $r_{0}$ at fixed slope $\gamma=2.0$, (6) number of clusters $N_{clusters}$ and (7) the bias $b$ obtained.} 
\label{table:clustering_with_mass}

\end{table}

내 테이블은 지정된 페이지 너비를 벗어나게 됩니다. 이는 다음과 같습니다.

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

using etc에 대한 여러 답변을 확인했지만 tabularx제대로 작동하지 않는 것 같습니다.

답변1

테이블을 세로 방향으로 유지해야 한다면 다음을 제안합니다.

  • 길이 매개변수를 설정 \thickmuskip하고 \medmuskip;0mu

  • 두 번째 열의 구조를 단순화합니다.

  • 고정 너비 헤더 셀 정의를 제거합니다.

  • tabular*환경 대신 환경 을 사용하십시오 tabular. 그리고

  • \normalsize에서 로 전환합니다 \small.

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

\documentclass{report}
\usepackage{amsmath}
\usepackage{booktabs}

\begin{document}
\begin{table}
\setlength\tabcolsep{0pt}
\setlength\thickmuskip{0mu}
\setlength\medmuskip{0mu}
\small
\begin{tabular*}{\textwidth}{c@{\extracolsep{\fill}}*{6}{c}}
\toprule
Mass  & $z_c$ & $r_{0}$ & $\gamma$ 
& $r_{0}$ ($\gamma=2.0$) & $N_{\textrm{clusters}}$ & bias \\ 
($h^{-1}M_{\odot}$)\\
\midrule
$M_{\textrm{halo}}>2\times10^{13}$ & $0.1\text{--}0.4$ & 9.89$\pm$0.20 & 1.76$\pm$0.05 & 9.53$\pm$0.29 & 10492 & 1.81$\pm$0.03 \\ \addlinespace 
& $0.4\text{--}0.7$ & 10.22$\pm$0.14 & 1.84$\pm$0.04 & 10.01$\pm$0.17 & 27224 & 2.00$\pm$0.03 \\ \addlinespace 
& $0.7\text{--}1.0$ & 11.10$\pm$0.15 & 1.87$\pm$0.04 & 10.85$\pm$0.17 & 35133 & 2.52$\pm$0.02 \\ \addlinespace 
& $1.0\text{--}1.3$ & 11.62$\pm$0.23 & 1.98$\pm$0.05 & 11.58$\pm$0.19 & 31815 & 3.01$\pm$0.06 \\ \addlinespace 
& $1.3\text{--}1.6$ & 12.41$\pm$0.42 & 2.13$\pm$0.09 & 12.49$\pm$0.52 & 22978 & 3.37$\pm$0.19 \\ \addlinespace 
& $1.6\text{--}2.1$ & 14.78$\pm$0.21 & 2.06$\pm$0.05 & 14.78$\pm$0.22 & 18931 & 4.65$\pm$0.23 \\ 
\bottomrule  

\end{tabular*} 

\caption[The best-fit values of the parameters of the real-space correlation function $\xi(r)$]{The best-fit values of the parameters of the real-space correlation function $\xi(r)$ for the light-cone at different (1)~mass thresholds and (2)~redshift ranges. For each sample we quote (3)~the correlation length $r_{0}$, (4)~slope $\gamma$, (5)~correlation length $r_{0}$ at fixed slope $\gamma=2.0$, (6)~number of clusters $N_{\textrm{clusters}}$, and (7)~the bias $b$ obtained.} 
\label{table:clustering_with_mass}

\end{table}
\end{document}

답변2

반면에 이것은 회전된 테이블을 사용한 솔루션입니다. 나는 또한 귀하의 코드를 약간 정리했습니다.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{rotating,booktabs,amstext}
\usepackage{lipsum}



\begin{document}

\lipsum[1-4]

\begin{sidewaystable}
    \centering
    \begin{tabular}{*{7}c}
        \toprule
        \multicolumn{1}{p{2cm}}{\centering Mass ($h^{-1}\;M_{\odot}$)}
        & \multicolumn{1}{p{2cm}}{\centering $z$}
        & \multicolumn{1}{p{2cm}}{\centering $r_{0}$} & 
        $\gamma$ & $r_{0} \: (\gamma=2.0)$ & $N_{\text{clusters}}$ & bias \\ 
        \midrule
        $M_{halo}>2\times10^{13}$ & $0.1<z_c<0.4$ & 9.89$\pm$0.20 & 1.76$\pm$0.05
             & 9.53$\pm$0.29 & 10492 & 1.81$\pm$0.03 \\ [1ex] 
        & $0.4<z_c<0.7$ & 10.22$\pm$0.14 & 1.84$\pm$0.04 & 10.01$\pm$0.17 & 27224 & 2.00$\pm$0.03 \\ [1ex] 
        & $0.7<z_c<1.0$ & 11.10$\pm$0.15 & 1.87$\pm$0.04 & 10.85$\pm$0.17 & 35133 & 2.52$\pm$0.02 \\ [1ex] 
        & $1.0<z_c<1.3$ & 11.62$\pm$0.23 & 1.98$\pm$0.05 & 11.58$\pm$0.19 & 31815 & 3.01$\pm$0.06 \\ [1ex] 
        & $1.3<z_c<1.6$ & 12.41$\pm$0.42 & 2.13$\pm$0.09 & 12.49$\pm$0.52 & 22978 & 3.37$\pm$0.19 \\ [1ex] 
        & $1.6<z_c<2.1$ & 14.78$\pm$0.21 & 2.06$\pm$0.05 & 14.78$\pm$0.22 & 18931 & 4.65$\pm$0.23 \\ [1ex]
        \bottomrule
    \end{tabular} 
    \smallskip
    \caption[A short caption for the LOT\@]
        {The best-fit values of the parameters of the real-space correlation
        function~$\xi(r)$ for the light-cone at different (1)~mass thresholds
        and (2)~redshift ranges.  For each sample we quote (3)~the correlation
        length~$r_{0}$, (4)~slope~$\gamma$, (5)~correlation length~$r_{0}$ at
        fixed slope $\gamma=2.0$, (6)~number of clusters $N_{\text{clusters}}$
        and (7)~the bias~$b$ obtained.}
    \label{table:clustering_with_mass}
\end{sidewaystable}

\lipsum[5-8]

\end{document}

테이블이 포함된 페이지의 이미지는 다음과 같습니다.

테이블 이미지

답변3

글꼴 크기를 사용 하고 두 번째 행( )의 첫 번째 셀 내용을 자체 행의 자막으로 \small만들면 텍스트 너비에 맞출 수 있습니다. M_halo그녀는 테이블과 간단한 코드를 일부 개선한 코드입니다. 특히 저는 array환경을 사용하고 패키지에 대한 몇 가지 수평 규칙만 유지합니다 booktabs.

\documentclass[a4paper,11pt]{article}

\usepackage[showframe]{geometry}%
\usepackage{booktabs}
\usepackage{array, tabularx, makecell}
\usepackage{siunitx}

\begin{document}

\begin{table}
  \centering
  \small\setlength\extrarowheight{1ex}%
  $ \begin{array}{ccrrrcc}
  \makecell{\text{Mass}\\ (h⁻¹\;M_{\odot})}
  & z & \makecell{r_{0}} & \makecell{γ} & \makecell{r_{0} \: (\gamma=2.0)} & N_\text{clusters} & \text{bias} \\
  \midrule[\heavyrulewidth]
  \multicolumn{7}{l}{M_\text{halo}>2 × 10^{13}}\\[0.5ex]
  & 0.1<z_c<0.4 & 9.89 ±0.20 & 1.76 ±0.05
  & 9.53 ±0.29 & 10492 & 1.81 ±0.03 \\ & 0.4<z_c<0.7 & 10.22 ±0.14 & 1.84 ±0.04 & 10.01 ±0.17 & 27224 & 2.00 ±0.03 \\ & 0.7<z_c<1.0 & 11.10 ±0.15 & 1.87 ±0.04 & 10.85 ±0.17 & 35133 & 2.52 ±0.02 \\ & 1.0<z_c<1.3 & 11.62 ±0.23 & 1.98 ±0.05 & 11.58 ±0.19 & 31815 & 3.01 ±0.06 \\
  & 1.3<z_c<1.6 & 12.41 ±0.42 & 2.13 ±0.09 & 12.49 ±0.52 & 22978 & 3.37 ±0.19 \\
  & 1.6<z_c<2.1 & 14.78 ±0.21 & 2.06 ±0.05 & 14.78 ±0.22 & 18931 & 4.65 ±0.23 \\
  \bottomrule
  \end{array} $%
  \caption{The best-fit values of the parameters of the real-space correlation function $ξ(r)$ for the light-cone at different (1) mass thresholds and (2) redshift ranges. For each sample we quote (3) the correlation length $r_{0}$, (4) slope $\gamma$, (5) correlation length $r_{0}$ at fixed slope $\gamma=2.0$, (6) number of clusters $N_{clusters}$ and (7) the bias $b$ obtained.}
  \label{table:clustering_with_mass}
\end{table}

\end{document} 

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

관련 정보