Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
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

3 Answers 3

up vote 6 down vote accepted

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

share|improve this answer
    
Thank you very much –  SoftTimur Apr 26 '11 at 14:49

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

share|improve this answer
    
Thank you, but it does not return what i want... –  SoftTimur Apr 26 '11 at 14:49
\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

share|improve this answer
    
Thank you very much –  SoftTimur Apr 26 '11 at 14:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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