我正在寻找一种方法来仅为一个边框增加 tikz 对象的分隔符。
仅应用一个小的“inner sep”值和/或没有“inner ysep”,标题对象就会融入文本中
如果我增加“内部 ysep”,它看起来会更好,但对于北部和南部边界是对称的
实际上,我只想控制北部边界分隔线。也许有人能给我一个主意?
欢呼并感谢,托马斯
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[english,ngerman]{babel}
\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{tabularx,booktabs}
\usepackage{wrapfig}
\usepackage{amssymb,amsmath}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usepackage{lipsum}
\begin{document}
\large
\begin{tikzpicture}
\tikzstyle{headerbox} = [ultra thick,draw=green,rounded corners=15pt,inner sep=10pt, inner ysep=20pt]
\tikzstyle{headerstyle} = [fill=yellow,rounded corners=5pt]
\node[headerbox] (abstract1) {
\begin{minipage}[H]{0.98\textwidth}
\lipsum[2]
\end{minipage}
};
\node[headerstyle] at (abstract1.north){\LARGE Abstract};
\end{tikzpicture}
\end{document}
答案1
只需在开始时添加一条规则。
\documentclass{article}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}
\tikzset{headerbox/.style = {ultra thick,draw=green,rounded corners=15pt,inner sep=10pt,
text width=0.98\textwidth,align=justify},
headerstyle/.style = {fill=yellow,rounded corners=5pt}
}
\large
\begin{tikzpicture}
\node[headerbox] (abstract1) {
\rule{0pt}{3ex}\lipsum[2]
};
\node[headerstyle] at (abstract1.north){\LARGE Abstract};
\end{tikzpicture}
\end{document}
和tcolorbox
\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\begin{document}
\begin{tcolorbox}[enhanced,colback=white,boxsep=10pt,top=20pt,boxrule=1.5pt,colframe=green,
title=Abstract,fontupper=\large,fonttitle=\LARGE,coltitle=black,arc=15pt,
attach boxed title to top center=
{yshift=-\tcboxedtitleheight/2},
boxed title style={colback=yellow,colframe=yellow}]
\lipsum[2]
\end{tcolorbox}
\end{document}