# Replicate pseudocode

I was looking for some LaTeX code to replicate the result shown on the image below. This image is taken from the book "Temporal Verification of Reactive Systems - safety"

• Welcome to TeX.SX!. Please post a Welcome to TeX.SX!. When asking questions it is better to provide a full minimal working example (MWE) both in order to demonstrate what you are trying to do and to help others help you. The MWE should look like \documentclass...\begin{document}...\end{document}, it should compile and contain close to the minima – user30471 Mar 3 '15 at 12:05
• I don't have a MWE because it's an image, i don't know how to make it. I'm asking suggestions. – Zack Mar 3 '15 at 12:25
• Well, the idea is that you should try and to get something that is close to working first. It doesn't have to be perfect... – user30471 Mar 3 '15 at 12:27

This looks pretty awful but it looks similar to your image:)

\documentclass{article}
\usepackage{amsmath}
\usepackage{framed}
\begin{document}

\begin{figure}
\begin{framed}
\begin{center}
\begin{tabular}{lr@{:\space}l}
\textbf{in} & $a,b$ & \textbf{integer where } $a>0$, $b>0$\\
\textbf{local} & $y_1,y_2$ & \textbf{integer where } $y_1=a$, $y_2=b$\\
\textbf{out} & $g$ & \textbf{integer}
\end{tabular}
\end{center}
\begin{equation*}
\left[\begin{array}{l}
\ell_0: \left[ \begin{array}{l}
\ell_1: \textbf{while $y_1\ne y_2$ do}\\
\left[ \begin{array}{l}
{\ell_3:\textbf{ await }y_2>y_1;\ell_4: y_2=y_1-y_2}\\
{\ell_5:\textbf{ await }y_2>y_1;\ell_6: y_2=y_2-y_1}
\end{array}
\right]\\
\ell_7: g:=y_1\\
\end{array}
\right]\\
\ell_8:
\end{array}
\right]
\end{equation*}
\caption{A fully labeled program GCD-F.}
\end{framed}
\end{figure}

\end{document}


The output:

• Thanks so much! It's exactly what i was looking for. It doesn't look awful in my opinion! – Zack Mar 3 '15 at 16:32