垂直线超出表格高度

垂直线超出表格高度

在编制下表时,我在第 1 列之前和第 1 列之后的最后一行下方出现了一条延伸的垂直线。附图显示了表格在我的报告中的显示方式。我不知道为什么会发生这种情况。有人能解释一下如何删除延伸的垂直线,而不删除表格其余部分中的垂直线吗?

\documentclass{report} 

\usepackage{changes}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[justification=centering]{caption}
\usepackage{amssymb}
\usepackage[gen]{eurosym}  %proper euro sign
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{bm} % for \bm macro
\usepackage[version=4]{mhchem}  %allows chemical formulae
\usepackage{siunitx} %allow SI units
\usepackage{cleveref} %smart referencing, automatic sorting etc.
\usepackage{nomencl}
\usepackage{pdfpages}
\makenomenclature 
\usepackage{tcolorbox}
\usepackage{tabularx}
\usepackage{array}
\usepackage{colortbl}
\usepackage{setspace}
\usepackage{pifont}

\begin{document}   


\begin{table}
    \caption[Characterization techniques per property.]
    {Experimental matrix which shows the used technique to obtain information about a certain material property.}
    \begin{tabular}{|l|l|l|l|l|l|l|l|l|}
    \hline
    \textbf{Property}   & \textbf{ECV}  & \textbf{QSSPC} & \textbf{Sherescan}   & \textbf{PL}   & \textbf{Ellipsometry} & \textbf{SEM}  & \textbf{FTIR}     & \textbf{XRD}  \\ \hline \hiline
    Passivation         & \ding{51}     &                &                      &               &                       &               &                   &               \\ \hline
    Doping profile      &               & \ding{51}      &                      &               &                       &               &                   &               \\ \hline
    Sheet resistance    &               & \ding{51}      & \ding{51}            &               &                       &               &                   &               \\ \hline
    Thickness           & \ding{51}     &                &                      &               & \ding{51}             &\ding{51}      &                   &               \\ \hline
    Crystallinity       &               &                &                      &               &                       &\ding{51}      &                   &\ding{51}      \\ \hline
    Composition         &               &                &                      & \ding{51}     &                       &\ding{51}      &\ding{51}          &               \\ \hline
    Refractive index    &               &                &                      &               & \ding{51}             &               &                   &               \\
    \hline
    \label{tab:experimentmatrix}
    \end{tabular}
\end{table}   

\end{document}

答案1

\label{...} 外部\begin{tabular}和包围的表格环境\end{tabular}。在其当前位置(在最后一个之后\hline但在 之前\end{tabular}),LaTeX 假定在最后一个单元格之后的行中还有另一个已填充的单元格\hline,并在其周围打印相应的垂直线。

由于\label指的是\caption,我建议 之后就立即进行\caption

\documentclass{report} 

\usepackage[justification=centering]{caption}
\usepackage{pifont}

\begin{document}   
\begin{table}
    \caption[Characterization techniques per property.]
    {Experimental matrix which shows the used technique to obtain information about a certain material property.}
    \label{tab:experimentmatrix}
    \begin{tabular}{|l|l|l|l|l|l|l|l|l|}
    \hline
    \textbf{Property}   & \textbf{ECV}  & \textbf{QSSPC} & \textbf{Sherescan}   & \textbf{PL}   & \textbf{Ellipsometry} & \textbf{SEM}  & \textbf{FTIR}     & \textbf{XRD}  \\ \hline \hline
    Passivation         & \ding{51}     &                &                      &               &                       &               &                   &               \\ \hline
    Doping profile      &               & \ding{51}      &                      &               &                       &               &                   &               \\ \hline
    Sheet resistance    &               & \ding{51}      & \ding{51}            &               &                       &               &                   &               \\ \hline
    Thickness           & \ding{51}     &                &                      &               & \ding{51}             &\ding{51}      &                   &               \\ \hline
    Crystallinity       &               &                &                      &               &                       &\ding{51}      &                   &\ding{51}      \\ \hline
    Composition         &               &                &                      & \ding{51}     &                       &\ding{51}      &\ding{51}          &               \\ \hline
    Refractive index    &               &                &                      &               & \ding{51}             &               &                   &               \\
    \hline
    \end{tabular}
\end{table}   
\end{document}

在此处输入图片描述

答案2

大部分主题...您的表格太宽,无法容纳文本宽度。解决方案可以

  • 用于tabularx表环境
  • 旋转列标题

\documentclass{report}

\usepackage{changes}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[justification=centering]{caption}
\usepackage{amssymb}
\usepackage[gen]{eurosym}  %proper euro sign
%\usepackage{amsmath} loaded by mathtools
\usepackage{mathtools}
\usepackage{bm} % for \bm macro
\usepackage[version=4]{mhchem}  %allows chemical formulae
\usepackage{siunitx} %allow SI units
\usepackage{cleveref} %smart referencing, automatic sorting etc.
\usepackage{nomencl}
\usepackage{pdfpages}
\makenomenclature
\usepackage{tcolorbox}
\usepackage{rotating} % added
\usepackage{makecell, % added
            tabularx}
\renewcommand\theadfont{\small\bfseries}
%\usepackage{array} loaded by tabularx
\usepackage{colortbl}
\usepackage{setspace}
\usepackage{pifont}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{table}
    \settowidth\rotheadsize{\theadfont Ellipsometry}
\caption[Characterization techniques per property.]
        {Experimental matrix which shows the used technique to obtain information about a certain material property.}
    \label{tab:experimentmatrix}
    \begin{tabularx}{\linewidth}{
                    |l|
              *{8}{>{\centering\arraybackslash}X|}
                                }
    \hline
\thead{Property}    & \rothead{ECV} & \rothead{QSSPC}       & \rothead{Sherescan}
                    & \rothead{PL}  & \rothead{Ellipsometry}& \rothead{SEM}
                    & \rothead{FTIR}& \rothead{XRD}         \\
    \hline\hline
Passivation         & \ding{51}     &                       &
                    &               &                       &
                    &               &                       \\
    \hline
Doping profile      &               & \ding{51}             &
                    &               &                       &
                    &               &                       \\
    \hline
Sheet resistance    &               & \ding{51}             & \ding{51}
                    &               &                       &
                    &               &                       \\
    \hline
Thickness           & \ding{51}     &                       &
                    &               & \ding{51}             & \ding{51}
                    &               &                       \\
    \hline
Crystallinity       &               &                       &
                    &               &                       & \ding{51}
                    &               & \ding{51}             \\
    \hline
Composition         &               &                       &
                    & \ding{51}     &                       & \ding{51}
                    & \ding{51}     &                       \\
    \hline
Refractive index    &               &                       &
                    &               & \ding{51}             &
                    &               &                       \\
    \hline
\end{tabularx}
    \end{table}
\end{document}

在此处输入图片描述

相关内容