8

I'm need a symbol for "independence" in probability, that could take parameters, so it is probability over a $\sigma$-algebra. I don't know how to describe it, so I wrote it by hand. I've seen people create something similar for the independence by non-forking extensiosn. Is there a way to create a symbol that behaves like this?enter image description here

4 Answers 4

15

The newtx and newpx text and math font packages provide a macro called \Perp that can be used to create a relational operator I'll call \prind -- short for "probability independence", I suppose.

enter image description here

\documentclass{article} % or some other suitable document class
\usepackage{amsmath} 
\usepackage{newpx}   % or: \usepackage{newtx}
\newcommand{\prind}{\mathrel{\Perp}}
% Use in displaystyle math mode ("limits" below symbol)
\newcommand{\dprind}[1]{\mathrel{\mathop{\Perp}\limits_{#1}}} 

\begin{document}
$a \prind b \quad a \prind_C b \quad \displaystyle a \dprind{C} b$
\end{document}

What to do if you can't use either the newtx or newpx font package to access a ready-made \Perp macro? Easy: Just "roll your own" \Perp macro, along the lines of either @SandyG's answer or of @egreg's recent answer, which defines \Perp as

\newcommand{\Perp}{\mathrel{\perp\mspace{-9mu}\perp}}
3
  • 1
    A math operator is not a relation symbol and you get wrong spacing. Try a \prind(b+c) to see why.
    – egreg
    Commented Jun 4 at 13:42
  • 1
    Thanks for the answer! Commented Jun 4 at 13:46
  • 1
    @egreg - Thanks. I've updated my answer to make \prind have status math-rel rather than math-op.
    – Mico
    Commented Jun 4 at 17:57
10

The ⫫ symbol is \Vbar in unicode-math, or the legacy packages stix, stix2 and fdsymbol.

\documentclass{article}
\usepackage[default]{fontsetup} % Loads unicode-math.

\begin{document}
\begin{align*}
  a &\Vbar b \\
  a &\Vbar_C b \\
  a &\mathrel{\mathop\Vbar\limits_{C}} b
\end{align*}
\end{document}

New Computer Modern Book sample

On PDFLaTeX, replace fontsetup with \usepackage{amsmath, stix2}.

10

You can use the standard _{C} syntax.

\documentclass[twocolumn]{article}
\usepackage{amsmath}

%%% the pure symbol, see https://tex.stackexchange.com/a/718194/4427
\newcommand{\cind}{\perp\mspace{-9mu}\perp}
%%% define \indep
\NewDocumentCommand{\indep}{e{_}}{%
  \mathrel{%
    \IfNoValueTF{#1}{% no subscript
      \cind
    }{% subscript
      \mathchoice{\mathop{\cind}\limits_{#1}}{\cind_{#1}}{\cind_{#1}}{\cind_{#1}}%
    }%
  }%
}


\begin{document}

$a \indep b$

$a \indep_{C} b$

\[
a \indep_{C} b
\]

\end{document}

The option twocolumn has been used just to get a smaller picture.

enter image description here

Avoid $$ in LaTeX.

For a taller symbol (but a bit lowered under the baseline):

\documentclass[twocolumn]{article}
\usepackage{amsmath}

%%% the pure symbol
\makeatletter
\newcommand{\longperp}{\mathpalette\longperp@\relax}
\newcommand{\longperp@}[2]{%
  \raisebox{-0.15\height}{%
    \ooalign{\hidewidth\raisebox{\depth}{$\m@th#1\vert$}\hidewidth\cr$\m@th#1\perp$\cr}%
  }%
}
\newcommand{\cind}{{\longperp\mspace{-9mu}\longperp}}
%%% define \indep
\NewDocumentCommand{\indep}{e{_}}{%
  \mathrel{%
    \IfNoValueTF{#1}{% no subscript
      \cind
    }{% subscript
      \mathchoice{\mathop{\cind}\limits_{#1}}{\cind_{#1}}{\cind_{#1}}{\cind_{#1}}%
    }%
  }%
}


\begin{document}

$A \indep B$

$a \indep_{C} b$

\[
a \indep_{C} b
\]

\end{document}

enter image description here

A not so taller version:

\documentclass[twocolumn]{article}
\usepackage{amsmath}
\usepackage{graphicx}

%%% the pure symbol
\makeatletter
\newcommand{\longperp}{\mathpalette\longperp@\relax}
\newcommand{\longperp@}[2]{%
  \ooalign{%
    \hidewidth\raisebox{\depth}{\scalebox{1}[0.8]{$\m@th#1\vert$}}\hidewidth\cr
    $\m@th#1\perp$\cr
  }%
}
\newcommand{\cind}{\longperp\mspace{-9mu}{\longperp}}
%%% define \indep
\NewDocumentCommand{\indep}{e{_}}{%
  \mathrel{%
    \IfNoValueTF{#1}{% no subscript
      \cind
    }{% subscript
      \mathchoice{\mathop{\cind}\limits_{#1}}{\cind^{}_{#1}}{\cind_{#1}}{\cind_{#1}}%
    }%
  }%
}


\begin{document}

$\indep\perp$

$A \indep B$

$a \indep_{C} b$

$\displaystyle % emulate \[...\]
a \indep_{C} b
$

\end{document}

enter image description here

4
  • Thanks! It was very useful. Some two question: why should I avoid $$? and i'm sorry to be nitpicky but... is there a way of making it taller? it looks nice, but I'm relating probabilistic independence with independence by non-forking, and this symbol looks way shorter in comparison Commented Jun 4 at 13:40
  • @SusanaSantoyo - For your first question, please see the posting Why is \[ ... \] preferable to $$ ... $$?
    – Mico
    Commented Jun 4 at 18:00
  • @SusanaSantoyo I added a taller version.
    – egreg
    Commented Jun 4 at 21:52
  • @egreg thanks, that's exactly what i was looking for. Commented Jun 5 at 1:19
8

There is the built-in \coprod symbol:

enter image description here

\documentclass{article}

\begin{document}

$a\coprod b\quad a\coprod_c b\quad{\displaystyle a\coprod_c b}$

\end{document}

Alternatively, you can make a double \perp symbol:

enter image description here

Adjust the \mkern length to your liking.

\documentclass{article}

\usepackage{amsmath, scalerel}

\DeclareMathOperator*{\indep}{\scalerel*{\perp\mkern-9mu\perp}{\sum}}

\begin{document}

$a\indep b\quad a\indep_c b\quad{\displaystyle a\indep_c b}$

\end{document}
1

You must log in to answer this question.

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