2011-02-04 76 views
9

这是一个非常基本的问题,使用fbox命令创建在一个盒子里几行,但我不能找到这个问题的答案.... 我想创建一个盒子,看起来像:我想知道如何在乳胶

      ___________________ 
          |hello1   | 
          |hello2   | 
          |hello3   | 
          |__________________| 

我已经尝试了Latex中的fbox命令。但是,我只能在一行而不是几行中获得文本。

+2

嗨,我们现在有一个专门的Q&A为TeX问题的网站。请在http://tex.stackexchange.com上再次提出您的问题 – Yuji 2011-02-04 12:14:50

回答

8

\fbox提出一个框架圆其内容,而不是一个段落框。所以你需要一个\parbox内的\fbox

\documentclass{article} 
\begin{document} 
\fbox{\parbox{\textwidth}{% 
hello1\\ 
hello2\\ 
hello3 
}} 
\end{document} 
3

另外,如果你之前\ fbox追加\ noindent,会,即

\documentclass{article} 
\begin{document} 
\noindent \fbox{\parbox{\textwidth}{% 
hello1\\ 
hello2\\ 
hello3 
}} 
\end{document} 

可以防止盒压痕。