Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[10pt]{article}
- usepackage[margin=2cm]{geometry} % just for the example
- usepackage[frenchb]{babel}
- usepackage[table]{xcolor}
- usepackage{array}
- usepackage{tikz}
- usepackage{lipsum}
- usetikzlibrary{calc,shadings}
- % Andrew Stacey's code from
- % http://tex.stackexchange.com/a/50054/3954
- makeatletter
- tikzset{%
- remember picture with id/.style={%
- remember picture,
- overlay,
- save picture id=#1,
- },
- save picture id/.code={%
- edefpgf@temp{#1}%
- immediatewritepgfutil@auxout{%
- noexpandsavepointas{pgf@temp}{pgfpictureid}}%
- },
- if picture id/.code args={#1#2#3}{%
- @ifundefined{save@pt@#1}{%
- pgfkeysalso{#3}%
- }{
- pgfkeysalso{#2}%
- }
- }
- }
- defsavepointas#1#2{%
- expandaftergdefcsname save@pt@#1endcsname{#2}%
- }
- deftmk@labeldef#1,#2@nil{%
- deftmk@label{#1}%
- deftmk@def{#2}%
- }
- tikzdeclarecoordinatesystem{pic}{%
- pgfutil@in@,{#1}%
- ifpgfutil@in@%
- tmk@labeldef#1@nil
- else
- tmk@labeldef#1,(0pt,0pt)@nil
- fi
- @ifundefined{save@pt@tmk@label}{%
- tikz@scan@one@pointpgfutil@firstofonetmk@def
- }{%
- pgfsys@getposition{csname save@pt@tmk@labelendcsname}save@orig@pic%
- pgfsys@getposition{pgfpictureid}save@this@pic%
- pgf@process{pgfpointoriginsave@this@pic}%
- pgf@xa=pgf@x
- pgf@ya=pgf@y
- pgf@process{pgfpointoriginsave@orig@pic}%
- advancepgf@x by -pgf@xa
- advancepgf@y by -pgf@ya
- }%
- }
- newcommandtikzmark[2][]{%
- tikz[remember picture with id=#2] {#1;}}
- makeatother
- % end of Andrew's code
- newcommandShadeCell[4][0pt]{%
- begin{tikzpicture}[overlay,remember picture]%
- shade[#4] ( $ (pic cs:#2) + (0pt,2ex) $ ) rectangle ( $ (pic cs:#3) + (0pt,-#1*baselineskip-.8ex) $ );
- end{tikzpicture}%
- }%
- begin{document}
- ShadeCell[14]{start1}{end1}{%
- shading=color wheel white center,opacity=.15}
- ShadeCell{start2}{end2}{%
- left color=red!20,right color=green!20}
- ShadeCell[13]{start3}{end3}{%
- top color=green!20,bottom color=red!20}
- ShadeCell{start4}{end4}{%
- left color=blue!20,right color=green!20}
- begin{tabular}{| l | p{6cm} | c |}
- hline
- Uncolored cell
- & multicolumn{1}{!{tikzmark{start1}} p{6cm} !{vruletikzmark{end1}}}{lipsum*[2]}
- & Uncolored cell \
- hline
- multicolumn{1}{!{vruletikzmark{start2}} l !{vruletikzmark{end2}}}{Another colored cell}
- & Another uncolored cell & Another uncolored cell \
- hline
- Uncolored cell
- & lipsum[4]
- & multicolumn{1}{!{tikzmark{start3}} c !{vruletikzmark{end3}}}{Another colored cell} \
- hline
- multicolumn{2}{!{vruletikzmark{start4}} c !{vruletikzmark{end4}}}{Another merged colored cell}
- & Uncolored cell \
- hline
- end{tabular}
- end{document}
- !{tikzmark{<name1>}} <format> !{tikzmark{<name2>}}
- !{vruletikzmark{<name1>}} <format> !{vruletikzmark{<name2>}}
- ShadeCell{<name1>}{<name2>}{<shade specification>}
- ShadeCell[4]{<name1>}{<name2>}{<shade specification>}
- documentclass{article}
- usepackage{tikz}
- usetikzlibrary{matrix}
- begin{document}
- begin{tikzpicture}
- matrix (A) [matrix of nodes,
- row 2 column 2/.style={ nodes = { top color=blue!20, bottom color=red!20 }}]
- {
- A & B & C \
- D & E & F \
- G & H & I \
- };
- end{tikzpicture}
- end{document}
- documentclass{article}
- usepackage{tikz}
- usetikzlibrary{matrix,calc}
- begin{document}
- begin{tikzpicture}
- matrix (A) [matrix of nodes, nodes in empty cells,
- text height=9pt, text depth = 1pt,
- row 3 column 1/.style={
- nodes = { top color=green!20, bottom color=red!20 }},
- row 2 column 2/.style={
- nodes = { left color=blue!20, right color=red!20 }},
- row 1 column 3/.style={
- nodes = { top color=blue!20, bottom color=red!20 }},
- column 1/.style={ text width=15mm, align=left },
- column 2/.style={ text width=15mm, align=right },
- column 3/.style={ minimum width=20mm} % centered!
- ]
- {
- Lorem & ipsum & dolor \
- sit & amet & consectetur \
- adipiscing& {} & {} \
- };
- % Draw some lines
- draw (A-1-1.north east) -- (A-3-1.south east);
- draw[thick, dotted] (A-2-2.south west) -- (A-2-3.south east) -- (A-1-3.north east);
- % Faked multicolumn
- node[text height=9pt,text depth=1pt] at ($(A-3-2)!0.50!(A-3-3)$) { Multicol text here };
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement