How to print \frac{1}{2} by a single Unicode character?

This answers your question title, but not your explanation (which seems to imply that you cannot use vulgar fractions with pdfLaTeX). The textcomp package makes available \textonehalf, \textonequarter, and \textthreequarters. If your font and chosen encoding supports these, then they can be used directly. (If your font does not support these, however, you will get an error message like "\textonequarter" unavailable in encoding OT1" or a strange symbol.) This works with pdfLaTeX:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{textcomp}
\usepackage{nicefrac} % For comparison
\usepackage{xfrac}    % Works better with other fonts
\begin{document}
\noindent Here are some vulgar fractions: \textonehalf, \textonequarter,
\textthreequarters.

\noindent Here are some \texttt{nicefrac} fractions:  \nicefrac{1}{2},
\nicefrac{1}{4}, \nicefrac{3}{4}, \nicefrac{11}{7}.

\noindent Here are some \texttt{xfrac} fractions:  \sfrac{1}{2},
\sfrac{1}{4}, \sfrac{3}{4}, \sfrac{11}{7}.
\end{document}

Example of vulgar fractions with Palatino.

Notice that, although the xfrac fractions look good, they do not have the same weight as the vulgar fractions designed with the font. Unfortunately, textcomp only seems to provide access to these three fractions. If you use LuaTeX or XeTeX, then you may be able to access additional glyphs provided in your font as described by doncherry.


You might try

\documentclass[a4paper]{article}
\usepackage{ifxetex,ifluatex}

\newif\ifunicode
\ifxetex\unicodetrue\else\ifluatex\unicodetrue\fi\fi 

\ifunicode
  \usepackage{unicode-math}
  \setmainfont[Ligatures=TeX,Fractions=On]{XITS}
  \setmathfont{XITS Math}

  \makeatletter
  \let\@@@frac\frac
  \def\frac#1#2{\sbox0{#1/#2}\sbox2{#1\phantom{/}#2}%
    \ifdim\wd0=\wd2 % no corresponding character
      \@@@frac{#1}{#2}%
    \else
      \mbox{#1/#2}%
    \fi}
  \makeatother
\fi

\begin{document}
1/2$\frac{1}{2}\frac{12}{11}$
\end{document}

Here I assume that a vulgar fraction width is different than the width of the slashed form, which seems rather likely to happen.

However I would advise not to use vulgar fractions in a mathematical context.


The answer of @mforbes is correct, however, it can be simplified:

  • The mathpazo package is not required.
  • For XeLaTeX, the fontspec package is enough and textcomp package is not required.

Based on these, the minimal examples are the following:

For pdfLaTeX:

% !TeX program = pdflatex
\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{lmodern}

\begin{document}
    \textonehalf \textonequarter \textthreequarters
\end{document}

For XeLaTeX:

\documentclass{article}

\usepackage{fontspec}

\begin{document}
    \textonehalf \textonequarter \textthreequarters
\end{document}

The result:

enter image description here