是否有一个包可以生成与以下 ASCII 示例中的帧类似的帧?我不想要虚线。
|
----+--
Bla, bla, bla, bla, bla, bla, bla, ... |
Bla, bla, bla, bla, bla, bla, bla, ... |
Bla, bla, bla, bla, bla, bla, bla, ...
Bla, bla, bla, bla, bla, bla, bla, ...
| Bla, bla, bla, bla, bla, bla, bla, ...
| Bla, bla, bla, bla, bla, bla, bla, ...
--+----
|
精确 :我正在寻找一些像段落标准框架一样的东西。
答案1
更新
现在,强大的tcolorbox
和mdframed
包就在附近,这是一项简单的任务:
\documentclass{article}
\usepackage{mdframed}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\newtcolorbox{tcboppbox}[1][]{
breakable,
enhanced,
arc=0pt,
boxrule=0pt,
outer arc=0pt,
overlay first={
\draw[#1] ([yshift=10pt]frame.north east) -- ++(0,-1cm);
\draw[#1] ([xshift=10pt]frame.north east) -- ++(-1cm,0pt);
},
overlay last={
\draw[#1] ([yshift=-10pt]frame.south west) -- ++(0,1cm);
\draw[#1] ([xshift=-10pt]frame.south west) -- ++(1cm,0pt);
},
overlay unbroken={
\draw[#1] ([yshift=10pt]frame.north east) -- ++(0,-1cm);
\draw[#1] ([xshift=10pt]frame.north east) -- ++(-1cm,0pt);
\draw[#1] ([yshift=-10pt]frame.south west) -- ++(0,1cm);
\draw[#1] ([xshift=-10pt]frame.south west) -- ++(1cm,0pt);
},
colback=white,
}
\begin{document}
\begin{tcboppbox}
\lipsum[4]
\end{tcboppbox}
\begin{tcboppbox}[line width=5pt,color=green!50!black]
\lipsum[4]
\end{tcboppbox}
\end{document}
初始版本
您可以定义自己的环境来添加框架;您可以按照以下步骤进行操作:
\documentclass{article}
\usepackage{lipsum} % just to generate text for the example
\newenvironment{MyFrame}
{\par\hfill\rlap{\kern-0.5cm\rule{1cm}{0.4pt}\kern-0.2cm\rule[-0.8cm]{0.4pt}{1cm}}%
\vskip-\baselineskip}
{\par\kern-0.5cm\hskip-0.9cm\rule{0.4pt}{1cm}\kern-0.2cm\rule[0.2cm]{1cm}{0.4pt}\par}
\begin{document}
\begin{MyFrame}
\lipsum*[1]
\end{MyFrame}
\end{document}
使用包的帮助xparse
很容易定义更复杂的环境版本MyFrame
(这个想法是 Werner 在评论中提出的);在下面的例子中,新环境将有六个可选参数;语法是
\begin{MyFrame}[<length>][<rule thick.>][<hor. sep.>][<color>][<factor>][<vert. sep.>]
<contents>
\end{MyFrame}
其中<length>
控制所用规则的长度 (default= 1cm
),<rule thick.>
控制规则的“厚度”(default= 0.4pt
),<hor. sep.>
控制规则与文本之间的水平距离 (default= 0.8cm
),<color>
允许您在包的帮助下选择xcolor
规则的颜色 (default= black
),<factor>
是一个数字,控制用于框架的每对规则的交点 (default= 3
),并<ver. sep.>
控制规则与文本之间的垂直距离 (default= 2ex
)。使用这些值,您将得到一些有趣的框架。一个小例子:
\documentclass{article}
\usepackage{xparse}
\usepackage{xcolor}
\newcommand\Text{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna.
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra
metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices.}% just to generate text for the example
\DeclareDocumentEnvironment{MyFrame}{O{1cm}O{0.4pt}O{0.8cm}O{black}O{3}O{2ex}}
{\par\hfill\rlap{%
\bgroup\color{#4}%
\hskip-\dimexpr#1-#3\relax\rule{#1}{#2}%
\hskip-\dimexpr#1/#5\relax\rule[-\dimexpr#1-\dimexpr#1/#5\relax]{#2}{#1}%
\egroup
}%
\vskip-\dimexpr#1/#5+\dimexpr#1/#5-#6\relax%
}
{\par\nobreak\offinterlineskip\vskip-\dimexpr#1/#5+\dimexpr#1/#5-#6\relax\noindent%
\hskip-#3\bgroup\color{#4}%
\rule{#1}{#2}\hskip-\dimexpr#1-\dimexpr#1/#5-#2\relax%
\rule[-\dimexpr#1/#5-#2\relax]{#2}{#1}\egroup\par
}
\begin{document}
\begin{MyFrame}
\Text
\end{MyFrame}
\begin{MyFrame}[3cm][4pt][1.5cm][red!60]
\Text
\end{MyFrame}
\begin{MyFrame}[1.5cm][2pt][1.3cm][blue][2][8ex]
\Text
\end{MyFrame}
\begin{MyFrame}[1cm][7pt][0.6cm][olive!60][4][0ex]
\Text
\end{MyFrame}
\end{document}
\MyFrame
根据一条评论的要求,这里是生成四角版本框架所需的环境的定义(具有相同的六个可选参数):
\DeclareDocumentEnvironment{MyFrame}{O{1cm}O{0.4pt}O{0.8cm}O{black}O{3}O{2ex}}
{\par\noindent\hskip-#3\bgroup\color{#4}%
\rule{#1}{#2}\hskip-\dimexpr#1-\dimexpr#1/#5-#2\relax%
\rule[-\dimexpr#1-\dimexpr#1/#5\relax]{#2}{#1}\egroup
\hfill\rlap{%
\bgroup\color{#4}%
\hskip-\dimexpr#1-#3\relax\rule{#1}{#2}%
\hskip-\dimexpr#1/#5\relax\rule[-\dimexpr#1-\dimexpr#1/#5\relax]{#2}{#1}%
\egroup
}%
\vskip-\dimexpr#1/#5+\dimexpr#1/#5-#6\relax%
}
{\par\nobreak\offinterlineskip\vskip-\dimexpr#1/#5+\dimexpr#1/#5-#6\relax\noindent%
\hskip-#3\bgroup\color{#4}%
\rule{#1}{#2}\hskip-\dimexpr#1-\dimexpr#1/#5-#2\relax%
\rule[-\dimexpr#1/#5-#2\relax]{#2}{#1}\egroup
\hfill\rlap{%
\bgroup\color{#4}%
\hskip-\dimexpr#1-#3\relax\rule{#1}{#2}%
\hskip-\dimexpr#1/#5\relax\rule[-\dimexpr#1/#5-#2\relax]{#2}{#1}%
\egroup
}%
\par
}
以及以下代码(与之前相同的序言)
\begin{MyFrame}
\Text
\end{MyFrame}\vskip\baselineskip
\begin{MyFrame}[1.5cm][3pt][1cm][red!60][4][5.5ex]
\Text
\end{MyFrame}\vskip\baselineskip
\begin{MyFrame}[1cm][7pt][0.6cm][olive!60][4][0ex]
\Text
\end{MyFrame}
现在产生以下结果:
答案2
尝试我的新信箱包裹:
\documentclass{minimal}
\usepackage{crbox}
\setlength{\fboxsep}{10pt}
\begin{document}
\crbox{\parbox{0.8\textwidth}{
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex
}}
\bigskip
\crbox[curved]{\parbox{0.8\textwidth}{
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex
}}
\bigskip
\crbox[hollowcurved]{\parbox{0.8\textwidth}{
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex
}}
\end{document}
输出结果如下:
答案3
下面是使用的示例包裹crop
:
\documentclass[a5paper]{article}
\usepackage[a4,center]{crop}
\usepackage{lipsum}
\crop[cross,noinfo]
\begin{document}
\lipsum[1]
\end{document}
对于只想显示特定标记的情况,您可以使用该\cropdef
命令来禁用不需要的标记。
\documentclass{article}
\usepackage[showcrop,
papersize={8.5in,11.0in},
layoutsize={6.5in,9.0in},layoutoffset=1.0in
]{geometry}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\end{document}
请注意,您需要指定小于纸张尺寸的布局尺寸才能看到裁切标记。
答案4
您还可以使用tabular
:
\documentclass{article}
\begin{document}
\begin{tabular}{ccp{10pt}cp{10pt}cc}
& \vline & & & & & \\
\cline{1-3}
& \vline & & & & & \\
& \vline & & Bla, bla, bla, bla, bla, bla, bla & & & \\
& \vline & & Bla, bla, bla, bla, bla, bla, bla & & & \\
& & & Bla, bla, bla, bla, bla, bla, bla & & & \\
& & & Bla, bla, bla, bla, bla, bla, bla & & & \\
& & & Bla, bla, bla, bla, bla, bla, bla & & & \\
& & & Bla, bla, bla, bla, bla, bla, bla & & \vline & \\
& & & Bla, bla, bla, bla, bla, bla, bla & & \vline & \\
& & & & & \vline & \\
\cline{5-7}
& & & & & \vline & \\
\end{tabular}
\end{document}
但@Gonzalo Medina 的回答更加优雅。