mdframed 和 tabularx 之间的空格

mdframed 和 tabularx 之间的空格

我正在构建一种信息表,为此我使用了tabularx(用于小文本框架)和mdframed(用于长文本+格式化框架)的组合。

问题发生在这两个结构之间的空间中。我无法正确设置它,而且它在实例之间有所不同。

我需要 MWE 中呈现的颜色和线条格式,因此我使用了 tabularx,但我也愿意接受其他解决方案。

从此图上可以看出间距不连贯。 MWE 输出

这是 MWE:

\documentclass[]{article}
\usepackage[T1]{fontenc}
\usepackage[table]{xcolor}
\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{cellspace}
%\usepackage[showframe]{geometry}
\usepackage[framemethod=TikZ]{mdframed}

\usepackage[defaultfam,tabular,lining]{montserrat} 

\renewcommand*\oldstylenums[1]{{\fontfamily{Montserrat-TOsF}\selectfont #1}}

\mdfdefinestyle{MyFrame}{%
    linecolor=red,
    outerlinewidth=1.5pt,
    innertopmargin=\baselineskip,
    innerbottommargin=\baselineskip,
    innerrightmargin=10pt,
    innerleftmargin=10pt,
    skipabove=0pt,
    skipbelow=0pt}

\newcolumntype{Y}{>{\centering\arraybackslash}X}


\begin{document}

    {\setlength\cellspacetoplimit{12pt}
        \setlength\cellspacebottomlimit{12pt}
        \setlength\arrayrulewidth{2pt}
        \noindent
        \begin{tabularx}{\textwidth}{!{\color{red}\vrule width 2pt}m{2cm}!{\color{red}\vrule width 2pt}S{X}!{\color{red}\vrule width 2pt}}
            \arrayrulecolor{red} \hline
            ID &  Title of the frame \\\hline%
        \end{tabularx}%
    }%
    {\setlength\arrayrulewidth{2pt} 
        \begin{tabularx}{\linewidth}{!{\color{red}\vrule width 2pt}*3{Y}!{\color{red}\vrule width 2pt}}
            \arrayrulecolor{red} \hline
            \rowcolor{lightgray}  1 &  2 & 3\\ \hline
        \end{tabularx}%
    }%
    \begin{mdframed}[style=MyFrame, frametitle={Title} ]
            Here we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long tere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the table

            Here we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long tere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the tableHere we will have a long text, possibly more paragraphs that needs to fit in the table
    \end{mdframed}% 
    {\setlength\arrayrulewidth{2pt}
        \begin{tabularx}{\textwidth}{!{\color{red}\vrule width 2pt}S{X}!{\color{red}\vrule width 2pt}}  
            \arrayrulecolor{red} \hline
                \textbf{Test:} {John Doe}
                \\ \hline
        \end{tabularx}
    }%
    \begin{mdframed}[style=MyFrame, frametitle={Information} ]      
        Here we will have a long text, possibly more paragraphs that needs to fit in the table
        \vspace{3pt}
    \end{mdframed}%
\end{document}

相关内容