答案1
在我看来,与此类似的东西就是我们想要的:
在这种情况下,tcbposter
可以使用 来作为基础层,将所有项目放置在此页面上。 定义poster
具有所需行和列的规则矩阵。在此结构中,可以使用tcolorboxes
或TikZ nodes
。结构定义内部节点,可用作放置其他元素的参考。但每个新框都可以标记为 ( name=...
) 并作为参考。
上一个图表已使用参数showframe
中的选项绘制poster
。这显示了网格、列、行和框标签。您必须将其隐藏以避免打印此信息。
代码(包含以下几行Zarko 的回答到tikz 相对于页面和内容定位图像是
\documentclass[a4paper]{scrartcl}
\usepackage[margin=20mm]{geometry}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts, positioning}
\tikzset{
note/.style = {rectangle callout, callout relative pointer={(#1)},
callout pointer width=4mm,
draw, ultra thick, rounded corners,
text width=41mm, inner sep=3mm, font=\large}
}
\begin{document}
\noindent\begin{tcbposter}[
poster = {showframe,spacing=0pt, columns=4, rows=5},
boxes
= {empty},
]
\posterbox[valign=top, halign=left]{name=B11,column=1,row=1}{\includegraphics[width=2cm, height=3cm]{caixa}}
\posterbox[valign=top, halign=left]{name=B12,column=1,row=2}{\includegraphics[width=3cm, height=3.8cm]{caixa}}
\posterbox[valign=top, halign=left]{name=B13,column=1,row=3}{\includegraphics[width=3cm, height=2.8cm]{caixa}}
\posterbox[valign=top, halign=left]{name=B14,column=1,row=4}{\includegraphics[width=3.4cm, height=4cm]{caixa}}
\posterbox[valign=top, halign=left]{name=B15,column=1,row=5}{\includegraphics[width=2.2cm, height=3.5cm]{caixa}}
\node [note={17mm,2mm}, anchor=south] (n1) at ([email protected]|[email protected])
{That's a bottle\\ Celà est une bouteille};
\node [note={-9mm,1mm}, above=2mm of n1] (n2) {This is a box\\ Ceci est une boîte};
\posterbox[valign=top, halign=right]{name=B41,column=4,row=1}{\includegraphics[width=2.5cm, height=3.2cm]{botella}}
\posterbox[valign=top, halign=right]{name=B42,column=4,row=2}{\includegraphics[width=3cm, height=3.8cm]{botella}}
\posterbox[valign=top, halign=right]{name=B43,column=4,row=3}{\includegraphics[width=1cm, height=3.4cm]{botella}}
\posterbox[valign=top, halign=right]{name=B44,column=4,row=4}{\includegraphics[width=3cm, height=2.3cm]{botella}}
\posterbox[valign=top, halign=right]{name=B45,column=4,row=5}{\includegraphics[width=3cm, height=2.8cm]{botella}}
\end{tcbposter}
\end{document}
答案2
我在回答您之前的问题时已经解决了您的问题(没有使用表格)。但是,如果您坚持使用表格来解决问题(并且不愿意向我们展示您迄今为止的尝试),以下是可以作为起点的 MWE:
\documentclass{article}
\usepackage{geometry}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\setlength\parindent{0pt}
\usepackage{tikz}
\usetikzlibrary{positioning,
shapes.callouts
}
\tikzset{
node distance = 2mm,
noteBase/.style = {rectangle callout, callout pointer width=4mm,
draw=blue, ultra thick, line join=round,
text width=32mm, minimum height=2.2\baselineskip, inner sep=2mm},
noteL/.style = {noteBase, callout relative pointer={(-11mm,1mm)}},
noteR/.style = {noteBase, callout relative pointer={(+17mm,2mm)}},
}
\newcommand\Notes[2]{\begin{tikzpicture}[baseline]
\node (n1) [noteL] {#1};
\node (n2) [noteR, below=of n1] {#2};
\end{tikzpicture}
}
\begin{document}
\begin{tblr}{colspec = {X[l] Q[c,f] X[r]},
row{even} = {ht=33mm},
row{odd} = {ht=11mm},
colsep = 0pt,
rowsep = 0pt,
hlines={dashed}, vlines={dashed} % <-- delete in the real document
}
\SetCell[r=2]{h}
\includegraphics[width=2cm,height=3cm,valign=t]{example-image-duck}
& & \SetCell[r=2]{h}
\includegraphics[width=2.5cm, height=3.2cm,valign=t]{example-image-duck} \\
& \Notes{one}
{two}
& \\
%
\SetCell[r=2]{h}
\includegraphics[width=3cm,height=3.8cm,valign=t]{example-image-duck}
& & \SetCell[r=2]{h}
\includegraphics[width=2.5cm,height=3.2cm,valign=t]{example-image-duck} \\
& \Notes{this could be a longer piece of text including new lines}
{here two}
& \\
%
\SetCell[r=2]{h}
\includegraphics[width=3cm, height=2.8cm, valign=t]{example-image-duck}
& & \SetCell[r=2]{h}
\includegraphics[width=1.4cm,height=2.4cm,valign=t]{example-image-duck} \\
& \Notes{this could be a longer piece of text}
{here two}
& \\
%
\SetCell[r=2]{h}
\includegraphics[width=2.2cm, height=4cm, valign=t]{example-image-duck}
& & \SetCell[r=2]{h}
\includegraphics[width=3cm,height=2.8cm,valign=t]{example-image-duck} \\
& \Notes{rext and newlines}
{here too}
&
\end{tblr}
\end{document}
表格中保留虚线,使表格单元格更清晰可见。在实际文档中,您应该删除它们。
编辑: 关于您的评论:
- 在上面的 MWE 中替换
colspec = {X[l] Q[c,f] X[r]},
为例如colspec = {X[0.8, l] Q[l,f] X[1.2,r]},
- 此后,我使用 LuaLaTeX 编译改变后的 MWE,得到以下结果:
- 编译过程顺利,没有错误,没有警告,没有坏框。
- 这就是你所追求的吗?