次の表にタイトルとメモを追加しようとしています。
\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
、ページをまたいで分割される表に使用される との構文の違いを説明します。 と\extrarowheight
の規則にいくつかの改良を加えました。 では、さまざまな太さの規則booktabs
が導入され、これらの規則に垂直方向のパディングが追加されています。
\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) これまで対処されていない主要な書式設定タスクの 1 つが、表形式の資料が を超えないようにすることであるため、環境を使用することはそれほど有用では\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
テーブルが非常に長く、2 ページに分割する必要がある場合は、 、 を使用することを検討してください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}
2 回のコンパイル後の表は次のようになります。
補遺: 考慮するウナコメント、表の最初の部分の上部にメモが付いた表のバージョンは次のとおりです。
\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}