캡션을 표 아래 중앙에 배치

캡션을 표 아래 중앙에 배치

2개의 열과 12개의 행이 있는 테이블이 있습니다. 표가 페이지 왼쪽에 나타나도록 요구하지만(가능합니다) 캡션은 페이지 중앙에 있습니다. 캡션을 표 아래에 배치하고 표 아래 중앙에 표시하고 싶습니다. 출력은 아래와 같습니다.여기에 이미지 설명을 입력하세요

\documentclass[12pt,english]{article}
\usepackage{caption}
\begin{document}
 \begin{table}[H]
 \begin{tabular}{|c|>{\centering}p{2cm}|}
 \hline 
  Year & Population (millions)\tabularnewline
  \hline 
   $1900$ & $1650$\tabularnewline
   $1910$ & $1750$\tabularnewline
   $1920$ & $1860$\tabularnewline
   $1930$ & $2070$\tabularnewline
   $1940$ & $2300$\tabularnewline
   $1950$ & $2560$\tabularnewline
   $1960$ & $3040$\tabularnewline
   $1970$ & $3710$\tabularnewline
   $1980$ & $4450$\tabularnewline
   $1990$ & $5280$\tabularnewline
   $2000$ & $6070$\tabularnewline
   \hline 
  \end{tabular}
  \raggedright{}\caption{World Population}\label{table1}
  \end{table}
 \end{document}

답변1

방법은 다음과 같습니다(이미 [H]옵션을 원하고 패키지를 로드했으므로 caption괜찮을 것 같습니다).

\documentclass[12pt,english]{article}
\usepackage{caption}
\usepackage{array}
\begin{document}
 % A \noindent is possibly needed here as @Mico suggested in his comment
 \noindent\begin{minipage}{0.35\textwidth}
 \centering
 \begin{tabular}{|c|>{\centering}p{2cm}|}
 \hline 
  Year & Population (millions)\tabularnewline
  \hline 
   $1900$ & $1650$\tabularnewline
   $1910$ & $1750$\tabularnewline
   $1920$ & $1860$\tabularnewline
   $1930$ & $2070$\tabularnewline
   $1940$ & $2300$\tabularnewline
   $1950$ & $2560$\tabularnewline
   $1960$ & $3040$\tabularnewline
   $1970$ & $3710$\tabularnewline
   $1980$ & $4450$\tabularnewline
   $1990$ & $5280$\tabularnewline
   $2000$ & $6070$\tabularnewline
   \hline 
  \end{tabular}
  \captionof{table}{World Population}\label{table1}
  \end{minipage}
 \end{document}

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

답변2

표 형식 자료는 왼쪽 플러시(일명 비정형 오른쪽)로 조판되어야 하므로 캡션도 왼쪽 플러시로 설정하면 더 보기 좋을 것 같습니다. (그러나 다른 해결 방법은 아래를 참조하십시오.) caption옵션 singlelinecheck=falsejustification=raggedright.

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

\documentclass[12pt,english]{article}
\usepackage{array,caption}
\captionsetup{singlelinecheck=false,justification=raggedright}
\begin{document}
\begin{table}[ht!]
 \begin{tabular}{|c|>{\centering\arraybackslash}p{2cm}|}
 \hline 
   Year & Population (millions)\\ \hline 
   $1900$ & $1650$\\
   $1910$ & $1750$\\
   $1920$ & $1860$\\
   $1930$ & $2070$\\
   $1940$ & $2300$\\
   $1950$ & $2560$\\
   $1960$ & $3040$\\
   $1970$ & $3710$\\
   $1980$ & $4450$\\
   $1990$ & $5280$\\
   $2000$ & $6070$\\ 
 \hline 
 \end{tabular}
\caption{World Population}\label{table1}
\end{table}
\end{document}

또는 캡션의 경우~ 해야 하다tabular재료 아래 중앙에 위치그리고자료 tabular는 왼쪽 플러시로 조판되어야 합니다. (a) run \captionsetup{justification=centering}, (b) 다음을 로드하는 것이 좋습니다.세 부분으로 나눌 수 있는패키지, (c) 환경 tabular\caption명령문을 모두 환경에 넣습니다 threeparttable. 이 설정을 통해 LaTeX는 자료의 너비를 측정 tabular하고 캡션을 표 아래 중앙에 배치할 수 있습니다. 필요한 경우 LaTeX는 자동으로 캡션에 줄 바꿈을 삽입합니다. 이 동작은 다음 스크린샷에 나와 있습니다.

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

\documentclass[12pt,english]{article}
\usepackage{array,caption,threeparttable}
\captionsetup{justification=centering}
\begin{document}
\begin{table}[ht!]
\begin{threeparttable}
 \begin{tabular}{|c|>{\centering\arraybackslash}p{2cm}|}
 \hline 
   Year & Population (millions)\\ \hline 
   $1900$ & $1650$\\
   $1910$ & $1750$\\
   $1920$ & $1860$\\
   $1930$ & $2070$\\
   $1940$ & $2300$\\
   $1950$ & $2560$\\
   $1960$ & $3040$\\
   $1970$ & $3710$\\
   $1980$ & $4450$\\
   $1990$ & $5280$\\
   $2000$ & $6070$\\ 
 \hline 
 \end{tabular}
\caption{World Population}\label{table1}
\end{threeparttable}
\end{table}
\end{document}

관련 정보