我有以下信息框代码。我想更改信息框的标题,例如,不说它,Definition 1.1
而是说一些不同的东西,这样标题应该与内容相符。不幸的是,我不太明白如何做到这一点。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{blindtext}
\usepackage{enumerate}
\geometry{paper=a4paper, left=24mm, right=23mm, top=20mm, bottom=20mm}
\usepackage[dvipsnames]{xcolor}
\usepackage[framemethod=tikz]{mdframed}
% Theorem
\mdtheorem[
linecolor=gray,
frametitlefont=\sffamily\bfseries\color{Black},
frametitlebackgroundcolor=gray,
]{Def}{Defintion}[subsection]
%Document
\begin{document}
\section{Section 1}
\blindtext
\subsection{Subsection 1.1}
\blindtext
%Infobox
\begin{Def}
\blindtext
\end{Def}
\end{document}
我的输出:
答案1
我认为您实际上不需要\mdtheorem
为此使用。有什么理由要这样做吗?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{blindtext}
\usepackage{enumerate}
\geometry{paper=a4paper, left=24mm, right=23mm, top=20mm, bottom=20mm}
\usepackage[dvipsnames]{xcolor}
\usepackage[framemethod=tikz]{mdframed}
\mdfdefinestyle{graybox}{
linecolor=gray,
frametitlefont=\sffamily\bfseries\color{Black},
frametitlebackgroundcolor=gray,
frametitle={My Infobox}
}
\begin{document}
\section{Section 1}
\blindtext
\subsection{Subsection 1.1}
\blindtext
\begin{mdframed}[
style=graybox,
frametitle={My Infobox}]
\blindtext
\end{mdframed}
\end{document}
答案2
将“Definition”替换为“anoterword”,删除[subsection]
并使用\begin{Def*} ... \end{Def*}
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{blindtext}
\usepackage{enumerate}
\geometry{paper=a4paper, left=24mm, right=23mm, top=20mm, bottom=20mm}
\usepackage[dvipsnames]{xcolor}
\usepackage[framemethod=tikz]{mdframed}
% Theorem
\mdtheorem[
linecolor=gray,
frametitlefont=\sffamily\bfseries\color{Black},
frametitlebackgroundcolor=gray,
]{Def}{Anotherword}
%Document
\begin{document}
\section{Section 1}
\blindtext
\subsection{Subsection 1.1}
\blindtext
%Infobox
\begin{Def*}
\blindtext
\end{Def*}
\begin{Def*}
\blindtext
\end{Def*}
\end{document}