线条粗细‘thmbox’?

线条粗细‘thmbox’?

我正在使用下面的 MWE 为我的定理创建一个颜色框。该框由两部分组成:顶部的水平线和其余部分。我希望能够分别调整这两个部分的厚度,而现在我只能一次对整个框进行调整。有什么想法吗?非常感谢!

\documentclass{report}
\usepackage{thmbox}
\usepackage{xcolor}

\makeatletter
\def\thmbox@color{black}
\define@key{thmbox}{color}{\def\thmbox@color{#1}}
\def\thmbox@head#1{%
  \par\noindent\vbox{%
\setbox\thmbox@box@=\hbox{%
  \vrule width 0mm height 0mm depth \thmbox@vskip%
  #1}%
\copy\thmbox@box@%
\ifthmbox@underline%
   \color@begingroup\color{\thmbox@color}\hrule width \wd\thmbox@box@ height \thmbox@thickness\color@endgroup%
\fi}%
  \hrule height 0mm\relax}
\def\thmbox@put#1{
  \vskip\z@%
  \noindent%
  \hbox{%
{\dimen0=\thmbox@leftmargin%
 \advance\dimen0-\thmbox@hskip%
 \advance\dimen0-\thmbox@thickness%
 \hskip\dimen0}%
\color@begingroup\color{\thmbox@color}\vrule width \thmbox@thickness\color@endgroup%
\hskip\thmbox@hskip%
\box#1%
\ifx\thmbox@style L%
  \hskip\thmbox@hskip%
  \color@begingroup\color{\thmbox@color}\vrule width \thmbox@thickness\color@endgroup%
\fi}%
  \par\nobreak}
\def\thmbox@tail{%
  \hrule height 0mm%
  \ifx\thmbox@style M%
    \thmbox@dim=1cm%
  \else\ifx\thmbox@style L%
    \thmbox@dim=\hsize%
    \advance\thmbox@dim-\thmbox@leftmargin%
    \advance\thmbox@dim-\thmbox@rightmargin%
    \advance\thmbox@dim2\thmbox@hskip%
    \advance\thmbox@dim2\thmbox@thickness%
  \fi\fi%
  \noindent%
  {\dimen0=\thmbox@leftmargin%
   \advance\dimen0-\thmbox@hskip%
   \advance\dimen0-\thmbox@thickness%
   \hskip\dimen0}%
  \color@begingroup\color{\thmbox@color}\vrule width \thmbox@dim height \thmbox@thickness\color@endgroup%
  \par}
\makeatother
\newtheorem[style=M, thickness=1pt,color=red]{theoremExa}{Example}[chapter]

\begin{document}
 \begin{theoremExa}[Example Bla]
   ......
 \end{theoremExa}
\end{document}

答案1

定义一个新键并使用它来设置顶部规则的厚度:

\documentclass{report}
\usepackage{thmbox}
\usepackage{xcolor}

\makeatletter
\def\thmbox@color{black}
\define@key{thmbox}{color}{\def\thmbox@color{#1}}
\define@key{thmbox}{topthickness}{\def\thmbox@topthickness{#1}}
\def\thmbox@topthickness{\thmbox@thickness}% default
\def\thmbox@head#1{%
  \par\noindent\vbox{%
    \setbox\thmbox@box@=\hbox{%
    \vrule width 0mm height 0mm depth \thmbox@vskip
    #1}%
  \copy\thmbox@box@
  \ifthmbox@underline
   \color@begingroup\color{\thmbox@color}\hrule width \wd\thmbox@box@ height \thmbox@topthickness\color@endgroup
  \fi}%
  \hrule height 0mm\relax}
\def\thmbox@put#1{
  \vskip\z@%
  \noindent%
  \hbox{%
{\dimen0=\thmbox@leftmargin%
 \advance\dimen0-\thmbox@hskip%
 \advance\dimen0-\thmbox@thickness%
 \hskip\dimen0}%
\color@begingroup\color{\thmbox@color}\vrule width \thmbox@thickness\color@endgroup%
\hskip\thmbox@hskip%
\box#1%
\ifx\thmbox@style L%
  \hskip\thmbox@hskip%
  \color@begingroup\color{\thmbox@color}\vrule width \thmbox@thickness\color@endgroup%
\fi}%
  \par\nobreak}
\def\thmbox@tail{%
  \hrule height 0mm%
  \ifx\thmbox@style M%
    \thmbox@dim=1cm%
  \else\ifx\thmbox@style L%
    \thmbox@dim=\hsize%
    \advance\thmbox@dim-\thmbox@leftmargin%
    \advance\thmbox@dim-\thmbox@rightmargin%
    \advance\thmbox@dim2\thmbox@hskip%
    \advance\thmbox@dim2\thmbox@thickness%
  \fi\fi%
  \noindent%
  {\dimen0=\thmbox@leftmargin%
   \advance\dimen0-\thmbox@hskip%
   \advance\dimen0-\thmbox@thickness%
   \hskip\dimen0}%
  \color@begingroup\color{\thmbox@color}\vrule width \thmbox@dim height \thmbox@thickness\color@endgroup%
  \par}
\makeatother
\newtheorem[style=M, thickness=1pt, topthickness=3pt,color=red]{theoremExa}{Example}[chapter]

\begin{document}
 \begin{theoremExa}[Example Bla]
   ......
 \end{theoremExa}
\end{document}

在此处输入图片描述

相关内容