Thmtools 去掉一個點

Thmtools 去掉一個點

我的 LaTeX 模板使用 thmtools。我經常使用編號的數學框。但現在我想添加相同的框,但沒有數學上下文。所以我構建了這個:

\documentclas{article}
\usepackage{amsthm}
\usepackage{thmtools}
% The Box
\declaretheorem[name = , numbered = no,]{Boxname}
\newenvironment{boxname}[1][]{
    \begin{Boxname}\ifblank{#1}{}{\color{black}\hspace*{-0.68em}\normalfont\textbf{#1}}\color{black}\normalfont$ $\newline
        \raisebox{.2\baselineskip}{\rule{\linewidth}{0.6pt}}\newline\noindent
    }{
        \newline\noindent {\rule{\linewidth}{0.6pt}}
    \end{Boxname}
}
\begin{document}
    \begin{boxname}[Name of the Box]
        some stuff
    \end{boxname}
\end{document}

我的問題:總有一個點我無法刪除。有人可以幫我去掉這個點嗎?

答案1

您應該定義一個特定的樣式來刪除標題後的標點符號和空格。

\documentclass{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{etoolbox,xcolor}

% The Box
\declaretheoremstyle[
  headpunct={},
  postheadspace=0pt,
]{box}
\declaretheorem[
  style=box,
  name = ,
  numbered = no,
]{Boxname}
\newenvironment{boxname}[1][]{%
  \begin{Boxname}
  \ifblank{#1}
    {\mbox{}}
    {\normalcolor\normalfont\textbf{#1}}%
  \\
  \raisebox{.2\baselineskip}{\rule{\linewidth}{0.6pt}}\\
}{%
  \\\rule{\linewidth}{0.6pt}
  \end{Boxname}
}

\begin{document}

\begin{boxname}[Name of the Box]
some stuff
\end{boxname}

\end{document}

我還簡化了程式碼。

在此輸入影像描述

相關內容