# Typeset a solidus operator (free variable substitution)

I would like to typeset an operator like the one used to specify substitutions of variables with values in computer science. This is a sketch, just keep in mind that all this should span about on a single line, not two:

v /
/ x

v1, v_2 /
/ x1, x2


Obviously a simple v/x does not solve my problem, since v and x are written on the same exact line while I would like to have them smaller, with the v part aligned to the top of the / and the x aligned to the bottom.

Can you help me solving my problem please?

-
Can you point to an actual printed version of this notation? If simple v/x doesn't work, but the expression has to occupy a single line what would that look like? –  Alan Munn Oct 29 '11 at 15:10
Could you explain what is wrong with $v/x$? –  Seamus Oct 29 '11 at 15:11
@AlanMunn, Seamus: Werner already answered my question, thanks you however. I wanted v and x printed on a slightly different heights. –  Riccardo Oct 29 '11 at 15:29
I fixed my question in order to clarify this a little bit. –  Riccardo Oct 29 '11 at 15:31
@Riccardo The symbol is called a solidus –  Yiannis Lazarides Oct 29 '11 at 15:32

It seems like you might be after so-called "vulgar fractions". One such package that provides this is xfrac by means of \sfrac{<num>}{<denom>}. A similar functionality is provided by nicefrac that supplies an analogous \nicefrac{<num>}{<denom>}. With package options one is also able to choose between "ugly" and "nice" (default) fractions. And finally there's faktor that produces similar-style fractions using \faktor{<num>}{<denom>} (it requires the amssymb package though). Here are some comparisons:

\documentclass{article}
\usepackage{xfrac}% http://ctan.org/pkg/xfrac
\usepackage{nicefrac}% http://ctan.org/pkg/nicefrac
\usepackage{faktor}% http://ctan.org/pkg/faktor
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{lmodern}% http://ctan.org/pkg/lmodern
\begin{document}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{lll}
\verb!\xfrac! & $\sfrac{\mathbf{v}}{x}$ & $\sfrac{\mathbf{v}_1,\mathbf{v}_2}{x_1,x_2}$ \\
\verb!\nicefrac! & $\nicefrac{\mathbf{v}}{x}$ & $\nicefrac{\mathbf{v}_1,\mathbf{v}_2}{x_1,x_2}$ \\
\verb!\faktor! & $\faktor{\mathbf{v}}{x}$ & $\faktor{\mathbf{v}_1,\mathbf{v}_2}{x_1,x_2}$
\end{tabular}
\end{document}


The choice of lmodern was because of minor font substitutions when it comes to typesetting the denominator & numerator. It is also possible to write a macro that would typeset these respective entries differently, if needed. My choice of \mathbf{...} for the numerator was just a style choice.

-
Vulgar fractions... it's really difficult to search for the right packages when you don't know the correct keywords. This is exactly what I was looking for, thank you so much :) –  Riccardo Oct 29 '11 at 15:28
@Werner Have a look at Algebra and coalgebra in computer science, I am not sure that the correct symbol is used this way. –  Yiannis Lazarides Oct 29 '11 at 16:04
@YiannisLazarides: Either way, this may be personal preference. I am not familiar with fundamental computer science symbols and representations. –  Werner Oct 29 '11 at 16:06
@Werner I am also not very familiar, especially with the new computer science, in my time it would have been := which we used generally as the assignment variable. –  Yiannis Lazarides Oct 29 '11 at 16:35
@YiannisLazarides: Well, nowadays we still use := sometimes if we want to define things. The syntax I'm referring to has a different meaning. Suppose you have a formula P in some calculus, where some free variables appear. You write {v/x}P or [v/x] (you can see both, depending on the conventions chosen by the authors) to mean the formula resulting from substituting every free occurrence of x in P with v. –  Riccardo Oct 29 '11 at 22:14