这个确实很难,但看起来应该很简单。我试图将线置于 的末尾tcolorbox
。这就是我所得到的:
\documentclass[A4]{letter}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancybox}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{tikz}
\usepackage{tcolorbox}
\begin{document}
\definecolor{peas}{HTML}{d4e79e}
\begin{tcolorbox}[width=450pt, halign=left, colframe=darkgray, colback=peas,
boxsep=0mm, arc=3mm]
Please Read Carefully...
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\\
\vspace{5mm}
Lorem ipsum dolor sit amet, consectetur adipiscing elit
\end{tcolorbox}
\end{document}
我正在尝试找到一种方法来做到这一点:
我尝试使用旧方法\begin{center}
,但\center
无济于事。我还尝试过在颜色框内制作一个居中表格,但由于颜色框是浮动的(我相信),我无法定义列宽。有没有关于如何简单实现我的梦想的建议?
答案1
您可以简单地使用\hfil
两次:
{\hfil
Lorem ipsum dolor sit amet, consectetur adipiscing elit
\hfil}
附完整代码
\documentclass[a4paper]{letter}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancybox}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{tikz}
\usepackage{tcolorbox}
\begin{document}
\definecolor{peas}{HTML}{d4e79e}
\begin{tcolorbox}[width=450pt, halign=left, colframe=darkgray, colback=peas,
boxsep=0mm, arc=3mm]
Please Read Carefully...
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\\
\vspace{5mm}
{\hfil
Lorem ipsum dolor sit amet, consectetur adipiscing elit
\hfil}
\end{tcolorbox}
\end{document}
你得到:
答案2
如果不是设计用于其他请求,请使用\begin{center}...\end{center}
环境或尝试center lower
和版本:lower separated=false
lower box
\documentclass{article}
\usepackage{graphicx}
\usepackage{color}
\usepackage{fancybox}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{tikz}
\usepackage{tcolorbox}
\begin{document}
\definecolor{peas}{HTML}{d4e79e}
\begin{tcolorbox}[width=450pt, halign=left, colframe=darkgray, colback=peas,
boxsep=0mm, arc=3mm]
Please Read Carefully...
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\begin{center}
Lorem ipsum dolor sit amet, consectetur adipiscing elit
\end{center}
\end{tcolorbox}
% Again, with center lower etc.
\begin{tcolorbox}[width=450pt, halign=left, colframe=darkgray, colback=peas,% parbox=false,
boxsep=0mm, arc=3mm,center lower, lower separated=false]
Please Read Carefully...
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\tcblower
Lorem ipsum dolor sit amet, consectetur adipiscing elit
\end{tcolorbox}
\end{document}