Last active
December 16, 2015 11:58
-
-
Save stex/5430925 to your computer and use it in GitHub Desktop.
Simple LaTeX macro to draw a t(ombstone) diagram for compiler chains.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Creates an image displaying the compilation of a compiler and the result | |
\begin{picture}(300,75) | |
\put(0,25) {\tdiagram(from Q to M_2 in Q)} | |
\put(65,0) {\tdiagram(from Q to M_1 in M_1)} | |
\put(130,25) {\tdiagram(from Q to M_2 in M_1)} | |
\end{picture} | |
%Creates an image of a compiler chain | |
\begin{picture}(200,50) | |
\put(0,0) {\tdiagram(from Q to Z in Q)} | |
\put(100,0) {\tdiagram(from Z to M_2 in Q)} | |
\end{picture} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Usage: | |
% \tdiagram{from Q to Z in M_1} | |
\def\tdiagram(from #1 to #2 in #3){% | |
\begin{picture}(100,50) | |
\put (0,50) {\line(1,0) {100}} | |
\put (0,25) {\line(0,1) {25}} | |
\put (100,50) {\line(0,-1) {25}} | |
% __ __ T bottom elements | |
\put (100,25) {\line(-1,0) {35}} | |
\put (0, 25) {\line(1,0) {35}} | |
% | | left and right | |
\put (35,25) {\line(0,-1) {25}} | |
\put (65,25) {\line(0,-1) {25}} | |
% |__| bottom | |
\put (35,0) {\line(1,0) {30}} | |
%From -> To | |
\put(10,35){$#1$} | |
\put(45,35){$\rightarrow$} | |
\put(80,35){$#2$} | |
%In | |
\put(45,10) {$#3$} | |
\end{picture} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment