4

I want to type something like this page http://caml.inria.fr/pub/docs/manual-ocaml/expr.html. So I need to use \begin{align*} and \end{align*} which displays its contents math mode. Therefore italic font is needed. But when I type directly "value-path" for instance, its letters look very loose.

Does anyone know how to make its letters tighter?

  • 5
    Don't misuse a math environment to type text in a specific font. – Ulrike Fischer Apr 26 '11 at 13:57
  • 3
    The syntax package provides methods for typesetting simple grammars like this; it might save you a lot of work. – Alan Munn Apr 26 '11 at 14:03
  • Finally i use \textit{value-path} to realize italic words under math mode... – SoftTimur Apr 26 '11 at 14:48
7

An example using the syntax package:

\documentclass{article}
\usepackage{syntax}

\begin{document}
\begin{grammar}

<statement> ::= <ident> `=' <expr> 
\alt `for' <ident> `=' <expr> `to' <expr> `do' <statement> 
\alt `{' <stat-list> `}' 
\alt <empty> 
<stat-list> ::= <statement> `;' <stat-list> | <statement> 

\end{grammar} 
\end{document}

enter image description here

7

For "multiletter identifiers", use \mathit{expr}.

  • Thank you, but it does not return what i want... – SoftTimur Apr 26 '11 at 14:49
3
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{bera}
\usepackage{array}
\begin{document}
\begin{center}
\tabcolsep=1.4pt
\tabular[t]{@{} >{\itshape}l c >{\itshape}l @{}}
expr & ::= & value-path\\  
     &  |  & constant  \\
     &  |  & ( expr )  \\
\endtabular
\end{center}

\end{document}

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.