在表格单元格中添加图形和文本

在表格单元格中添加图形和文本

我正在制作一个包含一些图形的表格。其中两个单元格也需要在图形底部显示一些文本(不是标题,因此不需要有图号)。文本显示在旁边,而不是居中。{文本为“2X 级联”}

\documentclass{article}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{rotating}
\usepackage{pdflscape}
\begin{document}
    \begin{landscape}
        \begin{table}[]
            \centering
            \caption{Architectural schematics of the presented front-ends with structural details of the core amplifiers.}
            \label{tab:my-table}
            \resizebox{\linewidth}{!}{%
                \begin{tabular}{|c|c|c|c|c|}
                    \hline
                    & FE-I   & FE-II  & FE-III  & FE-IV \\ \hline
                    \raisebox{0.5\height}{\rotatebox[origin=l]{90}{{Architecture}}}
                    & \multicolumn{3}{c|}{\includegraphics[scale=0.28]{Figures/1}} 
                    & \includegraphics[scale=0.2]{Figures/2}  \\ \hline
                    \raisebox{0.4\height}{\rotatebox[origin=l]{90}{{Core Amplifier}}} 
                    & \raisebox{0.1\height}{\includegraphics[scale=0.3]{Figures/3}} {\centering 2X in cascade}
                    & \raisebox{0.1\height}{\includegraphics[scale=0.3]{Figures/3}} {\centering 2X in cascade}
                    & \includegraphics[scale=0.2]{Figures/4}    
                    & \includegraphics[scale=0.3]{Figures/5}  \\ \hline
                \end{tabular}%
            }
        \end{table}
    \end{landscape}
\end{document}

答案1

这是因为c-columns 不接受多行。您需要一个p-column,或者\parbox单元格内的。不过,最简单的方法是添加一个新行并删除\raiseboxes。

如果你需要图片居中,你不能使用第二行技巧(或者你可以,但需要加载多行)。相反,我建议您定义一个命令来拆分第 2 列和第 3 列中的单元格,方法是在单元格内嵌套一个表格,并将新表格与底部基线对齐。参见示例 2。

lscape加载时无需加载pdflscape

示例 1 - 新行 在此处输入图片描述

\documentclass[demo]{article}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{pdflscape, array}

\setlength{\extrarowheight}{2pt}

\begin{document}
    \begin{landscape}
        \begin{table}[]
            \centering
            \caption{Architectural schematics of the presented front-ends with structural details of the core amplifiers.}
            \label{tab:my-table}
            \resizebox{\linewidth}{!}{%
                \begin{tabular}{|c|c|c|c|c|}
                    \hline
                    & FE-I   & FE-II  & FE-III  & FE-IV \\ \hline
                    \raisebox{0.25\height}{\rotatebox[origin=l]{90}{{Architecture}}}
                    & \multicolumn{3}{c|}{\includegraphics[scale=0.28]{Figures/1}} 
                    & \includegraphics[scale=0.2]{Figures/2}  \\ \hline
                    \raisebox{0.15\height}{\rotatebox[origin=l]{90}{{Core Amplifier}}} 
                    & \includegraphics[scale=0.3]{Figures/3}
                    & \includegraphics[scale=0.3]{Figures/3}
                    & \includegraphics[scale=0.2]{Figures/4}    
                    & \includegraphics[scale=0.3]{Figures/5}  \\ 
                    & 2X in cascade
                    & 2X in cascade
                    &&\\
                    \hline
                \end{tabular}%
            }
        \end{table}
    \end{landscape}
\end{document}

示例 2 - 嵌套表格

在此处输入图片描述

\documentclass[demo]{article}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{pdflscape, array}
\usepackage[margin=1.5cm]{geometry}

% Multi-line left-aligned text with manual line breaks.
% The base line of the whole is at the top row.
\newcommand*{\tstack}[1]{%
\multicolumn{1}{c|}{\begingroup        % Add | after the `c` to have vertical lines 
    \renewcommand*{\arraystretch}{1}%
    \begin{tabular}[b]{@{}c@{}}#1\end{tabular}%
  \endgroup
}}

\setlength{\extrarowheight}{2pt}

\begin{document}
    \begin{landscape}
        \begin{table}[thb]
            \centering
            \caption{Architectural schematics of the presented front-ends with structural details of the core amplifiers.}
            \label{tab:my-table}
            \resizebox{\linewidth}{!}{%
                \begin{tabular}{|c|c|c|c|c|}
                    \hline
                    & FE-I   & FE-II  & FE-III  & FE-IV \\ \hline
                    \raisebox{0.25\height}{\rotatebox[origin=l]{90}{{Architecture}}}
                    & \multicolumn{3}{c|}{\includegraphics[scale=0.28]{Figures/1}} 
                    & \includegraphics[scale=0.2]{Figures/2}  \\ \hline
                    \raisebox{0.15\height}{\rotatebox[origin=l]{90}{{Core Amplifier}}} 
                    & \tstack{\includegraphics[scale=0.3]{Figures/3} \\2X in cascade}
                    & \tstack{\includegraphics[scale=0.3]{Figures/3} \\ 2X in cascade}
                    & \includegraphics[scale=0.2]{Figures/4}    
                    & \includegraphics[scale=0.3]{Figures/5}  \\ 
                    \hline
                \end{tabular}%
            }
        \end{table}
    \end{landscape}
\end{document}

相关内容