我想使用 mdframed 或 mdframed 与 tikz 创建具有单独框架标题(附在下面)的分割圆角。我的 MWE 是:
\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[usenames]{xcolor}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{lipsum}
\definecolor{emacexmfont}{cmyk}{0.7,0.63,0.7,0}
\definecolor{examplebckcolor}{cmyk}{0,0.2,0.25,0}
\begin{document}
\mdfsetup{%
middlelinecolor=examplebckcolor,
middlelinewidth=2pt,
backgroundcolor=examplebckcolor,
roundcorner=20pt}
\begin{mdframed}
\lipsum[3]
\lipsum[4]
\end{mdframed}
\end{document}
答案1
开头应该能给你一些想法。请参阅手册以了解更多选项:
\documentclass[10pt]{article}
\usepackage[usenames]{xcolor}
\usepackage[framemethod=TikZ]{mdframed}
\usetikzlibrary{positioning}
\usepackage{lipsum}
\definecolor{emacexmfont}{cmyk}{0.7,0.63,0.7,0}
\definecolor{examplebckcolor}{cmyk}{0,0.2,0.25,0}
\tikzset{
my example style/.style={font=\sffamily\bfseries, anchor=west, align=left, text=blue},
}
\newcounter{example}
\setcounter{example}{0}
\newenvironment{example}[1][]{% based on example 6 in the manual
\stepcounter{example}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\begin{tikzpicture}
\node [my example style, text width=.2\linewidth] {\strut Example~\theexample};
\end{tikzpicture}%
}%
}%
}%
{\mdfsetup{%
frametitle={%
\begin{tikzpicture}
\node (some node) [my example style, text width=.2\linewidth] {\strut Example~\theexample:};
\node [my example style, right=0pt of some node, text=blue!60!cyan, text width=.75\linewidth] {\strut #1};
\end{tikzpicture}%
}%
}%
}%
\mdfsetup{%
frametitlebackgroundcolor=yellow,
linecolor=white,%
linewidth=0pt,
frametitlerule=true,
frametitlerulewidth=2.5pt,
}\relax
\begin{mdframed}%
}{%
\end{mdframed}%
}
\begin{document}
\mdfsetup{%
backgroundcolor=examplebckcolor,
roundcorner=20pt}
\begin{example}
\lipsum[3]
\lipsum[4]
\end{example}
\begin{example}[An Example]
\lipsum[3]
\lipsum[4]
\end{example}
\end{document}