开发者

I was wondering how to create several rows in a box using the fbox command in latex

This is a very basic question, but I cant find the answer to this question.... I would like to create a box that looks like:

                          ___________________
                          |hello开发者_高级运维1            |
                          |hello2            |
                          |hello3            |
                          |__________________|

I have tried the fbox command in Latex. However I only get the text on one line and not several.


\fbox puts a frame round its content, but is not a paragraph box. So you need a \parbox inside an \fbox

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


Also, if you append \noindent before \fbox , i.e.

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

you can prevent indentation of the box.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜