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?

3
  • 5
    Don't misuse a math environment to type text in a specific font. Commented Apr 26, 2011 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
    Commented Apr 26, 2011 at 14:03
  • Finally i use \textit{value-path} to realize italic words under math mode...
    – SoftTimur
    Commented Apr 26, 2011 at 14:48

3 Answers 3

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

0
7

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

1
  • Thank you, but it does not return what i want...
    – SoftTimur
    Commented Apr 26, 2011 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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .