Problema con la alineación dentro de una tabla y sus notas.

Problema con la alineación dentro de una tabla y sus notas.

Para explicar mi problema, mire esta tabla:

ingrese la descripción de la imagen aquí

1) Quiero acercar la parte roja al medio, para que las tres columnas queden más centradas.

2) Quiero alinear la parte azul en una línea vertical. Intenté usar {flalign*}, pero esto alinea las ecuaciones con la columna de la parte superior y no con el "Cálculo de rentabilidad".

Este es el código que uso:

\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}

Agradezco cualquier ayuda, ¡gracias!

Respuesta1

Si realmente desea que su tabla ocupe el ancho del texto (no debería hacerlo, a menos que esté escribiendo dos columnas), al menos no use \small.

No es necesario threeparttable, en este caso. Solo usa \raggedright.

Yo usé newtxtexty newtxmath. Puedes usar mathptmx(pero los resultados son peores); Nunca lo uses timessi tienes matemáticas en tu documento.

\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}

En lugar de boldruleyo usé booktabs. Ajuste la cantidad de espacio antes de la primera columna y después de la última; pero mi consejo esnoexpandir artificialmente las tablas, especialmente si contienen una cantidad tan pequeña de columnas.

Tenga en cuenta que \ldotsdebería ser \dots.

ingrese la descripción de la imagen aquí

Respuesta2

Aquí hay una solución, con la flushleftopción para notas de tabla y el fleqnentorno de nccmathpara ajustar el align*entorno, que tiene el efecto de usar el | fleqn option fromamsmath` localmente, para un grupo de ecuaciones.

También reemplacé el timespaquete obsoleto con newtx, que usa un clon de 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} 

ingrese la descripción de la imagen aquí

Sin embargo, sugiero este código, basado en tabulary, que en mi opinión parece mejor:

\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} 

ingrese la descripción de la imagen aquí

información relacionada