答案1
和tcolorbox
这并不那么困难:
\documentclass{article}
\usepackage[margin=25mm, a4paper, showframe]{geometry}
\usepackage[many]{tcolorbox}
\newtcolorbox{mybox}[1]{%
tikznode boxed title,
enhanced,
arc=0mm,
interior style={white},
attach boxed title to top center= {yshift=-\tcboxedtitleheight/2},
fonttitle=\bfseries,
colbacktitle=white,coltitle=black,
boxed title style={size=normal,colframe=white,boxrule=0pt},
title={#1}}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{mybox}{Short title}
\lipsum[1]
\end{mybox}
\end{document}
答案2
当您不需要将这些框架分成更多页面时,您可以使用 TeX 原语和基本的纯 TeX 宏创建一个简短的宏:
\def\linefil{\leaders\vrule height.4pt\hfill}
\def\ftitle#1#2{\bigskip\hbox{\vrule \vbox{\noindent
\linefil \quad \smash{\lower.5ex\hbox{\bf #1}}\quad \linefil\null \par
\nointerlineskip \vbox{\bigskip\leftskip=1.5em \rightskip=1.5em #2\bigskip}
\hrule}\vrule}}
\ftitle {Title}
{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa turpis,
semper quis fringilla ut, viverra nec risus. Pellentesque habitant morbi
tristique senectus et netus et malesuada fames ac turpis egestas. Donec nunc
lorem, sollicitudin vel sodales eget, vehicula nec mi. Proin ullamcorper rutrum
nibh, at porttitor nunc euismod et. Donec faucibus nisi faucibus ipsum porttitor
pharetra. Sed elementum, lectus nec congue imperdiet, ipsum leo viverra nisi, sit
amet commodo odio odio id nisl. Fusce sagittis lobortis nisi sed consectetur.}
\bye