1

I am trying to slightly reduce the dimensions of the \slash delimiter with \delimiterfactor.

\documentclass[12pt]{article}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\begin{document}

\newcommand{\hfrac}[2]{\left.#1\middle\fracslash#2\right.}
\[ a/b \qquad \hfrac{a}{b} \qquad \hfrac{\sqrt{3}}{3} \qquad x^{\hfrac{1}{2}} \qquad x^{y^{\hfrac{2}{3}}} \]

\renewcommand{\hfrac}[2]{\delimiterfactor=850\left.#1\middle\fracslash#2\right.}
\[ a/b \qquad \hfrac{a}{b} \qquad \hfrac{\sqrt{3}}{3} \qquad x^{\hfrac{1}{2}} \qquad x^{y^{\hfrac{2}{3}}} \]

\renewcommand{\hfrac}[2]{\delimiterfactor=800\left.#1\middle\fracslash#2\right.}
\[ a/b \qquad \hfrac{a}{b} \qquad \hfrac{\sqrt{3}}{3} \qquad x^{\hfrac{1}{2}} \qquad x^{y^{\hfrac{2}{3}}} \]

\end{document}

Here is the result.

result

Switching from 901 (default value) to 850 as no effect but switching to 800 get an huge reduction (it also looks like the delimiter is slightly too shifted down). How can I get something more smooth ? (the \delimitershortfall command seems not helping)

4
  • 1
    The slash is only available in some fixed sizes.
    – egreg
    Mar 12, 2018 at 22:33
  • You may take a look a the xfrac package (ctan.org/pkg/xfrac). It defines the \sfrac{}{} command.
    – user94293
    Mar 12, 2018 at 22:36
  • @egreg So, no way to get a better result ? And, is it possible to use slash from another font ?
    – MB4E
    Mar 12, 2018 at 22:38
  • @user94293 yes, but result isn't really nice with xits fonts.
    – MB4E
    Mar 12, 2018 at 22:39

1 Answer 1

1

Since slash is only available in some fixed sizes (thx @egreg), the following solution using scalerel is not bad.

\documentclass[12pt]{article}
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\usepackage{scalerel}
\newcommand{\hfrac}[2]{#1\scalerel{\divslash}{\vphantom{#1}#2}}
\begin{document}

\[ \hfrac{a}{b} \qquad \hfrac{\sqrt{a}}{(b+c)} \qquad \hfrac{1}{\sqrt{a}} \qquad x^{\hfrac{1}{2}} \]

\end{document}

result

You must log in to answer this question.

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