이 테이블에 제목과 메모를 추가하는 방법은 무엇입니까?

이 테이블에 제목과 메모를 추가하는 방법은 무엇입니까?

다음 표에 제목과 메모를 추가하려고 합니다.

\documentclass{article}

\usepackage{longtable,pdflscape}

\begin{document}

\begin{longtable}[{l*{6}{c}r}]

    \hline 
     & Gov. Rev & Gov. Exp & Interest Rate & DFPA & GDP & Inflation \\ 
    \hline 
\endhead

    \textit{Business Cycle shock} & + &  & & & + & + \\
    \textit{Monetary Policy shock}  &  & & $-$ & & + & + \\
    \textit{DFPA shock}      & + & $-$ & & $-$ & &  \\
    

\end{longtable}

\end{document}

이것은 나의 시도입니다:

\documentclass{article}
\usepackage{booktabs, caption}
\usepackage{float}
\usepackage[flushleft]{threeparttable}


\begin{document}


\begin{longtable}[{l*{6}{c}r}]
\centering
\begin{threeparttable}
\caption{Identifying Sign Restrictions}
    \hline 
     & Gov. Rev & Gov. Exp & Interest Rate & DFPA & GDP & Inflation \\ 
    \hline 
\endhead

    \textit{Business Cycle shock} & + &  & & & + & + \\
    \textit{Monetary Policy shock}  &  & & $-$ & & + & + \\
    \textit{DFPA shock}      & + & $-$ & & $-$ & &  \\
    
\begin{tablenotes}
\small
\item \textit{Note}: This table shows the sign restrictions on the impulse responses for each identified shock. A \enquote{$+$} means that the impulse response of the variable in question is restricted to be positive for six months following the shock, including the month of impact. Likewise, a \enquote{$-$} indicates a negative response. A blank entry indicates that no restrictions have been imposed.
\end{tablenotes}
\end{threeparttable}    
\end{longtable}

\end{document}

그러나 이것은 내가 얻고 싶은 것을 전달하지 못합니다. 게다가 테이블이 중앙에 위치했으면 좋겠어요.

누구든지 나를 도와줄 수 있나요?

정말 감사합니다!

답변1

페이지에 걸쳐 나누는 테이블에 사용되는 threeparttable 일반 테이블 형식과 의 구문 차이를 설명하겠습니다 . 다양한 두께의 규칙을 도입하고 이러한 규칙에 대해 수직 패딩을 추가하는 규칙 threeparttablex에 몇 가지 개선 사항을 추가했습니다 .\extrarowheightbooktabs

\documentclass{article}
\usepackage{array, booktabs, caption, longtable, booktabs, makecell}
\usepackage{csquotes}
\usepackage{float}
\usepackage[flushleft]{threeparttablex}

\begin{document}

\setlength{\extrarowheight}{2pt}

\begin{ThreePartTable} \centering
\begin{TableNotes}
\small
\item\hskip -\fontdimen2\font\textit{Note}: This table shows the sign restrictions on the impulse responses for each identified shock. A \enquote{$+$} means that the impulse response of the variable in question is restricted to be positive for six months following the shock, including the month of impact. Likewise, a \enquote{$-$} indicates a negative response. A blank entry indicates that no restrictions have been imposed.
\end{TableNotes}
\begin{longtable}{l*{6}{c}r}
\caption{Identifying Sign Restrictions}\\
    \toprule
     & \makecell{Gov.\\ Rev} & \makecell{Gov.\\Exp} & \makecell{Interest\\ Rate} & DFPA & GDP & Inflation \\
    \midrule
\endfirsthead
\midrule
     & \makecell{Gov.\\ Rev} & \makecell{Gov.\\ Exp} &\makecell{Interest\\ Rate} & DFPA & GDP & Inflation \\
    \midrule
\endhead
\bottomrule
\insertTableNotes
\endlastfoot
    \textit{Business Cycle shock} & + & & & & + & + \\
    \textit{Monetary Policy shock} & & & $-$ & & + & + \\
    \textit{DFPA shock} & + & $-$ & & $-$ & & \\
\end{longtable}
\end{ThreePartTable}
\begin{table}[!h]
\begin{threeparttable}
\centering
\caption{Identifying Sign Restrictions}
\begin{tabular}{@{}l*{6}{c}@{}}
    \toprule
     & \makecell{Gov.\\ Rev} & \makecell{Gov.\\ Exp} & \makecell{Interest\\ Rate} & DFPA & GDP & Inflation \\
    \midrule
    \textit{Business Cycle shock} & + & & & & + & + \\
    \textit{Monetary Policy shock} & & & $-$ & & + & + \\
    \textit{DFPA shock} & + & $-$ & & $-$ & & \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\small
\item\hskip -\fontdimen2\font\textit{Note}: This table shows the sign restrictions on the impulse responses for each identified shock. A \enquote{$+$} means that the impulse response of the variable in question is restricted to be positive for six months following the shock, including the month of impact. Likewise, a \enquote{$-$} indicates a negative response. A blank entry indicates that no restrictions have been imposed.
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

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

답변2

(a) 지시문을 사용하지 않고 \tnote, (b) 캡션이 매우 짧고, (c) 주요하지만 지금까지 해결되지 않은 서식 지정 작업 중 하나는 표 형식의 자료가 를 초과하지 않도록 하는 것이므로 \textwidth내 생각에는 환경 을 사용하는 것이 threeparttable그만큼 유용하다는 것입니다.

tabularx헤더 셀에서 줄 바꿈을 허용하는 환경을 사용 하고 tabularx환경 아래에 긴 범례를 일반 텍스트로 조판하면 됩니다.

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

\documentclass{article}
\usepackage{booktabs,tabularx,ragged2e}
\newcolumntype{C}{>{\Centering\hspace{0pt}}X}
\usepackage[skip=0.333\baselineskip]{caption}
\usepackage[english=american]{csquotes} % select suitable language options

\begin{document}
\begin{table}
\setlength\tabcolsep{3.5pt} % default: 6pt
\caption{Identifying Sign Restrictions}
\begin{tabularx}{\textwidth}{@{} >{\itshape}l *{6}{C} @{}}
\toprule 
& Gov. Rev & Gov. Exp & Interest Rate & DFPA & GDP & Inflation \\ 
\midrule

Business Cycle shock  &$+$&   &   &   &$+$&$+$ \\
Monetary Policy shock &   &   &$-$&   &$+$&$+$ \\
DFPA shock            &$+$&$-$&   &$-$&   &    \\
\bottomrule
\end{tabularx}
    
\medskip
\textit{Note}: This table shows the sign restrictions on the impulse responses for each identified shock. A~\enquote{$+$} means that the impulse response of the variable in question is restricted to be positive for six months following the shock, including the month of impact. Likewise, a~\enquote{$-$} indicates a negative response. A blank entry indicates that no restrictions have been imposed.
\end{table}

\end{document}

답변3

테이블이 너무 길어서 두 페이지로 나누어야 하는 경우에는 , 및 (셀 내용 주위에 더 많은 수직 공간을 추가하기 위해) 사용을 고려할 xltabular[referable]{threeparttablex}있습니다 makecell.

\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{booktabs, makecell, xltabular}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[referable, flushleft]{threeparttablex}
\usepackage{csquotes}

\usepackage{lipsum}


\begin{document}
\lipsum[1-4]
\begin{ThreePartTable} 
    \setlength\tabcolsep{3pt} % default: 6pt
    \setcellgapes{2pt}
    \makegapedcells
    \begin{TableNotes}\small
\note{This table shows the sign restrictions on the impulse responses for each identified shock. A \enquote{$+$} means that the impulse response of the variable in question is restricted to be positive for six months following the shock, including the month of impact. Likewise, a \enquote{$-$} indicates a negative response. A blank entry indicates that no restrictions have been imposed.}
    \end{TableNotes}
\begin{xltabular}{\linewidth}{@{}>{\itshape}l *{6}{C} @{}}
\caption{Identifying Sign Restrictions}
\label{tab:lonmngtable}                             \\
    \toprule
     & Gov. Rev 
        & Gov. Exp 
            & Interest Rate 
                & DFPA & GDP & Infla\-tion            \\
    \midrule
\endfirsthead
\caption[]{Identifying Sign Restrictions (cont.)}   \\
    \toprule
     & \makecell{Gov.\\ Rev}
        & \makecell{Gov.\\Exp}
            & \makecell{Interest\\ Rate}
                & DFPA & GDP & Inflation \\
    \midrule
\endhead
    \bottomrule
    \multicolumn{7}{r}{\footnotesize\textit{Continue on the next page}}
\endfoot
    \bottomrule
    \insertTableNotes
\endlastfoot
Business Cycle shock    & + & &     &       & + & + \\
Monetary Policy shock   &   & & $-$ &       & + & + \\
DFPA shock              & + & $-$ & & $-$   &   &   \\
xxxx shock              & + & $-$ & & $-$   &   &   \\
xxxx shock              & + & $-$ & & $-$   &   &   \\
\end{xltabular}
    \end{ThreePartTable}
\end{document}

두 번의 컴파일 후 테이블은 다음과 같습니다.

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

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

부록: 고려하면@우나설명, 다음은 테이블의 첫 번째 부분 상단에 메모가 있는 테이블 버전입니다.

\usepackage[skip=1ex]{caption}
\usepackage{booktabs, makecell, xltabular}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[referable, flushleft]{threeparttablex}
\usepackage{csquotes}

\usepackage{lipsum}


\begin{document}
\lipsum[1-3]
\begin{ThreePartTable} 
    \setlength\tabcolsep{3pt} % default: 6pt
    \setcellgapes{2pt}
    \makegapedcells
    \begin{TableNotes}\small
\note{This table shows the sign restrictions on the impulse responses for each identified shock. A \enquote{$+$} means that the impulse response of the variable in question is restricted to be positive for six months following the shock, including the month of impact. Likewise, a \enquote{$-$} indicates a negative response. A blank entry indicates that no restrictions have been imposed.}
    \end{TableNotes}
\begin{xltabular}{\linewidth}{@{}>{\itshape}l *{6}{C} @{}}
\caption{Identifying Sign Restrictions}
\label{tab:lonmngtable}                             \\                           
    \insertTableNotes                               \\
    
    \toprule
     & Gov. Rev 
        & Gov. Exp 
            & Interest Rate 
                & DFPA & GDP & Infla\-tion            \\
    \midrule
\endfirsthead
\caption[]{Identifying Sign Restrictions (cont.)}   \\
    \toprule
     & \makecell{Gov.\\ Rev}
        & \makecell{Gov.\\Exp}
            & \makecell{Interest\\ Rate}
                & DFPA & GDP & Inflation \\
    \midrule
\endhead
    \bottomrule
    \multicolumn{7}{r}{\footnotesize\textit{Continue on the next page}}
\endfoot
    \bottomrule
\endlastfoot
Business Cycle shock    & + & &     &       & + & + \\
Monetary Policy shock   &   & & $-$ &       & + & + \\
DFPA shock              & + & $-$ & & $-$   &   &   \\
xxxx shock              & + & $-$ & & $-$   &   &   \\
xxxx shock              & + & $-$ & & $-$   &   &   \\
\end{xltabular}
    \end{ThreePartTable}
\end{document}

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

관련 정보