如何才能使表格的左右边距相等而不改变其字体大小?

如何才能使表格的左右边距相等而不改变其字体大小?

当我adjustbox修改表格宽度时,字体大小也会改变。如何增加表格宽度,但又让它均匀地超出两个边距?

在此处输入图片描述

我的MWE

\documentclass{elsarticle}


    \usepackage{ragged2e}


    % ========== Caption packages ==========
    \usepackage{caption}

    % ========== Table packages ==========
    \usepackage{tabularx}
% BEGIN_FOLD

        \newcolumntype{L}{ >{\arraybackslash \RaggedRight}X }       
        \newcolumntype{C}{ >{\arraybackslash \Centering}X }
        \newcolumntype{R}{ >{\arraybackslash \RaggedLeft}X }
        \newcolumntype{J}{ >{\arraybackslash\justifying} X }        
        \renewcommand{\tabularxcolumn}[1]{ >{\centering}m{#1} }

        \newcommand{\scalelinespace}[1]{
            \rule{0pt}{#1\normalbaselineskip}
                                        }

% END_FOLD

    \usepackage{booktabs}
    \usepackage{makecell}
    \usepackage[flushleft]{threeparttable}

    % ========== Figures and tables locations packages ==========
    \usepackage{float}
    \usepackage{adjustbox}

    % ========== Font encoding packages ==========
    \usepackage[T1]{fontenc}
    \usepackage{fontspec}
% BEGIN_FOLD

    \setmainfont{TeX Gyre Pagella}
    \setmonofont{Courier}
    \newcommand{\textffam}[2]{{\fontencoding{T1} \fontfamily{#1} \selectfont#2}}

% END_FOLD

    % ========== Equations and math packages ==========
    \usepackage{amsmath}
    \usepackage{amssymb, amsfonts}
    \usepackage{stackengine}




\begin{document}

\begin{table*}[htp]

\begin{adjustbox}{width=1.5\textwidth, center}  

    \begin{threeparttable}

            % Table options

            % Caption
            \caption{Determination of Critical Lines Among RESs Based on Operational Interaction Operators}
            \label{table:critical_lines_w_ij_hat}


            % Center the table
            \centering

            \newcommand{\setfontsizeTable}{\fontsize{9}{9} \selectfont}

            \begin{tabularx}{1\textwidth}{c ||>{\hsize=0.5\hsize \setfontsizeTable}C >{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C}

                \toprule

                \adjustbox{rotate=90, valign=c}{Quadrant} & \adjustbox{rotate=90, valign=c}{POI $i$} & \adjustbox{rotate=90, valign=c}{POI $j$} & \multicolumn{3}{c|}{Other POIs} &
                Critical Line Based on $\displaystyle \angle \bar{w}_{ij}$ or $\displaystyle \left| \bar{w}_{ij} \right|$ & Actual Critical Line (based on [Eq]) & $\displaystyle \left| S_{eq, \thinspace i} \right|$ & $\displaystyle \mathit{SDSCR}_{i}$ & $\displaystyle \frac{\mathit{Max} \medspace \mathit{SDSCR}_{i}}{\textit{Mean} \medspace \mathit{SDSCR}_{i}}$
                \\
                \Xhline{0.25mm}

                \scalelinespace{1.3} \adjustbox{rotate=90, valign=c}{III} & 101 & 64  & 96 & 106 & 37 & 86-87 & 86-87 & 4.38 & 2.02 & 1.41
                \\

                \scalelinespace{1.3} \adjustbox{rotate=90, valign=c}{IV} & 79 & 96  & 9 & 81 & 33 & 9-10 & 9-10 & 3.40 & 5.13 & 1.28
                \\

                \scalelinespace{1.3} \adjustbox{rotate=90, valign=c}{
                    \Shortstack[c]{{III} {IV \textsuperscript{a}}}
                                                                    }
                & 97 & 60  & 39 & 37 & 86 & 43-44 & 43-44 & 3.98 & 3.18 & 1.07
                \\

                \bottomrule
            \end{tabularx}

            \begin{tablenotes}

                \item[a] angles of $\displaystyle \angle \bar{w}_{ij}$ exist in both quadrants

            \end{tablenotes}

    \end{threeparttable}

\end{adjustbox}

\end{table*}

\end{document}

答案1

你写了,

我使用是adjustbox因为我想将表格扩展到默认边距之外,

对于手头的表格,没有必要使其比文本块更宽。只需发出\small\footnotesize指令即可。当然,不要求助于设备adjustbox

另一个观察是:您正在使用fontspec包并使用TeX Gyre Pagella文本字体。要使用兼容的数学字体,我建议您加载包unicode-math(它会自动加载fontspec包)并发出指令\setmathfont{TeX Gyre Pagella Math}

而且,不需要C为所有 10 列都使用列类型。实际上,您只需要C为两列使用该类型;对于其他 8 列,只需使用普通c列类型即可。

在此处输入图片描述

\documentclass{elsarticle}
\usepackage{ragged2e}

\usepackage{tabularx}
\newcolumntype{C}{ >{\Centering\arraybackslash }X }
\renewcommand{\tabularxcolumn}[1]{>{\centering}m{#1}}

\usepackage[flushleft]{threeparttable}
\usepackage{adjustbox}
\usepackage{amsmath,amssymb}

\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}

\begin{document}

\begin{table*}[htp] 
\setlength\tabcolsep{5pt}
\setlength\extrarowheight{2pt}
\footnotesize
\begin{threeparttable}
\caption{Determination of critical lines among RESs based on operational interaction operators}
\label{table:critical_lines_w_ij_hat}

\begin{tabularx}{\textwidth}{@{} c | ccccc | *{2}{C} ccc @{}}
\hline
\adjustbox{rotate=90, valign=c}{Quadrant} & 
\adjustbox{rotate=90, valign=c}{POI $i$} & 
\adjustbox{rotate=90, valign=c}{POI $j$} & 
\multicolumn{3}{c|}{Other POIs} 
& Critical line based on $\angle\bar{w}_{\!ij}$ or $| \bar{w}_{\!ij}|$ 
& Actual Critical Line (based on [Eq]) 
& $| S_{\mathit{eq},i}|$ 
& $\mathit{SDSCR}_{i}$ 
& $\frac{\max \mathit{SDSCR}_{i}}{\mathrm{mean}\,\mathit{SDSCR}_{i}}$
\\
\hline
III & 101 & 64  & 96 & 106 & 37 & 86-87 & 86-87 & 4.38 & 2.02 & 1.41
\\
IV & 79 & 96  & 9 & 81 & 33 & 9-10 & 9-10 & 3.40 & 5.13 & 1.28
\\
III, IV\tnote{a} & 97 & 60  & 39 & 37 & 86 & 43-44 & 43-44 & 3.98 & 3.18 & 1.07
\\
\hline
\end{tabularx}

\begin{tablenotes}
\item[a] Angles of $\angle \bar{w}_{\!ij}$ exist in both quadrants.
\end{tablenotes}
\end{threeparttable}
\end{table*}

\end{document}

答案2

在此处输入图片描述

在开始表格之前使用\begin{adjustwidth}{-0.5<text width increase>}{0em}。在表格前言中,使用1.<textwidth increase factor>。例如。如果您想将表格宽度增加 0.3 倍的文本宽度,请在前言中使用\begin{adjustwidth}{-0.15\textwidth}{0em}和。使用 的主要目的是将表格向左移动相当于表格宽度增加量的一半,从而确保表格将均匀地超出两个边距。{1.3\textwidth}tabularx\begin{adjustwidth}{0.5<text width increase>}{0em}

这是完整的 MWE

\documentclass{elsarticle}


    \usepackage{ragged2e}


    % ========== Caption packages ==========
    \usepackage{caption}

    % ========== Table packages ==========
    \usepackage{tabularx}
% BEGIN_FOLD

        \newcolumntype{L}{ >{\arraybackslash \RaggedRight}X }       
        \newcolumntype{C}{ >{\arraybackslash \Centering}X }
        \newcolumntype{R}{ >{\arraybackslash \RaggedLeft}X }
        \newcolumntype{J}{ >{\arraybackslash\justifying} X }        
        \renewcommand{\tabularxcolumn}[1]{ >{\centering}m{#1} }

        \newcommand{\scalelinespace}[1]{
            \rule{0pt}{#1\normalbaselineskip}
                                        }

% END_FOLD

    \usepackage{booktabs}
    \usepackage{makecell}
    \usepackage[flushleft]{threeparttable}

    % ========== Figures and tables locations packages ==========
    \usepackage{float}
    \usepackage{adjustbox}

    % ========== Font encoding packages ==========
    \usepackage[T1]{fontenc}
    \usepackage{fontspec}
% BEGIN_FOLD

    \setmainfont{TeX Gyre Pagella}
    \setmonofont{Courier}
    \newcommand{\textffam}[2]{{\fontencoding{T1} \fontfamily{#1} \selectfont#2}}

% END_FOLD

    % ========== Equations and math packages ==========
    \usepackage{amsmath}
    \usepackage{amssymb, amsfonts}
    \usepackage{stackengine}


    \usepackage{changepage}


\begin{document}

\begin{table*}[htp]

\begin{adjustwidth}{-0.25\textwidth}{0em}

    \begin{threeparttable}

            % Table options

            % Caption
            \caption{Determination of Critical Lines Among RESs Based on Operational Interaction Operators}
            \label{table:critical_lines_w_ij_hat}


            % Center the table
            \centering

            \begin{tabularx}{1.5\textwidth}{c ||>{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C >{\hsize=0.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C |>{\hsize=1.5\hsize}C}

                \toprule

                \adjustbox{rotate=90, valign=c}{Quadrant} & \adjustbox{rotate=90, valign=c}{POI $i$} & \adjustbox{rotate=90, valign=c}{POI $j$} & \multicolumn{3}{c|}{Other POIs} &
                Critical Line Based on $\displaystyle \angle \bar{w}_{ij}$ or $\displaystyle \left| \bar{w}_{ij} \right|$ & Actual Critical Line (based on [Eq]) & $\displaystyle \left| S_{eq, \thinspace i} \right|$ & $\displaystyle \mathit{SDSCR}_{i}$ & \maxsizebox{\hsize}{!}{$\displaystyle \frac{\mathit{Max} \medspace \mathit{SDSCR}_{i}}{\textit{Mean} \medspace \mathit{SDSCR}_{i}}$}
                \\
                \Xhline{0.25mm}

                \scalelinespace{1.3} \adjustbox{rotate=90, valign=c}{III} & 101 & 64  & 96 & 106 & 37 & 86-87 & 86-87 & 4.38 & 2.02 & 1.41
                \\

                \scalelinespace{1.3} \adjustbox{rotate=90, valign=c}{IV} & 79 & 96  & 9 & 81 & 33 & 9-10 & 9-10 & 3.40 & 5.13 & 1.28
                \\

                \scalelinespace{1.3} \adjustbox{rotate=90, valign=c}{
                    \Shortstack[c]{{III} {IV \textsuperscript{a}}}
                                                                    }
                & 97 & 60  & 39 & 37 & 86 & 43-44 & 43-44 & 3.98 & 3.18 & 1.07
                \\

                \bottomrule
            \end{tabularx}

            \begin{tablenotes}

                \item[a] angles of $\displaystyle \angle \bar{w}_{ij}$ exist in both quadrants

            \end{tablenotes}

    \end{threeparttable}

\end{adjustwidth}

\end{table*}



\end{document}

相关内容