I hope you can you help me. I am writing my homework with LaTeX (using TexStudio as environment).

enter image description here

This table contains three columns: Syntax, Strictness and Semantics. For my homework, I need to describe these table and the most important thing is the Semantics column. The developers used special algebraic symbols which I cannot find in the math package. Take for example the first line. The variable "i" underneath the "x" means that "i" will replace "x". But the fraction symbol is not really a fraction, isn't it? How can I use this in LaTeX? If you go futher until the "while" condition, you will realize the long dashed line, how can I use this?

It will be my first table in LaTeX because I have not used LaTeX for writing my essays/projects. I need also to know how tables are generated using LaTeX.

Please help.


Not really a beginner's task. Anyway, I think that this is a good occasion for learning something about LaTeX.

  1. Define commands for the various subtasks, after deciding what are the more frequent constructions and dividing them by kind;
  2. look at the table layout: we recognize three columns (r, c and l) in the “Original language syntax” part;
  3. add the items in a consistent way.

The structure I recognize are “metavariables”, “keys” (subdivided into words, operators, binary operations, relations and punctuation). In the last column, we can see the constructs in angle brackets; the fraction-like objects have been dealt with an array, with solid or dotted separator.

Finally, for the few cases a line has to be broken up, I define an ad hoc \dbl command. In a couple of cases, manual intervention is necessary.


\newcommand{\sem}[2]{\langle #1\rangle_{\mathsf{#2}}}


\multicolumn{3}{|c|}{Original language syntax} &
\multicolumn{1}{c|}{Strictness} &
\multicolumn{1}{c|}{Semantics} \\
& \Ceq & \meta{Int}\mid \meta{Id} &
\sem{\subexp{x}{i}\quad \sv}{k} \quad \sem{\sv\quad x\mapsto i\quad \sv}{state} \\
& \mid & \meta{AExp}\kbin{+}\meta{AExp} &
\str{strict} &
i_1\kbin{+}i_2 \to i_1 \sop{+}{Int} i_2 \\
& \mid & \meta{AExp}\kbin{/}\meta{AExp} &
\str{strict} &
i_1\kbin{/}i_2 \to i_1 \sop{/\!}{Int} i_2 \qquad \text{when $i_2\ne0$} \\
& \Ceq & \meta{AExp}\krel{<=}\meta{AExp} &
\str{seqstrict} &
i_1\krel{<=}i_2 \to i_1 \sop{\le}{Int} i_2 \\
& \mid & \kop{not}\meta{BExp} &
\str{strict} &
\kop{not} t \to \sop{\lnot}{Bool} t \\
& \mid & \meta{BExp}\krel{and}\meta{BExp} &
\str{strict\textup{(1)}} &
  \meta{true}\krel{and} b \to b \\
  \meta{false}\krel{and} b \to \kword{false}
} \\
& \Ceq & \kword{skip}\kpun{;} &
\kword{skip}\kpun{;} \to {\cdot} \\
& \mid & \meta{Id}\krel{=}\meta{AExp}\kpun{;} &
\str{strict\textup{(2)}} &
\sem{\subexp{x\krel{=}i\kpun{;}}{\cdot}\quad \sv}{k}
  \quad \sem{\sv\quad x\mapsto \subexp{{\!\underline{\quad }\!}}{\,i\,}\quad \sv}{state} \\
& \mid & \meta{Stmt}\quad \meta{Stmt} &
s_1\quad s_2 \rightharpoonup s_1 \curvearrowright s_2 \\
& \mid & \krel{if}\meta{BExp}\;\dbl{\krel{then}\meta{Stmt}\\\krel{else}\meta{Stmt}} &
\str{strict\textup{(1)}} &
    \krel{if}\meta{true}\krel{then} s \krel{else} \_ \to s \\
    \krel{if}\meta{false}\krel{then} \_ \krel{else} s \to s
  } \\
& \mid & \krel{while}\meta{BExp}\krel{then}\meta{Stmt} &
    {\krel{while} b \krel{do} s}
    {\krel{if} b \krel{then} (s\krel{while} b \krel{do} s)
  \quad \sv}{k} \\
& \Ceq & \kop{var}\mathsf{List}[\meta{Id}]\kpun{;}\quad \meta{Stmt} &
\sem{\dsubexp{\kop{var}xl\kpun{;}\quad s}{s}}{k}
  \quad \sem{\dsubexp{\cdot}{xl\mapsto 0}}{state} \\


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.