我想画一个这样的表格(https://i.stack.imgur.com/U0n2r.jpg)
但是我不知道如何使用 tikz 来实现这一点?
我的代码如下:
但它还远远没有达到这个水平!
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage[svgnames,table]{xcolor}
\usepackage[top=0.5cm, bottom=0cm, left=0.5cm, right=1cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{matrix}
\definecolor{bgcolor}{cmyk}{0.72,0.97,0.27,0.14}
\definecolor{lcolor}{cmyk}{0.55,0.75,0.27,0.001}
\usepackage{array}
%\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\color{white}
\pagecolor{bgcolor}
\arrayrulecolor{lcolor}
\arrayrulewidth=1.5pt
%\setlength{\tabcolsep}{20pt}
\renewcommand{\arraystretch}{4}
\resizebox{\textwidth}{!}{
%use m{1cm} instead of c
\begin{tabular}{c|c||c||c||c||c||c||c||c||c|}
& \textbf{\shortstack{\includegraphics[width=1.5cm]{Internet_Computer.png}\\Internet\\ Computer}}
& \textbf{\shortstack{\includegraphics[width=1.5cm]{ethereum.png}\\Ethereum}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{Polkadot.png}\\Polkadot}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{Cardano.png}\\Cardano}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{Solana.png}\\Solana}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{binanceSmartChange.png}\\Biance \\Smart Chain}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{Zilliqa.png}\\Zilliqa}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{Algorand.png}\\Algorand}}
&\textbf{\shortstack{\includegraphics[width=1.5cm]{Avalanche.png}\\Avalanche}}
\\
\textbf{Symbol}& ICP& ETH& DOT&ADA&SQL&BNB&ZIP&ALGO&AVAX\\
%%%%%%%%%%%%55
\textbf{\shortstack{Max.\\Supply}}
&\shortstack{472\\Million}&\shortstack{117\\Million}&\shortstack{1103\\Million}&\shortstack{45000\\Million}&\shortstack{503\\Million}&\shortstack{168\\Million}&\shortstack{21000\\Million}&\shortstack{10000\\Million}&\shortstack{720\\Million}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Genesis$^\star$}}
&\shortstack{May 2021}&\shortstack{July 2015}&\shortstack{May 2020}&\shortstack{Sept 2017}&\shortstack{Mar 2020}&\shortstack{April 2019}&\shortstack{Jan 2019}&\shortstack{June 2019}&\shortstack{Sept 2020}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Consensus\\Mechanism}}
&\shortstack{Threshold\\Relay}&\shortstack{PaW\\-\\Proof of\\Work}&\shortstack{NPos\\-\\Nominated\\Proof of \\Stake}&\shortstack{Pos\\-\\Proof of Stake\\(Outroboros)}&\shortstack{Pos\\-\\Proof of Stake}&\shortstack{Pos\\-\\Proof of Stake}&\shortstack{PBFT\\-\\Practical\\Byzantine\\Fault\\Tolerance}&\shortstack{PPos\\-\\Pure Proof\\Stake}&\shortstack{Pos\\-\\Proof of Stake}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Average\\Block Time}}
&\shortstack{0.045 \$\\(1 block)}&\shortstack{14 \$\\(1 block)}&\shortstack{6 \$\\(1 block)}&\shortstack{20 \$\\(1 block)}&\shortstack{0.4 \$\\(1 block)}&\shortstack{5 \$\\(1 block)}&\shortstack{40 \$\\(1 block)}&\shortstack{4.5 \$\\(1 block)}&\shortstack{2 \$\\(1 block)}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Blocks per\\second}}
&\shortstack{22.5}&\shortstack{0.07}&\shortstack{0.17}&\shortstack{0.05}&\shortstack{2.5}&\shortstack{0.2}&\shortstack{0.02}&\shortstack{0.22}&\shortstack{0.5}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Finality}}
&\shortstack{Web Speed \\ (2 s)}&\shortstack{5 min}&\shortstack{60 s}&\shortstack{2 min}&\shortstack{13 s}&\shortstack{75 s}&\shortstack{2 min}&\shortstack{5 s}&\shortstack{3 s}\\
%%%%%%%%%%%%55
\textbf{\shortstack{TPS}}
&\shortstack{No limit}&\shortstack{15}&\shortstack{1,000}&\shortstack{250}&\shortstack{50,000}&\shortstack{130}&\shortstack{3,000}&\shortstack{1,000}&\shortstack{4,500\\per subnet}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Number of \\ Validators}}
&\shortstack{233}&\shortstack{6,833}&\shortstack{297}&\shortstack{2,376}&\shortstack{1,027}&\shortstack{21}&\shortstack{12}&\shortstack{100}&\shortstack{1027}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Ability to\\Scale}}
&\shortstack{Yes,\\unlimited}&\shortstack{No,\\planned\\ETH 2.0}&\shortstack{Yes, limited\\prachains}&\shortstack{no,\\planned\\Hydra}&\shortstack{Yes, with\\Proof of\\History}&\shortstack{Yes, with\\Proof of\\Authority}&\shortstack{Yes, with\\ PBFT}&\shortstack{Yes, with\\ Proof of\\Stake}&\shortstack{Yes, with\\ Proof of\\Stake}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Average\\Transaction\\fee}}
&\shortstack{\$0.006\\(0.0001 ICP)}&\shortstack{\$30.86}&\shortstack{\$0.544}&\shortstack{0.38}&\shortstack{\$0.00025}&\shortstack{\$0.01}&\shortstack{\$0.00002}&\shortstack{\$0.002\\(0.001 ALGO)}&\shortstack{\$0.03}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Smart\\Contracts}}
&\shortstack{Yes, called\\ canisters$^\star$}&\shortstack{Yes}&\shortstack{No}&\shortstack{Yes}&\shortstack{Yes}&\shortstack{Yes}&\shortstack{Yes}&\shortstack{Yes}&\shortstack{Yes}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Language}}
&\shortstack{Motoko,\\ and any \\which\\compiles\\to WASM}&\shortstack{Solidity,\\ Vyper and\\ others}&\shortstack{In the\\ future, the\\ parachains\\ will\\ support it}&\shortstack{Plutus,\\Marlowe,\\Glow}&\shortstack{Rust, C,\\C++}&\shortstack{Solidity,\\Truffle}&\shortstack{Solla}&\shortstack{Javascript,\\Python,\\Java and\\Go}&\shortstack{Solidity}\\
%%%%%%%%%%%%55
\textbf{\shortstack{On-Chain\\Governance}}
&\shortstack{Yes, \\through\\ Network\\ Nervous \\System\\(NNS)}&\shortstack{No}&\shortstack{Yes}&\shortstack{No}&\shortstack{No}&\shortstack{No}&\shortstack{No}&\shortstack{In process}&\shortstack{Only for\\ critical\\parameters\\of the\\network}\\
%%%%%%%%%%%%55
\textbf{\shortstack{Staking\\Rewards\\(APY per\\year)}}
&\shortstack{15.4\%\\-\\28.9\%}&\shortstack{4\%\\-\\12\%}&\shortstack{6.5\%\\-\\15\%}&\shortstack{5\%\\-\\7\%}&\shortstack{7.51\%}&\shortstack{12.88\%\\(average)}&\shortstack{6\%}&\shortstack{5.56\%}&\shortstack{10.06\%\\(average)}\\
\end{tabular}
}
\centering
\small{$^\star$The Genesis Block, Also known as Block0, is the very first block minted in a blockchain.}
\end{document}
答案1
一个小例子TikZ
:
\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[
tabnode/.style={minimum width=2cm, text width=18mm, align=center, anchor=center},
mytabular/.style={matrix of nodes, nodes in empty cells, nodes=tabnode,
column sep=.5mm, row sep=.5mm}]
\matrix(A)[mytabular]{
& {\includegraphics[width=\textwidth]{example-image-a}\\Title A} & {\includegraphics[width=\textwidth]{example-image-b}\\Title B} \\
First row & This is a cell & Second cell in first row\\
Second row & 23 & 1023.5\\
};
\draw[rounded corners] (A-1-2.north west) rectangle (A-3-2.south east);
\draw[rounded corners] (A-1-3.north west) rectangle (A-3-3.south east);
\end{tikzpicture}
\end{document}
答案2
{NiceTabular}
的一个例子nicematrix
。
\documentclass{article}
\usepackage{nicematrix,tikz}
\begin{document}
\NiceMatrixOptions{cell-space-limits=4pt}
\newcommand{\FrameColumn}{\Block[tikz={offset=1pt,rounded corners,draw}]{*-1}{}}
\begin{NiceTabular}{cm[c]{2cm}m[c]{2cm}}
& \FrameColumn
\includegraphics[width=\textwidth]{example-image-a}
& \FrameColumn
\includegraphics[width=\textwidth]{example-image-b} \\[2mm]
& Title A & Title B \\[2mm]
First row & This is a cell & Second cell in first row \\[2mm]
Second row & 23 & 1023.5 \\
\end{NiceTabular}
\end{document}