각 상자 내부의 "텍스트"를 여러 번 포함하여 더 큰 상자 크기의 두 상자가 필요합니다(각 상자마다 다름).
다음 코드를 작성하면 아래와 같은 결과가 나타납니다(텍스트는 원하는 반복 횟수가 아닌 상자 외부에 나타납니다).
누구든지 도와줄 수 있나요?
감사해요
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\newbox\mybox
\def\mysaver{%
\pgfmathparse{\pgfpositionnodelatermaxx-\pgfpositionnodelaterminx}%
\xdef\nodeW{\pgfmathresult pt}%
\pgfmathparse{\pgfpositionnodelatermaxy-\pgfpositionnodelaterminy}%
\xdef\nodeH{\pgfmathresult pt}%
}
\begin{document}
\begin{tikzpicture}
\begin{scope}
{\pgfpositionnodelater{\mysaver}
% This node is clearly outside the grid
\node [inner sep=0] {Text};}
\node (a)
[draw,rounded corners=6pt,rectangle,inner sep=0.4cm]
{
\tikz{
\foreach \x in {0,\nodeW+0.2cm,\nodeW*2+0.2cm*2,\nodeW*3+0.2cm*3,\nodeW*4+0.2cm*4}
\foreach \y in {0,\nodeH+0.2cm,\nodeH*2+0.2cm*2,\nodeH*3+0.2cm*3}
\node [inner sep=0] at (\x,\y) {Text};
\node [inner sep=0] at (\nodeW*2+0.2cm*2,\nodeH*4+0.2cm*4) {Text};
}
};
\node (b) [right=0.4cm of a,inner sep=0] {Text Text};
{\pgfpositionnodelater{\mysaver}
% This node is clearly outside the grid
\node [inner sep=0] {Text};}
\node (c) [fit=(a),right=0.4cm of b,draw,rounded corners=6pt,rectangle,inner sep=0]
{
\tikz{
\foreach \x in {0,\nodeW+0.2cm}
\foreach \y in {0,\nodeH+0.2cm,\nodeH*2+0.2cm*2}
\node [inner sep=0] at (\x,\y) {Text};
}
};
\end{scope}
\end{tikzpicture}
\end{document}
업로드가 작동하지 않으므로 그림에 대한 링크는 다음과 같습니다. https://drive.google.com/file/d/1e_bcgi96F45zsaeAd0kYY96fpe53mAR4/view?usp=sharing
답변1
문제는 Ti를 중첩하면 안 된다는 것입니다.케이Z 사진이 필요하지 않습니다.
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{fit,calc}
\newbox\mybox
\def\mysaver{%
\pgfmathparse{\pgfpositionnodelatermaxx-\pgfpositionnodelaterminx}%
\xdef\nodeW{\pgfmathresult pt}%
\pgfmathparse{\pgfpositionnodelatermaxy-\pgfpositionnodelaterminy}%
\xdef\nodeH{\pgfmathresult pt}%
}
\begin{document}
\begin{tikzpicture}
\begin{scope}
{\pgfpositionnodelater{\mysaver}
% This node is clearly outside the grid
\node [inner sep=0] {Text};}
\node (a)
[draw,rounded corners=6pt,rectangle,inner sep=0.4cm]
{
\tikz{
\foreach \x in {0,\nodeW+0.2cm,\nodeW*2+0.2cm*2,\nodeW*3+0.2cm*3,\nodeW*4+0.2cm*4}
\foreach \y in {0,\nodeH+0.2cm,\nodeH*2+0.2cm*2,\nodeH*3+0.2cm*3}
\node [inner sep=0] at (\x,\y) {Text};
\node [inner sep=0] at (\nodeW*2+0.2cm*2,\nodeH*4+0.2cm*4) {Text};
}
};
\node (b) [right=0.4cm of a,inner sep=0] {Text Text};
{\pgfpositionnodelater{\mysaver}
% This node is clearly outside the grid
\node [inner sep=0] {Text};}
\node (c) [fit=(a),right=0.4cm of b,draw,rounded corners=6pt,rectangle,inner sep=0]
{
};
\foreach \x in {0,\nodeW+0.2cm}
\foreach \y in {0,\nodeH+0.2cm,\nodeH*2+0.2cm*2}
\node [inner sep=0] at ($(c.center)+(\x,\y)$) {Text};
\end{scope}
\end{tikzpicture}
\end{document}
답변2
를 사용해야 하는지는 확실하지 않습니다 Tikz
. 그렇지 않은 경우 tcolorbox
다음을 사용하여 결과를 작성하고 작성할 수 있습니다 equal height group
.
\documentclass{article}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[1][]{%
notitle,
equal height group=MyGroup,
before=,
after=\hfill,
valign=center,
#1}
\begin{document}
\begin{mybox}[width=.4\linewidth]
Text\\ Text Text Text Text\\
Text Text Text Text\\
Text Text Text Text\\
\end{mybox}
%
\begin{mybox}[blanker, width=15mm]
Text Text
\end{mybox}
%
\begin{mybox}[width=.3\linewidth]
Text Text\\
Text Text
\end{mybox}
\end{document}