[Tex/LaTex] Typeset a solidus operator (free variable substitution)

math-modesymbols

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?

Best Answer

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:

enter image description here

\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.

Related Question