使用tikz
和tikzshapes
,创建两个分割矩形。每个部分可以有不同的内部分离吗?
梅威瑟:
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[every text node part/.style={align=left}]
\node[rounded corners=0.5ex,inner sep=0.75ex,rectangle split, rectangle split parts=2, rectangle split part align={left},rectangle split part fill={gray,yellow}]
{
Energy Conversion in an IC Engine
\nodepart{two}
Chemical Energy $\rightarrow$ Heat Energy $\rightarrow$ Mechanical Energy
};
\end{tikzpicture}
\end{document}
答案1
您只需添加一个不可见的高物体即可。
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\begin{document}
\begin{tikzpicture}[every text node part/.style={align=left}]
\node[rounded corners=0.5ex,inner sep=0.75ex,rectangle split, rectangle split
parts=2, rectangle split part align={left},rectangle split part
fill={gray,yellow}]
{
Energy Conversion in an IC Engine
\nodepart{two}
\vphantom{$\vcenter{\vspace{2em}}$}%
Chemical Energy $\rightarrow$ Heat Energy $\rightarrow$ Mechanical Energy
};
\end{tikzpicture}
\end{document}
答案2
该tcolorbox
包装设计用于制作像这样的盒子。
\documentclass{article}
\usepackage{tcolorbox}
\begin{document}
\begin{tcolorbox}[
boxrule=0pt, left=.5ex, width=.75\textwidth,
colback=yellow, colframe=gray, coltitle=black,
title=Energy Conversion in an IC Engine
]
Chemical Energy $\rightarrow$ Heat Energy $\rightarrow$ Mechanical Energy
\end{tcolorbox}
\end{document}