我希望能够叠加由 raster/tcbitems 制作的多个表格。我尝试了几种方法来做到这一点,但没有一种方法对我有用。总会有某个地方的边距不对。此示例使用:
\mbox{\vbox to 0pt {\hbox to 0cm{ <text> }}}
知道如何实现精确叠加吗?谢谢!
平均能量损失:(抱歉,它不是超级简约,但栅格的代码可以看作是“黑盒子”,只需复制粘贴即可)
\documentclass{article}
\usepackage{eso-pic}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{contour}
\usepackage{luatex85}
\usepackage{xcolor}
\usepackage{pdfrender}
\usepackage[strict]{changepage}
\usepackage{adjustbox}
\usepackage[most]{tcolorbox}
\tcbuselibrary{raster}
\usepackage{afterpage}
\newlength{\myPaperWidth}
\setlength{\myPaperWidth}{297mm}
\newlength{\myPaperHeight}
\setlength{\myPaperHeight}{210mm}
\newlength{\myRightMargin}
\setlength{\myRightMargin}{5mm}
\newlength{\myRightPadding}
\setlength{\myRightPadding}{5mm}
\newlength{\myLeftMargin}
\setlength{\myLeftMargin}{5mm}
\newlength{\myLeftPadding}
\setlength{\myLeftPadding}{5mm}
\newlength{\myTopMargin}
\setlength{\myTopMargin}{5mm}
\newlength{\myTopPadding}
\setlength{\myTopPadding}{5mm}
\newlength{\myBottomMargin}
\setlength{\myBottomMargin}{5mm}
\newlength{\myBottomPadding}
\setlength{\myBottomPadding}{5mm}
\newlength{\mystockwidth}
\setlength{\mystockwidth}{\myPaperWidth}
\addtolength{\mystockwidth}{\myLeftMargin}
\addtolength{\mystockwidth}{\myRightMargin}
\newlength{\mystockheight}
\setlength{\mystockheight}{\myPaperHeight}
\addtolength{\mystockheight}{\myTopMargin}
\addtolength{\mystockheight}{\myBottomMargin}
\usepackage[ paperwidth=\myPaperWidth,paperheight=\myPaperHeight, hmargin={\myLeftPadding, \myRightPadding}, vmargin={\myTopPadding, \myBottomPadding}, nohead, nofoot, nomarginpar, pdftex=false, dvips=false, vtex=false,driver=none,showframe]{geometry}
\usepackage[width=\the\mystockwidth,height=\the\mystockheight,center,pdftex,frame,noinfo]{crop}
\usepackage{wasysym}
\begin{document}
\noindent %%%% FIRST IMAGE
\begin{tcbitemize}[,nobeforeafter, blankest, raster row skip=4mm, raster columns=1, raster rows=1, raster valign=center, halign=center, raster every box/.style={nobeforeafter,fit=outside,top=0pt, bottom=0pt, right=0pt, left=0pt, boxsep=0pt,enhanced,clip upper,halign=center, raster valign=center}, raster width=\textwidth, raster column skip=4mm, raster height=\textheight, raster height=1\textheight, ]
\tcbitem[blankest,valign=center]
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\tcbox[,nobeforeafter, enhanced, skin=enhanced jigsaw, clip upper, left=0pt, bottom=0pt, top=0pt, right=0pt, boxsep=0pt, beforeafter skip=0pt, tikz={,}, ]{
\includegraphics[width=\tcbitemtw,height=\tcbitemth, keepaspectratio]{example-image-a}
}
\end{tcbitemize}
\newpage
\noindent %%%% SECOND IMAGE
\begin{tcbitemize}[,nobeforeafter, blankest, raster row skip=4mm, raster columns=1, raster rows=1, raster valign=center, halign=center, raster every box/.style={nobeforeafter,fit=outside,top=0pt, bottom=0pt, right=0pt, left=0pt, boxsep=0pt,enhanced,clip upper,halign=center, raster valign=center}, raster width=\textwidth, raster column skip=4mm, raster height=\textheight, raster height=1\textheight, ]\tcbitem[blankest,valign=center]
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight,raster width=\tcbtextwidth, raster valign=center]
\tcbitem[blankest, valign=center,raster multirow=1]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\begin{tcbitemize}[raster rows=1,raster columns=100,raster height=\tcbtextheight,raster width=\tcbtextwidth, raster valign=center]
\tcbitem[blankest, valign=center,raster multicolumn=40]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
}
\tcbitem[blankest, valign=center,raster multicolumn=60]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\tcbox[,nobeforeafter, enhanced, skin=enhanced jigsaw, clip upper, left=0pt, bottom=0pt, top=0pt, right=0pt, boxsep=0pt, beforeafter skip=0pt, tikz={,}, ]{
\includegraphics[width=\tcbitemtw,height=\tcbitemth, keepaspectratio]{example-image-b}
}
}
\end{tcbitemize}
}
\tcbitem[blankest, valign=center,raster multirow=1]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\begin{tcbitemize}[raster rows=1,raster columns=100,raster height=\tcbtextheight,raster width=\tcbtextwidth, raster valign=center]
\tcbitem[blankest, valign=center,raster multicolumn=60]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
}
\tcbitem[blankest, valign=center,raster multicolumn=40]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
}
\end{tcbitemize}
}
\end{tcbitemize}
\end{tcbitemize}
\newpage
\noindent %%%% MIX OF IMAGES
\mbox{\vbox to 0pt {\hbox to 0cm{%%%% First picture
\begin{tcbitemize}[,nobeforeafter, blankest, raster row skip=4mm, raster columns=1, raster rows=1, raster valign=center, halign=center, raster every box/.style={nobeforeafter,fit=outside,top=0pt, bottom=0pt, right=0pt, left=0pt, boxsep=0pt,enhanced,clip upper,halign=center, raster valign=center}, raster width=\textwidth, raster column skip=4mm, raster height=\textheight, raster height=1\textheight, ]
\tcbitem[blankest,valign=center]
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\tcbox[,nobeforeafter, enhanced, skin=enhanced jigsaw, clip upper, left=0pt, bottom=0pt, top=0pt, right=0pt, boxsep=0pt, beforeafter skip=0pt, tikz={,}, ]{
\includegraphics[width=\tcbitemtw,height=\tcbitemth, keepaspectratio]{example-image-a}
}
\end{tcbitemize}
}}}%
\mbox{\vbox to 0pt {\hbox to 0cm{%%%%% Second picture
\begin{tcbitemize}[,nobeforeafter, blankest, raster row skip=4mm, raster columns=1, raster rows=1, raster valign=center, halign=center, raster every box/.style={nobeforeafter,fit=outside,top=0pt, bottom=0pt, right=0pt, left=0pt, boxsep=0pt,enhanced,clip upper,halign=center, raster valign=center}, raster width=\textwidth, raster column skip=4mm, raster height=\textheight, raster height=1\textheight, ]\tcbitem[blankest,valign=center]
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\begin{tcbitemize}[raster columns=1,raster rows=2,raster height=\tcbtextheight,raster width=\tcbtextwidth, raster valign=center]
\tcbitem[blankest, valign=center,raster multirow=1]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\begin{tcbitemize}[raster rows=1,raster columns=100,raster height=\tcbtextheight,raster width=\tcbtextwidth, raster valign=center]
\tcbitem[blankest, valign=center,raster multicolumn=40]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
}
\tcbitem[blankest, valign=center,raster multicolumn=60]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\tcbox[,nobeforeafter, enhanced, skin=enhanced jigsaw, clip upper, left=0pt, bottom=0pt, top=0pt, right=0pt, boxsep=0pt, beforeafter skip=0pt, tikz={,}, ]{
\includegraphics[width=\tcbitemtw,height=\tcbitemth, keepaspectratio]{example-image-b}
}
}
\end{tcbitemize}
}
\tcbitem[blankest, valign=center,raster multirow=1]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
\begin{tcbitemize}[raster rows=1,raster columns=100,raster height=\tcbtextheight,raster width=\tcbtextwidth, raster valign=center]
\tcbitem[blankest, valign=center,raster multicolumn=60]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
}
\tcbitem[blankest, valign=center,raster multicolumn=40]{
\edef\tcbitemtw{\tcbtextwidth}
\edef\tcbitemth{\tcbtextheight}
}
\end{tcbitemize}
}
\end{tcbitemize}
\end{tcbitemize}
}
}
}
\newpage
\end{document}
答案1
如果您想使用tcolorbox
,您可以使用tcbposter
代替tcbraster
。这样,您可以轻松地将框放置在您想要的任何位置。您甚至可以将框放置在没有TikZ
节点和remember picture
和 的先前框上overlays
。
\documentclass{article}
\usepackage{eso-pic}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{contour}
\usepackage{luatex85}
\usepackage{xcolor}
\usepackage{pdfrender}
\usepackage[strict]{changepage}
\usepackage{adjustbox}
\usepackage[most]{tcolorbox}
\tcbuselibrary{raster}
\usepackage{afterpage}
\newlength{\myPaperWidth}
\setlength{\myPaperWidth}{297mm}
\newlength{\myPaperHeight}
\setlength{\myPaperHeight}{210mm}
\newlength{\myRightMargin}
\setlength{\myRightMargin}{5mm}
\newlength{\myRightPadding}
\setlength{\myRightPadding}{5mm}
\newlength{\myLeftMargin}
\setlength{\myLeftMargin}{5mm}
\newlength{\myLeftPadding}
\setlength{\myLeftPadding}{5mm}
\newlength{\myTopMargin}
\setlength{\myTopMargin}{5mm}
\newlength{\myTopPadding}
\setlength{\myTopPadding}{5mm}
\newlength{\myBottomMargin}
\setlength{\myBottomMargin}{5mm}
\newlength{\myBottomPadding}
\setlength{\myBottomPadding}{5mm}
\newlength{\mystockwidth}
\setlength{\mystockwidth}{\myPaperWidth}
\addtolength{\mystockwidth}{\myLeftMargin}
\addtolength{\mystockwidth}{\myRightMargin}
\newlength{\mystockheight}
\setlength{\mystockheight}{\myPaperHeight}
\addtolength{\mystockheight}{\myTopMargin}
\addtolength{\mystockheight}{\myBottomMargin}
\usepackage[ paperwidth=\myPaperWidth,paperheight=\myPaperHeight, hmargin={\myLeftPadding, \myRightPadding}, vmargin={\myTopPadding, \myBottomPadding}, nohead, nofoot, nomarginpar, pdftex=false, dvips=false, vtex=false,driver=none, showframe
]{geometry}
\usepackage[width=\the\mystockwidth,
height=\the\mystockheight,
center,
pdftex,
frame,
noinfo]{crop}
\usepackage{wasysym}
\pagestyle{empty}
\begin{document}
\noindent\begin{tcbposter}[
poster={columns=1, rows=1}
]
\posterbox[blankest]{row=1,column=1}{\includegraphics[width=\tcbpostercolwidth,height=\tcbposterrowheight]{example-image-a}}
\end{tcbposter}
\newpage
\noindent\begin{tcbposter}[
poster={columns=2, rows=2, spacing=0pt}
]
\posterbox[blankest]{row=1,column=1, rowspan=2, span=2}{\includegraphics[width=\tcbposterwidth,height=\tcbposterheight]{example-image-a}}
\posterbox[blankest]{row=1,column=2}{\includegraphics[width=\tcbpostercolwidth,height=\tcbposterrowheight]{example-image-b}}
\posterbox[blankest]{column=1, above=bottom}{\includegraphics[width=\tcbpostercolwidth,height=\tcbposterrowheight]{example-image-c}}
\end{tcbposter}
\end{document}