I want to do the not independent sign in latex without having to install or define new commands (since I am using latexIT and I cannot load new packages).

Currently I use the following sign for independent:

X{\perp\!\!\!\perp}Y


What can I use for X not independent of Y? I.e., something like this: ?

-
– Werner Apr 29 '14 at 3:10
@Werner thanks, it looks ok but I'd like the diagonal line to go over the independence sign, is that impossible with the base latex system? – Dnaiel Apr 29 '14 at 4:41

The symbol can be constructed using \perp and \not. The distance between the lines of the equals symbol is taken as distance between the vertical lines in the independent symbol.

\documentclass{article}

\makeatletter
\newcommand*{\indep}{%
\mathbin{%
\mathpalette{\@indep}{}%
}%
}
\newcommand*{\nindep}{%
\mathbin{%                   % The final symbol is a binary math operator
\mathpalette{\@indep}{\not}% \mathpalette helps for the adaptation
% of the symbol to the different math styles.
}%
}
\newcommand*{\@indep}[2]{%
% #1: math style
% #2: empty or \not
\sbox0{$#1\perp\m@th$}%        box 0 contains \perp symbol
\sbox2{$#1=$}%                 box 2 for the height of =
\sbox4{$#1\vcenter{}$}%        box 4 for the height of the math axis
\rlap{\copy0}%                 first \perp
\dimen@=\dimexpr\ht2-\ht4-.2pt\relax
% The equals symbol is centered around the math axis.
% The following equations are used to calculate the
% right shift of the second \perp:
% [1] ht(equals) - ht(math_axis) = line_width + 0.5 gap
% [2] right_shift(second_perp) = line_width + gap
% The line width is approximated by the default line width of 0.4pt
\kern\dimen@
{#2}%
% {\not} in case of \nindep;
% the braces convert the relational symbol \not to an ordinary
% math object without additional horizontal spacing.
\kern\dimen@
\copy0 %                       second \perp
}
\makeatother

\begin{document}
$A \indep B \nindep C = D$
$\scriptstyle A \indep B \nindep C = D$
$\scriptscriptstyle A \indep B \nindep C = D$
\end{document}


# Version for unicode-math

\not does not work as expected, when package unicode-math is loaded. The following version uses the slash instead (the slope is slightly different).

\documentclass{article}
\usepackage{unicode-math}

\makeatletter
\newcommand*{\indep}{%
\mathbin{%
\mathpalette{\@indep}{}%
}%
}
\newcommand*{\nindep}{%
\mathbin{%                   % The final symbol is a binary math operator
%\mathpalette{\@indep}{\not}% \mathpalette helps for the adaptation
\mathpalette{\@indep}{/}%
% of the symbol to the different math styles.
}%
}
\newcommand*{\@indep}[2]{%
% #1: math style
% #2: empty or \not
\sbox0{$#1\perp\m@th$}%        box 0 contains \perp symbol
\sbox2{$#1=$}%                 box 2 for the height of =
\sbox4{$#1\vcenter{}$}%        box 4 for the height of the math axis
\rlap{\copy0}%                 first \perp
\dimen@=\dimexpr\ht2-\ht4-.2pt\relax
% The equals symbol is centered around the math axis.
% The following equations are used to calculate the
% right shift of the second \perp:
% [1] ht(equals) - ht(math_axis) = line_width + 0.5 gap
% [2] right_shift(second_perp) = line_width + gap
% The line width is approximated by the default line width of 0.4pt
\kern\dimen@
\ifx\\#2\\%
\else
\hbox to \wd2{\hss$#1#2\m@th$\hss}%
\kern-\wd2 %
\fi
\kern\dimen@
\copy0 %                       second \perp
}
\makeatother

\begin{document}
$A \indep B \nindep C = D$
$\scriptstyle A \indep B \nindep C = D$
$\scriptscriptstyle A \indep B \nindep C = D$
\end{document}


-

\end{document}

-