表格及其註釋內的對齊問題

表格及其註釋內的對齊問題

為了解釋我的問題,請看這張表:

在此輸入影像描述

1)我想讓紅色部分更靠近中間,這樣三列就更居中了。

2)我想將藍色部分對齊在一條垂直線上。我嘗試使用{flalign*},但這會將方程式與頂部的列對齊,而不是“盈利能力計算”。

這是我使用的程式碼:

\documentclass[12pt]{article}
\usepackage{setspace,amsmath,graphicx,float}
\usepackage[english]{babel}
\usepackage{boldline}
\usepackage{array}
\usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{times}
\usepackage{threeparttable}
\usepackage[margin=1cm]{caption}
\usepackage{amssymb}
\usepackage{tabularx}

\begin{document}
\begin{table}[H]
\centering
\small
\caption[xxx]{Example calculation for a two-product SSNIP test \citep{QuantTech}.}
\begin{threeparttable}
\begin{tabularx}{\textwidth}{p{20em} >{\centering\arraybackslash}p{8em}  >{\centering\arraybackslash}p{7em}}    
\hlineB{3}
  & Product 1 & Product 2  \\ \hline
Margin & 10\% & 20\% \\
Diversion ratio & 0.29 & 0.5 \\ 
Own-price elasticity of demand & 2 & 4 \\ 
Ratio of prices $p_2 / p_1$ & 1 & 1 \\                       
\hlineB{3}
\end{tabularx}
\begin{tablenotes}
\setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}
\setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}
\item Profitability calculation:\\
\begin{align*}
\frac{p_1 - c_1}{p_1} \overset{?}{\leqslant} \frac{1}{\eta_{11}(p_1,p_2.\ldots,p_J)} + \frac{p_2 - c_2}{p_2} \frac{p_2}{p_1} DR_{12}, \qquad 0.1 \leqslant \frac{1}{2} + 0.2 \times 1 \times 0.29 = 0.56
 \end{align*}

\begin{align*}
\frac{p_2 - c_2}{p_1} \overset{?}{\leqslant} \frac{1}{\eta_{22}(p_1,p_2.\ldots,p_J)} + \frac{p_1 - c_1}{p_1} \frac{p_1}{p_2} DR_{21}, \qquad 0.2 \leqslant \frac{1}{4} + 0.1 \times 1 \times 0.5 = 0.30
\end{align*}

\end{tablenotes}
\end{threeparttable}
\label{ExampleSSNIP}   
\end{table}
\end{document}

我很感激任何幫助 - 謝謝!

答案1

如果您確實希望表格填充文字寬度(您不應該這樣做,除非您正在進行兩列排版),至少不要使用\small.

在這種情況下,你不需要threeparttable。只需使用\raggedright.

我用過newtxtextnewtxmath。可以使用mathptmx(但效果較差);times如果你的文件中有數學,就永遠不要使用。

\documentclass[12pt]{article}
\usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}
\usepackage{booktabs}
\usepackage{natbib}
\usepackage[margin=1cm]{caption}

\begin{document}
\begin{table}

\caption[xxx]{Example calculation for a two-product SSNIP test \citep{QuantTech}.}
\label{ExampleSSNIP}   

\centering

\begin{tabular*}{\textwidth}{
  @{\hspace{.1\textwidth}\extracolsep{\fill}}
  l c c
  @{\hspace{.1\textwidth}}
}
\toprule
                               & Product 1 & Product 2 \\
\midrule
Margin                         & 10\%      & 20\%      \\
Diversion ratio                & 0.29      & 0.5       \\
Own-price elasticity of demand & 2         & 4         \\
Ratio of prices $p_2 / p_1$    & 1         & 1         \\
\bottomrule
\end{tabular*}

\medskip

\raggedright
Profitability calculation:\\[\medskipamount]
$\begin{alignedat}{2}
\frac{p_1 - c_1}{p_1} &\overset{?}{\leqslant} 
  \frac{1}{\eta_{11}(p_1,p_2.\dots,p_J)} + \frac{p_2 - c_2}{p_2} \frac{p_2}{p_1} DR_{12},
  &\qquad& 0.1 \leqslant \frac{1}{2} + 0.2 \times 1 \times 0.29 = 0.56
\\
\frac{p_2 - c_2}{p_1} &\overset{?}{\leqslant} 
  \frac{1}{\eta_{22}(p_1,p_2.\dots,p_J)} + \frac{p_1 - c_1}{p_1} \frac{p_1}{p_2} DR_{21},
  &\qquad& 0.2 \leqslant \frac{1}{4} + 0.1 \times 1 \times 0.5 = 0.30
\end{alignedat}$

\end{table}

\end{document}

而不是boldrule我用的booktabs。調整第一列之前和最後一列之後的間距;但我的建議是不是人為地擴展表,特別是當它們包含如此少量的列時。

注意應該\ldots\dots.

在此輸入影像描述

答案2

這是一個解決方案,帶有flushlefttablenotes 選項,以及用於包裝環境fleqn的環境 from ,其效果是使用 | fleqn amsmath` 局部用於一組方程式。nccmathalign*option from

我還用 替換了過時的timesnewtx,它使用 Times 克隆 (TeX Gyre Termes)。

\documentclass[12pt]{article}
\usepackage{setspace,amsmath,graphicx,float}
\usepackage[english]{babel}
\usepackage{boldline}
\usepackage{array}
\usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{newtxtext, newtxmath}
\usepackage{threeparttable}
\usepackage[margin=1cm]{caption}
\usepackage{amssymb}
\usepackage{tabularx}
\usepackage{nccmath}


 \begin{document}

\begin{table}[H]
  \centering
  \small
  \caption[xxx]{Example calculation for a two-product SSNIP test.}% \citep{QuantTech}
  \begin{threeparttable}
    \begin{tabularx}{\textwidth}{p{20em} >{\centering\arraybackslash}p{8em} >{\centering\arraybackslash}p{7em}}
      \hlineB{3}
                                     & Product 1 & Product 2 \\ \hline
      Margin & 10\,\% & 20\,\% \\
      Diversion ratio & 0.29 & 0.5 \\
      Own-price elasticity of demand & 2 & 4 \\
      Ratio of prices $p_2/p_1 $ & 1 & 1 \\
      \hlineB{3}
    \end{tabularx}
    \begin{tablenotes}[flushleft]
      \setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}
      \setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}
      \item Profitability calculation:
      \begin{fleqn}[\fontdimen2\font]
        \begin{align*}
          \frac{p_1 - c_1}{p_1} & \overset{?}{\leqslant} \frac{1}{\eta_{11}(p_1,p_2.\ldots,p_J)} + \frac{p_2 - c_2}{p_2} \frac{p_2}{p_1} DR_{12}, & 0.1 & \leqslant \frac{1}{2} + 0.2 × 1 × 0.29 = 0.56 \\%
          \frac{p_2 - c_2}{p_1} & \overset{?}{\leqslant} \frac{1}{\eta_{22}(p_1,p_2.\ldots,p_J)} + \frac{p_1 - c_1}{p_1} \frac{p_1}{p_2} DR_{21}, & 0.2 & \leqslant \frac{1}{4} + 0.1 × 1 × 0.5 = 0.30
        \end{align*}
      \end{fleqn}
    \end{tablenotes}
  \end{threeparttable}
  \label{ExampleSSNIP}
\end{table}

\end{document} 

在此輸入影像描述

不過我建議這個基於 的程式碼,tabulary在我看來它看起來很無聊:

\documentclass[12pt]{article}
\usepackage{setspace,amsmath,graphicx,float}
\usepackage[english]{babel}
\usepackage{boldline}
\usepackage{array}
\usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{newtxtext, newtxmath}
\usepackage{threeparttable}
\usepackage[margin=1cm]{caption}
\usepackage{amssymb}
\usepackage{tabularx, tabulary}
\usepackage{nccmath}


 \begin{document}

\begin{table}[H]
  \centering
  \small\setlength\extrarowheight{2pt}
  \caption[xxx]{Example calculation for a two-product SSNIP test.}% \citep{QuantTech}
  \begin{threeparttable}
    \begin{tabulary}{\textwidth}{L>{\centering\arraybackslash}p{8em} >{\centering\arraybackslash}p{8em}@{}}%p{20em} \hlineB{3}
                                     & Product 1 & Product 2 \\ \hlineB{3}
      Margin & 10\,\% & 20\,\% \\
      Diversion ratio & 0.29 & 0.5 \\
      Own-price elasticity of demand & 2 & 4 \\
      Ratio of prices $p_2 / p_1$ & 1 & 1 \\
      \hlineB{3}
    \end{tabulary}
    \begin{tablenotes}[flushleft]\footnotesize
      \setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}
      \setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}
      \item Profitability calculation:
      \begin{fleqn}[\fontdimen2\font]
        \begin{align*}
          \frac{p_1 - c_1}{p_1} & \overset{?}{\leqslant} \frac{1}{\eta_{11}(p_1,p_2.\ldots,p_J)} + \frac{p_2 - c_2}{p_2} \frac{p_2}{p_1} DR_{12}, & 0.1 & \leqslant \frac{1}{2} + 0.2 \times 1 \times 0.29 = 0.56 \\%
          \frac{p_2 - c_2}{p_1} & \overset{?}{\leqslant} \frac{1}{\eta_{22}(p_1,p_2.\ldots,p_J)} + \frac{p_1 - c_1}{p_1} \frac{p_1}{p_2} DR_{21}, & 0.2 & \leqslant \frac{1}{4} + 0.1 \times 1 \times 0.5 = 0.30
        \end{align*}
      \end{fleqn}
    \end{tablenotes}
  \end{threeparttable}
  \label{ExampleSSNIP}
\end{table}

\end{document} 

在此輸入影像描述

相關內容