Can anyone share me several fancy table templates? I want to make this thread like a reference so that each time I need a template, I could just go here. If you can, please provide a screenshot for illustrative purpose. Thanks in advance 😉
[Tex/LaTex] Example of fancy table using TikZ package
tablestikz-pgf
Related Solutions
I would like to suggest that you not use the multirow
package. Instead, place all level-1 information in the first row of header.
I would also like to suggest that you use S[table-format=3.0]
instead r
for the second column. Columns 3 to 5 will look better if you use columns of type c
. You may also want to replace the *
multiplicative symbol with the more prominent \times
symbol; you could write 1024$\times$1024
, as is done in the code below, or you could write \num{1024x1024}
(egreg's suggestion -- many thanks!), where \num
is a macro provided by the siunitx
package.. If you choose the latter input method, you may also want provide the instruction \sisetup{tight-spacing=true}
in the preamble in order to avoid having a lot of whitespace around the \times
symbols.
Separately, I think you should also consider getting rid of the whitespace to the left of the first column and to the right of the final column. The resulting look is shown in the second example below.
\documentclass{article}
\usepackage{booktabs,siunitx}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ l S[table-format=3.0] c c c }
\toprule
Models & {Tris (M)} & Resolution &\multicolumn{2}{c}{Avg.\ FPS} \\
\cmidrule(l){4-5}
&&& moving & static \\
\midrule
Model 1 & 5 & 1024$\times$1024 & 40 & 60 \\
Model 2 & 12 & 1024$\times$1024 & 40 & 60 \\
Model 3 & 73 & 1024$\times$1024 & 40 & 40 \\
Model 4 & 337 & 1024$\times$1024 & 20 & 30 \\
\bottomrule
\end{tabular}
%% now, without whitespace to the left of first col and to the right of final col
\bigskip
\begin{tabular}{@{} l S[table-format=3.0] c c c @{}}
\toprule
Models & {Tris (M)} & Resolution &\multicolumn{2}{c}{Avg.\ FPS} \\
\cmidrule(l){4-5}
&&& moving & static \\
\midrule
Model 1 & 5 & 1024$\times$1024 & 40 & 60 \\
Model 2 & 12 & 1024$\times$1024 & 40 & 60 \\
Model 3 & 73 & 1024$\times$1024 & 40 & 40 \\
Model 4 & 337 & 1024$\times$1024 & 20 & 30 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
One fairly simple-minded option:
\documentclass[tikz,border=10pt,multi]{standalone}
\usetikzlibrary{positioning,arrows.meta,,bending}
\begin{document}
\begin{tikzpicture}
[
>/.tip={Triangle[length=7.5pt,width=5pt,bend]},
line width=1pt,
my circle/.style={minimum width=10mm, circle, draw},
my label/.style={above=10pt, anchor=mid}
]
\node (1) [my circle] {$1$};
\node (2) [my circle, right=75pt of 1] {$2$};
\path [postaction={draw, {>[sep=5pt,reversed]}-{<[sep=5pt]}}, draw] (1) -- (2) node [very near start, my label] {$\alpha$} node [very near end, my label] {$\beta$} ;
\path [->, draw] (2.south east) arc (-135:135:5mm) node [near end, my label] {$1-\beta$};
\path [->, draw] (1.south west) arc (-45:-315:5mm) node [near end, my label] {$1-\alpha$};
\end{tikzpicture}
\end{document}
Best Answer
Here's an example which I wrote for my TeX blog. It defines a
matrixtable
environment which uses the TikZmatrix of nodes
feature.