Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- newcommand{tabler}[1]{matrix(m)[matrix of nodes, ampersand replacement=&]{#1};}
- tabler{col 1&col 2&col 3&col 4}{3,1,3}
- |--col 1--|--col 2--|--col 3––|--col 4––|
- | width 3 | width 1 | width 3 |
- documentclass{scrartcl}
- usepackage{xparse, tikz}
- usetikzlibrary{matrix}
- makeatletter
- newcommandtotcol{pgf@matrix@numberofcolumns}
- makeatother
- pgfkeys{
- /tabler/execute macro/.style = {/tabler/save/.expand once=#1},
- /tabler/save/.store in=numcols
- }
- NewDocumentCommandtabler{m}{
- matrix(m)[/tabler/execute macro={totcol},
- matrix of nodes,
- ampersand replacement=&] at (0,0)
- {#1};
- node at (0,0) {numcols{}};
- }
- begin{document}
- begin{tikzpicture}
- tabler{a & b& c & d & e\}
- end{tikzpicture}
- end{document}
- makeatletter
- newcommandtotcol{pgf@matrix@numberofcolumns}
- makeatother
- documentclass[tikz,border=3.14mm]{standalone}
- usetikzlibrary{matrix}
- makeatletter
- tikzset{store number of columns in/.style={execute at end matrix={
- xdef#1{thepgf@matrix@numberofcolumns}}}}
- makeatother
- begin{document}
- begin{tikzpicture}
- matrix[matrix of nodes,store number of columns in=mymatcols] (mat){
- a & b & c & d & e\
- a & b & c & d & e\
- a & b & c & d & e\
- };
- draw[latex-latex] ([yshift=1ex]mat.north west) -- ([yshift=1ex]mat.north east)
- node[midway,fill=white]{mymatcols};
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement