如何使 tabularx 中的每一行的字体大小不同?

如何使 tabularx 中的每一行的字体大小不同?
\begin{landscape}
\begin{table}[!h]\renewcommand{\arraystretch}{1}\addtolength{\tabcolsep}{0 pt}
\centering
\caption{Diagnostic test statistics for all models \& Emerging markets.}
\label{T.55}      
\begin{tabularx}{0.95\linewidth}{lccccc||lccccc}
\hline
\rule{0pt}{12pt}&\multicolumn{5}{c||}{$H(6)$}&\multicolumn{5}{c}{$H(6)$}\\
\hline
\rule{0pt}{12pt} Model &Linear  &Quadratic  &Cubic  &GAM  &KFMR & Model&Linear  &Quadratic  &Cubic  &GAM &KFMR\\
\hline
\rule{0pt}{12pt}\it{Developed}&&&&&&\it {Emerging} &&&&&\\  
France          &4383.99&2005.36&1821.74&1948.91&95.81 & Brazil  &54.97 &37.75  &37.52  &25.39  &11.07\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.000  &0.000  &0.013  &0.086\\
Germany         &817.98 &124.25 &62.88  &59.35  &83.53 &Chile  &17.20   &13.45  &11.08  &12.52  &9.56\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.142  &0.337  &0.522  &0.405  &0.144\\
Italy           &132.74 &134.65 &131.79 &115.64 &110.47&India&25.72 &26.33  &28.56  &27.08  &15.79\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.012  &0.010  &0.005  &0.008  &0.015\\
Japan           &1900.93&2163.24&2192.52&2337.99&451.05&Korea   &94.92  &103.49 &102.98 &105.92 &13.39\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &       &0.000   &0.000  &0.000  &0.000  &0.037\\
Norway          &229.48 &230.47 &293.06 &268.82 &312.29&Malaysia &11.91 &12.57  &9.31   &10.54  &13.07\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.453  &0.401  &0.676  &0.569  &0.042\\
Sweden          &1054.32&75.38  &52.96  &44.84  &55.49 &Mexico &43.77   &30.22  &27.89  &23.55  &19.18\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.003  &0.006  &0.023  &0.004\\
Switzerland     &513.14 &498.66 &413.96 &455.74 &88.40 &Poland &44.50   &45.00  &41.61  &40.49  &25.94\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.000  &0.000  &0.000  &0.000\\
UK              &403.55 &297.95 &274.03 &169.71 &379.99&Russia  &25.77  &25.76  &23.37  &19.01  &19.93\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.012  &0.012  &0.025  &0.088  &0.003\\
USA             &616.13 &598.02 &535.16 &612.09 &23.49 &SouthAfrica     &28.46  &24.02  &24.58  &22.39&17.34\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.005  &0.020  &0.017  &0.033  &0.008\\
\hline
\end{tabularx}
\end{table}
\end{landscape}

答案1

在此处输入图片描述

请始终发布完整的文档,而不仅仅是片段。

tabularx由于没有X列,因此没有执行任何操作,因此我切换到tabular\it自 LaTeX2.09(即 1993 年之前)以来,在 latex 中默认没有定义,除非需要与旧文档兼容,否则不要使用它。您可以使用该array包将字体更改插入每个单元格。

\documentclass[a4paper]{article}

\newcount\rownum
\usepackage{lscape,array}

\begin{document}
\newcommand\rowstyle{\relax\ifodd\rownum\itshape\tiny\fi}
\begin{landscape}
\begin{table}[!h]
%\renewcommand{\arraystretch}{1}
%\addtolength{\tabcolsep}{0 pt}
\centering
\caption{Diagnostic test statistics for all models \& Emerging markets.}
\label{T.55}      
\begin{tabular}{>{\global\advance\rownum1 \rowstyle}l*{5}{>\rowstyle{c}}||>\rowstyle{l}*{5}{>\rowstyle{l}}}
\hline
\rule{0pt}{12pt}&\multicolumn{5}{c||}{$H(6)$}&\multicolumn{5}{c}{$H(6)$}\\
\hline
\rule{0pt}{12pt} Model &Linear  &Quadratic  &Cubic  &GAM  &KFMR & Model&Linear  &Quadratic  &Cubic  &GAM &KFMR\\
\hline
\rule{0pt}{12pt}\normalsize Developed&&&&&&\normalsize Emerging &&&&&\\  
France          &4383.99&2005.36&1821.74&1948.91&95.81 & Brazil  &54.97 &37.75  &37.52  &25.39  &11.07\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.000  &0.000  &0.013  &0.086\\
Germany         &817.98 &124.25 &62.88  &59.35  &83.53 &Chile  &17.20   &13.45  &11.08  &12.52  &9.56\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.142  &0.337  &0.522  &0.405  &0.144\\
Italy           &132.74 &134.65 &131.79 &115.64 &110.47&India&25.72 &26.33  &28.56  &27.08  &15.79\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.012  &0.010  &0.005  &0.008  &0.015\\
Japan           &1900.93&2163.24&2192.52&2337.99&451.05&Korea   &94.92  &103.49 &102.98 &105.92 &13.39\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &       &0.000   &0.000  &0.000  &0.000  &0.037\\
Norway          &229.48 &230.47 &293.06 &268.82 &312.29&Malaysia &11.91 &12.57  &9.31   &10.54  &13.07\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.453  &0.401  &0.676  &0.569  &0.042\\
Sweden          &1054.32&75.38  &52.96  &44.84  &55.49 &Mexico &43.77   &30.22  &27.89  &23.55  &19.18\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.003  &0.006  &0.023  &0.004\\
Switzerland     &513.14 &498.66 &413.96 &455.74 &88.40 &Poland &44.50   &45.00  &41.61  &40.49  &25.94\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.000  &0.000  &0.000  &0.000\\
UK              &403.55 &297.95 &274.03 &169.71 &379.99&Russia  &25.77  &25.76  &23.37  &19.01  &19.93\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.012  &0.012  &0.025  &0.088  &0.003\\
USA             &616.13 &598.02 &535.16 &612.09 &23.49 &SouthAfrica     &28.46  &24.02  &24.58  &22.39&17.34\\
                &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.005  &0.020  &0.017  &0.033  &0.008\\
\hline
\end{tabular}
\end{table}
\end{landscape}



\end{document}

答案2

以下用途collcell以及来自改进的\rowstyle以单元格内容作为参数用于数组/表格单元格的计数器

在此处输入图片描述

\documentclass{article}
\usepackage{pdflscape,array,collcell}% http://ctan.org/pkg/{pdflscape,array,collcell}
% https://tex.stackexchange.com/q/32861/5764
\newsavebox\TBox\newif\iffbox \fboxfalse
\newcommand{\rowstyle}[1]{\ifnum\value{storerow}>3\ifodd\value{storerow}\raisebox{\height}{\itshape\tiny#1}\else#1\fi\fi}
\newcounter{storerow}
\newcolumntype{C}{%
  >{\setcounter{storerow}{\value{tabrow}}\collectcell\rowstyle} 
  c 
  <{\endcollectcell}}

% https://tex.stackexchange.com/q/65649/5764
\makeatletter
\def\insert@column{%
   \the@toks \the \@tempcnta
   \global\advance\c@tabcol\@ne
   \ignorespaces \@sharp \unskip
   \the@toks \the \count@ \relax}

\let\old@arraycr\@arraycr
\def\@arraycr{\global\c@tabcol\z@\global\advance\c@tabrow\@ne\old@arraycr}

\let\old@tabarray\@tabarray
\def\@tabarray{\global\c@tabrow\@ne\global\c@tabcol\z@\old@tabarray}

\makeatother
\newcounter{tabcol}\newcounter{tabrow}

\begin{document}

\begin{landscape}
\begin{table}[p]
  \centering
  \caption{Diagnostic test statistics for all models \& Emerging markets.}
  \label{T.55}      
  \begin{tabular}{l*{5}{C}||l*{5}{C}}
    \hline
    \strut&\multicolumn{5}{c||}{$H(6)$}&&\multicolumn{5}{c}{$H(6)$}\\
    \hline
    \strut Model &Linear  &Quadratic  &Cubic  &GAM  &KFMR & Model&Linear  &Quadratic  &Cubic &GAM &KFMR\\
    \hline
    \strut\textit{Developed} & \multicolumn{5}{c||}{} & \textit{Emerging} & \multicolumn{5}{c}{} \\  
    France          &4383.99&2005.36&1821.74&1948.91&95.81 & Brazil  &54.97 &37.75  &37.52  &25.39  &11.07\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.000  &0.000  &0.013  &0.086\\
    Germany         &817.98 &124.25 &62.88  &59.35  &83.53 &Chile  &17.20   &13.45  &11.08  &12.52  &9.56\\
                   &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.142  &0.337  &0.522  &0.405  &0.144\\
    Italy           &132.74 &134.65 &131.79 &115.64 &110.47&India&25.72 &26.33  &28.56  &27.08  &15.79\\
                   &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.012  &0.010  &0.005  &0.008  &0.015\\
    Japan           &1900.93&2163.24&2192.52&2337.99&451.05&Korea   &94.92  &103.49 &102.98 &105.92 &13.39\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &       &0.000   &0.000  &0.000  &0.000  &0.037\\
    Norway          &229.48 &230.47 &293.06 &268.82 &312.29&Malaysia &11.91 &12.57  &9.31   &10.54  &13.07\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.453  &0.401  &0.676  &0.569  &0.042\\
    Sweden          &1054.32&75.38  &52.96  &44.84  &55.49 &Mexico &43.77   &30.22  &27.89  &23.55  &19.18\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.003  &0.006  &0.023  &0.004\\
    Switzerland     &513.14 &498.66 &413.96 &455.74 &88.40 &Poland &44.50   &45.00  &41.61  &40.49  &25.94\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.000  &0.000  &0.000  &0.000  &0.000\\
    UK              &403.55 &297.95 &274.03 &169.71 &379.99&Russia  &25.77  &25.76  &23.37  &19.01  &19.93\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.012  &0.012  &0.025  &0.088  &0.003\\
    USA             &616.13 &598.02 &535.16 &612.09 &23.49 &SouthAfrica     &28.46  &24.02  &24.58  &22.39&17.34\\
                    &0.000  &0.000  &0.000  &0.000  &0.000 &        &0.005  &0.020  &0.017  &0.033  &0.008\\
    \hline
  \end{tabular}
\end{table}
\end{landscape}
\end{document}

相关内容