[Tex/LaTex] fourier font and \nmid

fontsfouriermath-modesymbols

The fourier package does not provide a \nmid command. Using the \nmid from amssymb looks very different from the fourier's \mid.

Is there a way to produce a "compatible" symbol in fourier?
The two vertical lines should have the same height and width, but the \mid should have some extra space as to match the \nmid's width when they are typeset in two lines above each other, as shown below.

I tried importing both from MnSymbol but couldn't figure out how they are defined there in the first place.

\documentclass{minimal}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[widespace]{fourier}

\begin{document}

\begin{align*}
  a&=b & v\mid\infty\\
  c&=d & v\nmid\infty
\end{align*}

\end{document}

Best Answer

Here is a possibility, superimposing a rotated minus to the vertical bar.

\documentclass{article}
\usepackage{amsmath}
%\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[widespace]{fourier}

\makeatletter
\providecommand{\nmid}{} % a mock definition
\renewcommand\nmid{\mathrel{\mathpalette\thiel@nmid\relax}}
\newcommand{\thiel@nmid}[2]{%
  \ooalign{%
    \rotatebox[origin=c]{40}{$\m@th#1-\mkern-3.5mu$}\cr
    \hidewidth$\m@th#1|$\hidewidth\cr}%
}
\makeatother

\begin{document}

\begin{gather*}
v\mid\infty\\
v\nmid\infty\\
x_{\nmid_{\nmid}}
\end{gather*}

\end{document}

I use first \providecommand to give a definition to \nmid, so the later \renewcommand will work in all cases.

enter image description here

I'm not sure you really want \mid to take as much space as \nmid other than in the supposedly rare cases when they must be aligned, so I believe it's best to define a new command \wmid for the “wide \mid”:

\newcommand\wmid{\mathrel{\mathpalette\thiel@mid\relax}}
\newcommand{\thiel@mid}[2]{%
  \ooalign{%
    \hphantom{\rotatebox[origin=c]{40}{$\m@th#1-\mkern-3.5mu$}}\cr
    \hidewidth$\m@th#1|$\hidewidth\cr}%
}

(put this before the \makeatother in the above code). Then the code

\begin{align*}
v&\wmid\infty\\
v&\nmid\infty
\end{align*}

will produce

enter image description here