Подтвердить что ты не робот

Выравнивание столбца в tabularx

Я хочу правильно выровнять последний столбец. В конце есть дополнительное пространство. Пожалуйста, дайте мне знать, как это сделать. Благодарю.

\documentclass[11pt]{article}
\usepackage{setspace}                                   %double spacing and spacing in tables                           
\usepackage{amsmath}                                    %equations etc. in latex
\usepackage[capposition=top]{floatrow}                  %so that the caption for figures appear at the top
\usepackage[tablename=TABLE,figurename = FIGURE,labelsep=newline,aboveskip=0pt,font=bf,justification=centering]{caption}   %so that caption looks cool
\usepackage{booktabs}                                   %midrule etc. which adds space around lines. Make tables look good. 
\usepackage{tabularx}                                   %use tabularx environment for creating one page tables
\usepackage[margin=1in]{geometry}                       %defining the margin for the page
\usepackage[autostyle]{csquotes}                        %for quotes. alternative would be " and "
\usepackage[table]{xcolor}                              %rowcolor, cellcolor, color for references
\usepackage{pdflscape}                                  %landscape and keep the pages straight
\usepackage{everypage}                                  %For AddEveryHookPage
\usepackage{hanging}                                    %For references
\usepackage{longtable}                                  %For multiple pages
\usepackage{multirow}                                   %Valuable package as can be seen from table 5,8, and 10
\usepackage{graphicx}                                   %created line using this package
\usepackage{bm}                                         %bold and italics in the math enviornment at the same time
\usepackage{dcolumn} % a package actually used in this example

\def\hang{\par\noindent\makebox[1.5em][l]{ }\hangindent1.5em} %hanging indent  

\makeatletter
\setlength{\@fptop}{0pt}                                %to make tables and figures start at the top of the page
\makeatother

\newcommand{\Lpagenumber}{\ifdim\textwidth=\linewidth\else\bgroup       %to correct the page numbering for landscape pages
    \dimendef\margin=0
    \ifodd\value{page}\margin=\oddsidemargin
    \else\margin=\evensidemargin
    \fi
    \raisebox{\dimexpr -\topmargin-\headheight-\headsep-0.5\linewidth}[0pt][0pt]{%
        \rlap{\hspace{\dimexpr \margin+\textheight+\footskip}%
            stabu            \llap{\rotatebox{90}{\thepage}}}}%
    \egroup\fi}
\AddEverypageHook{\Lpagenumber}%                        %to correct the page numbering for landscape pages


\newcolumntype{Y}{>{\centering\arraybackslash}X}        %to center the columns for tabularx environment
\newcolumntype{Z}{>{\centering\arraybackslash}p{0.75in}}    %to center the columns for tabularx environment
\newcolumntype{K}{>{\centering\arraybackslash}p{0.3in}} %to center the columns for tabularx environment
\newcommand{\gmc}[3]{\multicolumn{#1}{@{}#[email protected]{}}{#3}}    %short form for multicolumn
\doublespacing                                          %make lines double spaced



\begin{document}
    \setcounter{page}{-1} %start numbering at page 3 (2 - n where n = -1)
    \thispagestyle{empty} %suppress page number

    \begingroup % keep any font size changes local to group
    \captionof{table}{\textbf{Descriptive Statistics}}
    \singlespacing
    \footnotesize
    \centering
    \setlength\tabcolsep{3pt} %default
    \renewcommand{\arraystretch}{1}


    \begin{tabularx}{\textwidth}{@{\extracolsep{\fill}}l*{2}{c}}
        \gmc{3}{l}{\textbf{Panel A: Sample Representation across Economic Sectors}} \\\midrule   
        \textbf{Sector} & \textbf{N} & \textbf{\% Frequency} \\\midrule
        Energy & 524 & 1.65\%                       \\
        Materials & 2,648 & 8.34\%                  \\
        Industrials & 5,905   &     18.60\%             \\
        Consumer Discretionary & 5,549  & 17.48\%       \\
        Consumer Staples & 2,174 & 6.85\%       \\
        Health Care & 5,167 & 16.28\%               \\
        Financials & 0 & 0.00\%             \\
        Information Technology & 9,774 & 30.79\%        \\
        Telecommunication Services & 0 & 0.00\% \\
        Utilities & 0 & 0.00\%              \\\midrule
        Total & 31,741 & 100.00\%               \\\midrule
    \end{tabularx}
    \endgroup

\end{document} 
4b9b3361

Ответ 1

Если вы просто хотите, чтобы у него не было места для последнего столбца, вы можете замените

    \begin{tabularx}{\textwidth}{@{\extracolsep{\fill}}l*{2}{c}}

с:

    \begin{tabularx}{\textwidth}{l Y r}