如何在表格内设置不同的字体大小?

如何在表格内设置不同的字体大小?

我们需要表格来呈现详细信息,因此我们需要通过在表格行内创建具有不同字体大小的表格来突出显示一些信息,如下所示:

在此处输入图片描述

代码 :

答案1

为了得到这样的结果

在此处输入图片描述

我们必须为特定的文本使用这些字体大小,我们需要使用,\tiny\scriptsize\footnotesize\small\normalsize,和括号内设置其大小\large\Large\LARGE\huge\Huge

代码 :

    \documentclass[a4paper,12pt]{article}
    \usepackage{graphicx}
    \usepackage{amsmath}
    \usepackage{algorithm}
    \usepackage[noend]{algpseudocode}
    \usepackage{array}
    \usepackage{multirow}
    \usepackage{booktabs}
    \usepackage{makecell}

    \usepackage[margin=2cm]{geometry}
    \usepackage{adjustbox} 

    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{verbatim}

    \begin{document}

    \begin{center}
        \begin{table}[!htbp]
        \centering

        \begin{tabular}{p{3cm} | p{3cm} | p{3cm}}
            \hline
            \hline
            {\LARGE Result 1} & {\huge Result 2} & {\Huge Result 3} \\  
            \hline
            (a) {\Large text} & (b) {\large text} & (c) {\normalsize text}\\ 
            \hline
            (c) {\small text} & (d) {\footnotesize text} & (e) {\scriptsize text}\\
            \hline
            (f) {\tiny text} & (g) {\huge text} & (h) {\Huge text}\\
            \hline
        \end{tabular}

    \end{table}\end{center}

    \end{document}

上表代码如下:

    \documentclass[a4paper,12pt]{article}
    \usepackage{graphicx}
    \usepackage{amsmath}
    \usepackage{algorithm}
    \usepackage[noend]{algpseudocode}
    \usepackage{array}
    \usepackage{multirow}
    \usepackage{booktabs}
    \usepackage{makecell}

    \usepackage[margin=2cm]{geometry}
    \usepackage{adjustbox} 

    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{verbatim}

    \begin{document}


    \begin{figure}[htbp]
      \centering
      \renewcommand{\arraystretch}{1.18}
        \begin{tabular}{ccc}
            \includegraphics[width=.145\textwidth]{example-image-a} 
            \includegraphics[width=.145\textwidth]{example-image-a}&&
            \includegraphics[width=.145\textwidth]{example-image-a}
            \includegraphics[width=.145\textwidth]{example-image-a}\\
            {\Large(a)} {\small text text} & & {\Large(b)} {\small text text}\\
            \includegraphics[width=.145\textwidth]{example-image-b} 
            \includegraphics[width=.145\textwidth]{example-image-b}&&
            \includegraphics[width=.145\textwidth]{example-image-b}
            \includegraphics[width=.145\textwidth]{example-image-b}\\        
            {\Large(c)} {\small text text} & & {\Large(d)} {\small text text}\\
            \includegraphics[width=.145\textwidth]{example-image-c} 
            \includegraphics[width=.145\textwidth]{example-image-c}&&
            \includegraphics[width=.145\textwidth]{example-image-c}
            \includegraphics[width=.145\textwidth]{example-image-c}\\
            {\Large(e)} {\small text text} & & {\Large(f)} {\small text text}\\
        \end{tabular}
        \caption{results.}
        \label{fig:figure_A}
    \end{figure}    

    \end{document}

相关内容