![外部框内并排有两个内部文本框](https://linux22.com/image/463470/%E5%A4%96%E9%83%A8%E6%A1%86%E5%86%85%E5%B9%B6%E6%8E%92%E6%9C%89%E4%B8%A4%E4%B8%AA%E5%86%85%E9%83%A8%E6%96%87%E6%9C%AC%E6%A1%86.png)
此代码
\documentclass{scrartcl}
\usepackage[margin=1.2cm]{geometry}
\renewcommand{\familydefault}{\sfdefault}
\setkomafont{subsubsection}{\scriptsize}
\usepackage{tabularray}
\usepackage{varwidth}
\usepackage{array}
\usepackage{colortbl}
\usepackage{amsmath}
\usepackage{sfmath}
\usepackage[]{scrlayer-scrpage}
\usepackage{tikz}
\usetikzlibrary{angles,
babel,
calc,
positioning,
quotes,
shadings, shapes.geometric,
3d}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{shadings}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins,xparse}
\tcbuselibrary{breakable}
\tcbset{
innenboxstyle/.style={
% Horizontale Aufteilung ===========
sidebyside adapt=right, % nein, sondern
% lefthand width=4cm, % entweder absolutes Maß
%lefthand ratio=0.65, % oder Verhältnis festlegen
% Farben und Schrift ===========
%lower separated=false,% kein Effekt, da eh weg
bicolor,colback=gray!10, colbacklower=white,
fonttitle=\bfseries,
fontupper=\scriptsize,
sharpish corners, colframe=gray!20!black, colbacktitle=gray!40,coltitle=black,
scale=1.0, % besser die tikzpictures skalieren, statt die ganzen Boxen
% Alignment ===========
sidebyside align=top seam, % vermutlich gewünscht
left=0mm, % Sonst Probleme mit dem halign lower,
% der boxsep noch gibt einen zusätzlichen Defalult-Abstand
valign lower=center,
halign lower=center,
},
seitenboxstyle/.style={
sidebyside,
sidebyside align=top seam,
sidebyside gap=3mm,
sharpish corners,
lower separated=false,
colframe=gray!10!black,colback=white,fonttitle=\bfseries
% height fill, % grundsätzlich seiten-hoch % evtl. brauchbar
},
innenboxstylezwei/.style={
% Horizontale Aufteilung ===========
%sidebyside adapt=right, % nein, sondern
% lefthand width=4cm, % entweder absolutes Maß
%lefthand ratio=0.65, % oder Verhältnis festlegen
% Farben und Schrift ===========
%lower separated=false,% kein Effekt, da eh weg
bicolor,colback=gray!10, colbacklower=white,
fonttitle=\bfseries,
fontupper=\scriptsize,
sharpish corners, colframe=gray!20!black, colbacktitle=gray!40,coltitle=black,
scale=1.0, % besser die tikzpictures skalieren, statt die ganzen Boxen
% Alignment ===========
sidebyside align=top seam, % vermutlich gewünscht
left=0mm, % Sonst Probleme mit dem halign lower,
% der boxsep noch gibt einen zusätzlichen Defalult-Abstand
valign lower=center,
halign lower=center,
},
}
\setkomafont{pageheadfoot}{\normalfont\sffamily\scriptsize}
\setkomafont{subsubsection}{\scriptsize}
%----------------------------------------------------------------------------------
\newcommand\seitentitelI{Title }%=========
\newcommand\titelVII{Subtitle}
\newcommand\textVII{\subsubsection*{Area}
\begin{equation*}
A=\frac{1}{2}\cdot g\cdot h
\end{equation*}}
\newcommand\bildVII{\begin{tikzpicture}[scale=1.1, very thick, font=\footnotesize]%,cap=round,>=latex]
\coordinate [] (A) at (-0.6cm,-1.cm);
\coordinate [] (C) at (1.8cm,-1.0cm);
\coordinate [] (B) at (1cm,0.4cm);
\coordinate [label=right:h] (H) at (0.6cm,-0.4cm);
\draw[very thick] (A) -- node[sloped,above] {} (B) -- node[sloped,above,] {} (C) -- node[below] {g} (A);
\draw[dashed, thick] (B) -- (A-|B) ;
\end{tikzpicture}}
% =====================================
% =====================================
\newcommand*{\xdash}[1][3em]{\rule[0.5ex]{#1}{0.55pt}}
%-----------------------------------------
\begin{document}
\begin{tcolorbox}[seitenboxstyle, title={\seitentitelI}]
\tcbsidebyside[innenboxstyle, title={\titelVII},]{\textVII}{\bildVII}
\end{tcolorbox}
\end{document}
生成一个带有一个内框的外框(字幕)。
此代码
\documentclass{scrartcl}
\usepackage{sfmath}
\usepackage{tabularray}
\usepackage{tikz}
\usetikzlibrary{angles,
babel,
calc,
positioning,
quotes,
shadings, shapes.geometric,
3d}
\tikzset{baseline=(current bounding box.center),
my angle/.style = {draw, font=\small,
angle eccentricity=1.75, angle radius=3mm},
base/.style = {draw, thick},
dashline/.style = {densely dashed, very thick},
every edge quotes/.style = {auto=right, inner sep=1pt, font=\small},
Trapezium/.style = {base, trapezium,
trapezium left angle=60, trapezium right angle=120,
minimum width=30mm}
}
\begin{document}
\begin{center}
\begin{tblr}{hline{1,2,Z} = 1pt, vline{1,Z} = 1pt,
hline{even[3-X]} = {dashed, fg=gray, 0.5pt},
colspec = {Q[l, bg=gray!10, font=\bfseries]
Q[l, bg=gray!10, mode=math, rightsep=24pt]
Q[c]},
cell{even[2]}{2,3} = {r=2}{},
row{1} = {bg=gray!30},
row{2-Z}= {rowsep = 4pt}
}
\SetCell[c=3]{l} Drawing & & \\
Area & A=g\cdot h &
\tikz{ \node (a) [Trapezium] {};
\draw [dashline] (a.north west) to["$h$" '] (a.south west);
\path (a.bottom left corner) to["$g$"] (a.bottom right corner);
} \\
& & \\
Circumference
& u=2\cdot a+2\cdot b &
\tikz{ \node (a) [Trapezium] {};
\path (a.top left corner) to["$a$" ] (a.bottom left corner)
(a.bottom left corner) to["$b$"] (a.bottom right corner);;
} \\
& & \\
\end{tblr}
\end{center}
\end{document}
生成另一个框,该框通过表格解决方案进行拆分。我想将此框包含在外框中,位于第一个代码的内框“Subtitle”旁边。到目前为止,我的尝试都失败了。
答案1
像这样?
\documentclass{scrartcl}
\usepackage[margin=1.2cm]{geometry}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{tikz}
\usetikzlibrary{angles,
babel,
calc,
positioning,
quotes,
shadings, shapes.geometric,
3d}
\tikzset{baseline=(current bounding box.center),
my angle/.style = {draw, font=\small,
angle eccentricity=1.75, angle radius=3mm},
base/.style = {draw, thick},
dashline/.style = {densely dashed, very thick},
every edge quotes/.style = {auto=right, inner sep=1pt, font=\small},
Trapezium/.style = {base, trapezium,
trapezium left angle=60, trapezium right angle=120,
minimum width=30mm}
}
\usepackage{tcolorbox}
\tcbset{fonttitle=\Large\bfseries, coltitle=white, colback=white,
colframe=cyan,nobeforeafter,
sidebyside, sidebyside gap=3mm,
lower separated=false
}
\usepackage{tabularray}
\usepackage{lipsum}
\usepackage{siunitx}
\begin{document}
\noindent
\begin{tcolorbox}[title=Title]
\begin{tblr}{%width=0.49\textwidth,
hline{1,2,Z} = 1pt, vline{1,Z} = 1pt,
hline{even[3-X]} = {dashed, fg=gray, 0.5pt},
colspec = {Q[l, bg=gray!10, font=\bfseries]
Q[l, bg=gray!10, mode=math]
Q[c]},
colsep = 3pt,
cell{even[2]}{2,3} = {r=2}{},
row{1} = {bg=gray!30},
row{2-Z}= {rowsep = 4pt}
}
\SetCell[c=3]{l} Drawing & & \\
Area & A=g\cdot h &
\tikz{ \node (a) [Trapezium] {};
\draw [dashline] (a.north west) to["$h$" '] (a.south west);
\path (a.bottom left corner) to["$g$"] (a.bottom right corner);
} \\
& & \\
Circumference
& u=2\cdot a+2\cdot b &
\tikz{ \node (a) [Trapezium] {};
\path (a.top left corner) to["$a$" ] (a.bottom left corner)
(a.bottom left corner) to["$b$"] (a.bottom right corner);;
} \\
& & \\
\end{tblr}
\tcblower % right side of box
\begin{tblr}{%width=0.49\textwidth,
hline{1,2,Z} = 1pt, vline{1,Z} = 1pt,
hline{even[3-X]} = {dashed, fg=gray, 0.5pt},
colspec = {Q[l, bg=gray!10, font=\bfseries]
Q[l, bg=gray!10, mode=math]
Q[c]},
colsep = 3pt,
cell{even[2]}{2,3} = {r=2}{},
row{1} = {bg=gray!30},
row{2-Z}= {rowsep = 4pt}
}
\SetCell[c=3]{l} Drawing & & \\
Area & A=g\cdot h &
\tikz{ \node (a) [Trapezium] {};
\draw [dashline] (a.north west) to["$h$" '] (a.south west);
\path (a.bottom left corner) to["$g$"] (a.bottom right corner);
} \\
& & \\
Circumference
& u=2\cdot a+2\cdot b &
\tikz{ \node (a) [Trapezium] {};
\path (a.top left corner) to["$a$" ] (a.bottom left corner)
(a.bottom left corner) to["$b$"] (a.bottom right corner);;
} \\
& & \\
\end{tblr}
\end{tcolorbox}
\end{document}