我受到这张图片中 HAL 的展示的启发,并想在乳胶中制作一些差不多相同的东西。
这是我当前的代码:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pgfgantt}
\usepackage{float}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{darkgray}{rgb}{0.66,0.66,0.66}
\definecolor{black}{rgb}{0,0,0}
\definecolor{white}{rgb}{1, 1, 1}
\tikzset{block/.style={rectangle, draw, fill=gray!50,
text width=10em, text centered, rounded corners=0pt, minimum height=0em}}
\title{boxes}
\date{February 2020}
\begin{document}
\maketitle
\begin{figure}[H]
\centering
\begin{tikzpicture}
\node[block, minimum height=2cm, xshift=2cm] (task) {Tasks};
\node[block, minimum height=2cm, fill=darkgray!150, below=of task, yshift=1cm] (executive) {Executive};
\node[block, minimum height=3cm, yshift=1cm, below=of executive] (driver) {Drivers};
\node[block, minimum height=1cm, below of=driver, xshift=0.53cm, text width=7em] (hal) {Hardware abstraction layer};
\node[block, minimum height=2cm, below=of driver, yshift=1cm](hardware) {Hardware};
\end{tikzpicture}
\caption{\label{fig:Fig1_ecosystem}HALs place in the hierarchy of the executionpath}
\end{figure}
\end{document}
答案1
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{array}
\begin{document}
\renewcommand\arraystretch{2}
\begin{tabular}{m{2cm}p{2cm}}
\rowcolor{gray!20}\multicolumn{2}{c}{bla bla bla} \\
\rowcolor{gray}\multicolumn{2}{c}{bla bla bla} \\
\rowcolor{gray!20}\multicolumn{2}{c}{bla bla bla} \\
\rowcolor{gray!20} & \cellcolor{gray!40} bla bla bla bla bla bla \\
\rowcolor{black}\multicolumn{2}{c}{\color{white} bla bla bla} \\
\end{tabular}
\end{document}