LaTex:向文本框添加单元格填充

LaTex:向文本框添加单元格填充

我正在尝试在 LaTeX 中创建如下所示的框。

\framebox[40em][c]{ I certify that the work presented in the dissertation is my own unless referenced.
}

我想要在文本和框架之间留出一点空白,如图所示。我尝试\vspace在开头添加换行符。

\framebox另外,当我使用它创建框时,我无法放置换行符。有人可以给我一些建议吗?

在此处输入图片描述

答案1

\parbox或环境minipage可用于将垂直材料放入水平框中,如\fbox\framebox

\documentclass{article}
\begin{document}
\centering
\fbox{%
  \parbox{20em}{I certify that the work presented in the dissertation is
  my own unless referenced.}%
}

\medskip

\setlength{\fboxsep}{1em}
\fbox{%
  \parbox{20em}{I certify that the work presented in the dissertation is
  my own unless referenced.}%
}
\end{document}

结果

填充由 dimen 寄存器控制\fboxsep,框架的线宽由控制\fboxrule

答案2

另一个选择是使用tcolorbox包可轻松为您提供框架,您可以在其中控制左侧、右侧、顶部和底部的单独填充以及许多其他属性。一个小例子:

\documentclass{article}
\usepackage[most]{tcolorbox}

\newtcolorbox{myframe}[1][]{
  enhanced,
  arc=0pt,
  outer arc=0pt,
  colback=white,
  boxrule=0.8pt,
  #1
}

\title{The Title}
\author{The Author}

\begin{document}

\begin{myframe}
I certify that the work presented in the dissertation is my own unless referenced.
\end{myframe}

\begin{myframe}[width=30em]
I certify that the work presented in the dissertation is my own unless referenced.
\end{myframe}

\begin{myframe}[width=30em,top=10pt,bottom=10pt,left=20pt,right=20pt]
I certify that the work presented in the dissertation is my own unless referenced.
\end{myframe}

\begin{myframe}[width=30em,top=20pt,bottom=20pt,left=20pt,right=20pt,arc=10pt,auto outer arc]
I certify that the work presented in the dissertation is my own unless referenced.
\end{myframe}

\end{document} 

在此处输入图片描述

相关内容