
私は 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 つあります。 この点を削除するのを手伝ってくれる人はいませんか?
答え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}
コードも簡素化しました。