我想将四个tcolorbox
方框以 2x2 网格均匀分布在 A4 页面上。目前我有一个网格,但四个方框都挤在页面的一角。我该如何将它们均匀分布在页面上?
\documentclass[a4paper]{article}
\usepackage[many]{tcolorbox}
%\usepackage{lmodern}% or any other vector / postscript font
\usepackage[default]{comfortaa}
\usepackage[T1]{fontenc}
\usepackage[hoffset=-1in,voffset=-1in]{geometry}
\begin{document}
\begin{tcolorbox}[width=8cm,valign=center,nobeforeafter]
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.\\
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood \ldots \\
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.\\
Romans 3:22-26
\end{tcolorbox}
\begin{tcolorbox}[width=8cm,valign=center,nobeforeafter]
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.\\
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\ldots \\
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.\\
Romans 3:22-26
\end{tcolorbox}
\begin{tcolorbox}[width=8cm,valign=center,nobeforeafter]
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.\\
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\ldots \\
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.\\
Romans 3:22-26
\end{tcolorbox}
\begin{tcolorbox}[width=8cm,valign=center,nobeforeafter]
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.\\
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\ldots \\
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.\\
Romans 3:22-26
\end{tcolorbox}
\end{document}
答案1
我认为这个tcbraster
功能就是为了实现这样的对齐而制作的。
tcolorbox
为内容定义一个特殊的,很容易设置一个光栅\begin{tcbraster}[raster columns=2, raster equal height]
等,使得所有内部的tcolorbox
es 都具有相同的高度。
那里一定不tcolorbox
两个内部用法之间可以是任意空行!
- 我不认为实际上所有框中的文本都不会相同(如果是这样的话,也可以使用专门的框),因此我保留了原样的文本(并删除了
\\
) - 参阅内部框选项的用法以便改变本地框。
raster column skip
可以使用和来调整栅格的列和行之间的间距raster row skip
,将其指定为tcbraster
环境选项。
\documentclass[a4paper]{article}
\usepackage[many]{tcolorbox}
%\usepackage{lmodern}% or any other vector / postscript font
\usepackage[default]{comfortaa}
\usepackage[T1]{fontenc}
%\usepackage[hoffset=-1in,voffset=-1in]{geometry}
\usepackage[margin=1in]{geometry}
\newtcolorbox{mybox}[1][]{%
valign=center,
nobeforeafter,
#1
}
\begin{document}
\begin{tcbraster}[raster columns=2, raster halign=center, raster equal height=all]
\begin{mybox}
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.
\medskip
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\dots
\medskip
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.
\medskip
Romans 3:22-26
\end{mybox}
\begin{mybox}
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.
\medskip
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\dots
\medskip
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.
\medskip
Romans 3:22-26
\end{mybox}
\begin{mybox}
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.
\medskip
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\dots
\medskip
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.
\medskip
Romans 3:22-26
\end{mybox}
\begin{mybox}[colback=white!40!yellow]
We are made right with God by placing our faith in Jesus Christ. And this is true for everyone who believes, no matter who we are.
\medskip
For everyone has sinned; we all fall short of God's glorious standard. Yet God, in his grace, freely makes us right in his sight. He did this through Christ Jesus when he freed us from the penalty for our sins. For God presented Jesus as the sacrifice for sin. People are made right with God when they believe that Jesus sacrificed his life, shedding his blood\dots
\medskip
God did this to demonstrate his righteousness, for he himself is fair and just, and he makes sinners right in his sight when they believe in Jesus.
\medskip
Romans 3:22-26
\end{mybox}
\end{tcbraster}
\end{document}