2

So I want to make the four elementary arithmetic symbols in math-mode, but I don't like the way the divison-symbol looks. I want it to look like you rotated the subtraction-symbol 45 degrees, and I find / looking too long.

I'd like it to look like the one on the bottom here. One way of doing it was by using \usepackage{graphicx} and inserting \rotatebox{45}{$\_\!\_\!\_$}, but this isn't very convenient and I was hoping there may be a better way of making this.

Thanks in advance.

  • In this context, you would usually want the division symbol ÷ rather than a slash. – J. C. Salomon Jan 18 '15 at 17:46
  • @J.C.Salomon Part of my motivation for using this new sign is to replace it with a symbol looks like a tilted minus-symbol, just as the multiplication-symbol looks like a tilted addition-symbol. Besides, there is no generally accepted division symbol as ) and : could also be used, I just feel it looks better to use a symbol that resembles a fraction, instead of using some weird symbol which doesn't resemble any of the other symbol. – Frank Vel Jan 18 '15 at 18:33
2

Detexify doesn't give any usable suggestions.

My best result was \newcommand{\division}{\mkern-\medmuskip\rotatebox[origin=c]{45}{\scalebox{0.9}{$-$}}\mkern-\medmuskip}

It gives you the same rounded corners as the default division line has.

edit: notice that this division in my opinion looks horrible for capital variables.

  • I haven't tried Detexify before, but it gave me $\diagup$; is there a way to make this symbol shorter? Other than that your solution is certainly better than my current. – Frank Vel Jan 17 '15 at 15:29
  • You could use \scalebox to shrink it and the fiddle with the spacing, but I couldn't make it prettier than my answer. – Jonas Nyrup Jan 17 '15 at 19:46
  • I can't seem to get \scalebox to work with $\diagup$, \scalebox{0.6}{\diagup} is just erroring. What am I doing wrong? – Frank Vel Jan 17 '15 at 22:39
  • Read the error message. You need $'s. \scalebox{0.6}{$\diagup$}. – corporal Jan 18 '15 at 2:15
  • @corporal the error message was incomprehensible to me. But it seems \scalebox made it too thin, so I guess that won't work... – Frank Vel Jan 18 '15 at 12:25
2

If the reason for your inconvenience is the lenght or complicatedness of creating that symbol, I kindly remember you of the possibility to define your own command using \newcommand, essentially reducing the work needed to create that symbol to a few keystrokes. Also, if you'd decide to use 50 degrees later on, you only have to adjust one piece of code instead of the whole document.

  • I'm aware of this option, although I was hoping there was an existing symbol or some better way to write it instead of adding a package for the sake of adding one new symbol. Another reason why I don't like my symbol is that it doesn't have a smooth edge. – Frank Vel Jan 17 '15 at 13:28
  • Okay, you should try the answer of @JonasNyrup then, as he seems to have solved the "smooth edge" problem. – LWChris Jan 17 '15 at 14:02
  • 1
    @fvel One of the primary advantages of LaTeX is the use of packages (when needed). A package like graphicx needed to accomplish a \rotatebox is so useful in so many ways (e.g., \includegraphics, \scalebox, etc.) that one should not eschew its use. – Steven B. Segletes Jan 17 '15 at 20:46
  • @StevenB.Segletes I'm aware of the usefulness of packages, but having a package for the sole purpose of adding one new symbol seems unnecessary. Although I was unaware of graphicx's other uses, so perhaps I'll find it useful. – Frank Vel Jan 17 '15 at 22:15
2

This answer splits the difference between the traditional and proposed approaches. It introduces \vfrac{}{} (vary-frac) which will stretch the top of the fraction to the top of the higher of the two components, but never higher than the top of a capital "X".

For x/y fractions, it gives what the OP seeks, I think. But if one of the arguments is tall, it stretches the result accordingly. It is made to work across all math styles.

\documentclass{article}
\usepackage{scalerel}
\newcommand\vfrac[2]{\ThisStyle{%
  \setbox0=\hbox{$\SavedStyle#1#2$}%
  \setbox2=\hbox{$\SavedStyle X$}%
  \ifdim\ht0>\ht2\setlength{\ht0}{\ht2}\fi%
  #1\mathord{\stretchto{\raisebox{2.3\LMpt}{$\SavedStyle/$}}{\ht0}}#2}}
\begin{document}
$\vfrac{x}{y} \quad \vfrac{X}{Y}\quad \vfrac{X^2}{y}\quad \vfrac{p}{q}$\par
$\scriptstyle\vfrac{x}{y} \quad \vfrac{X}{Y}\quad \vfrac{X^2}{y}\quad \vfrac{p}{q}$\par
$\scriptscriptstyle\vfrac{x}{y} \quad \vfrac{X}{Y}\quad \vfrac{X^2}{y}\quad \vfrac{p}{q}$\par
\end{document}

enter image description here


FOLLOW UP:

The OP asked for a similar approach but with a 45 degree stroke. Here is such a variation on my approach (though the angle may not be exactly 45 deg). A downside is that since the slash is scaled (rather than extended), its thickness changes with size.

\documentclass{article}
\usepackage{scalerel}
\newcommand\vfrac[2]{\ThisStyle{%
  \setbox0=\hbox{$\SavedStyle#1#2$}%
  \setbox2=\hbox{$\SavedStyle X$}%
  \ifdim\ht0>\ht2\setlength{\ht0}{\ht2}\fi%
  #1\mathord{\scaleto{\raisebox{.7pt}{\vstretch{.3}{\SavedStyle/}}}{\ht0}}#2}}
\begin{document}
$\vfrac{x}{y} \quad \vfrac{X}{Y}\quad \vfrac{X^2}{y}\quad \vfrac{p}{q}$\par
$\scriptstyle\vfrac{x}{y} \quad \vfrac{X}{Y}\quad \vfrac{X^2}{y}\quad \vfrac{p}{q}$\par
$\scriptscriptstyle\vfrac{x}{y} \quad \vfrac{X}{Y}\quad \vfrac{X^2}{y}\quad \vfrac{p}{q}$\par
\end{document}

enter image description here

  • I'd like to always have an angle of 45 degrees, and it seems the angle is changing depending on font size. – Frank Vel Jan 18 '15 at 12:30
  • @fvel I have provided a follow up. – Steven B. Segletes Jan 18 '15 at 17:17
  • Thanks. I've ended up using \rotatebox{45}{\!\scalebox{2}[1]{$\_$}} though, as this doesn't change the thickness and change be of any desired length. Although yours seems more flexible so I might try it as well. – Frank Vel Jan 18 '15 at 17:47
2

In the Computer Modern fonts, the plus and minus signs have the same lengths of the lines as well as the \times symbol, the latter could be considered as rotated plus sign. The division symbol would fit in as rotated minus sign, vertically centered at the math axis and horizontally centered in the width of the \times symbol.

\documentclass{article}
\usepackage{amsmath}% for environment "gather*"
\usepackage{color}
\usepackage{graphicx}
\makeatletter
\newcommand*{\vardivision}{%
  \mathbin{\mathpalette\@vardivision{}}%
}
\newcommand*{\@vardivision}[2]{%
  % #1: math style
  % #2: unused
  \sbox0{$\vcenter{}$}% \ht0: math axis
  \dimen@=\ht0 %
  \sbox0{$#1\times\m@th$}% \wd0: width of the new symbol
  \raise\dimen@\hbox to \wd0{%
    \hfil
    \setbox0=\hbox to \z@{\hss\lower\dimen@\hbox{$#1-\m@th$}\hss}%
    \ht0=\z@
    \dp0=\z@
    \rotatebox{45}{\box0}%
    \hfil
  }%
  \vphantom{\times}%
}
\makeatother

\begin{document}
\begin{gather*}
  1 + 2 \times 3 \vardivision 4
\\
  a + b \times c \vardivision d
\\
  {+} {-} {\times} {\vardivision}
\\
  \scriptstyle {+} {-} {\times} {\vardivision}
\\
  \scriptscriptstyle {+} {-} {\times} {\vardivision}
\\
  \sbox0{${+}{-}{\times}{\vardivision}$}
  \rlap{\copy0}%
  \vcenter{%
    \hbox{%
      \textcolor{red}{%
        \vrule width\wd0 height .05pt depth .05pt\relax
      }%
    }%
  }
\\
  \color{red}
  \setlength{\fboxsep}{0pt}
  \setlength{\fboxrule}{.1pt}
  \def\test#1{\fbox{\textcolor{black}{$#1$}}}
  \vcenter{%
    \hbox{$\test{+} \test{-} \test{\times} \test{\vardivision}$}%
    \nointerlineskip
    \hbox{$\test{-} \test{+} \test{\vardivision} \test{\times}$}%
  }
\end{gather*}
\end{document}

Result

1

You can reflect \smallsetminus (from amssymb):

\documentclass{article}
\usepackage{amssymb,graphicx}

\makeatletter
\DeclareRobustCommand{\vardivision}{%
  \mathbin{\mathpalette\@vardivision\relax}% 
}
\newcommand{\@vardivision}[2]{%
  \reflectbox{$\m@th\smallsetminus$}%
}
\makeatother

\begin{document}

$a+b\vardivision c$

$a\vardivision b\times c$

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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