mdframed 截面间距

mdframed 截面间距

代码:

\documentclass[12pt]{article}
\usepackage[framemethod = tikz]{mdframed}
\usepackage{enumitem}
\usepackage[margin=1in]{geometry} 
\begin{document} 
    \begin{mdframed}
%       \section*{Objective:}
        \begin{itemize}
            \item To become familiar with the measurements in electric circuits
            \item To determine the equivalent resistances of series and parallel combinations
            \item To use Kirchhoff's laws
        \end{itemize}
    \end{mdframed}
    \begin{mdframed}
        \section*{Objective:}
        \begin{itemize}
            \item To become familiar with the measurements in electric circuits
            \item To determine the equivalent resistances of series and parallel combinations
            \item To use Kirchhoff's laws
        \end{itemize}
    \end{mdframed}
\end{document}

输出: 在此处输入图片描述

我们可以看到,section标题本身和框顶部之间产生了额外的空白mdframed。它产生了多少空白?如何去除这些空白?

答案1

以下是在包装的帮助下使用定制盒子的替代方法tcolorbox

在此处输入图片描述

\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{tcolorbox}

\newtcolorbox{mybox}
{
  colback  = white,
  sharp corners, 
  boxrule=1pt
}
\usepackage[margin=1in]{geometry} 
\begin{document} 
    \begin{mybox}
%       \section*{Objective:}
        \begin{itemize}
            \item To become familiar with the measurements in electric circuits
            \item To determine the equivalent resistances of series and parallel combinations
            \item To use Kirchhoff's laws
        \end{itemize}
    \end{mybox}
    \begin{mybox}
        \section*{Objective:}
        \begin{itemize}
            \item To become familiar with the measurements in electric circuits
            \item To determine the equivalent resistances of series and parallel combinations
            \item To use Kirchhoff's laws
        \end{itemize}
    \end{mybox}
\end{document}

相关内容