10

I have found this symbol defined as:

    \def\ci{\perp\!\!\!\perp}

on the wikipedia page for Conditional Independence. There's this from the Comprehensive LaTex Symbol List page 106:

Donald Arseneau posted the following \mathpalette-based definition of a probabilistic-independence symbol ⊥⊥ to comp.text.tex in June 2000:

    \newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
    \def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

The \independent macro uses \mathpalette to pass the \independenT helper 
macro both the current math style and the \perp symbol. \independenT 
typesets \perp in the current math style, moves two math units to the 
right, and finally typesets a second—overlapping—copy of \perp, again 
in the current math style. \rlap, which enables text overlap, is described 
later on this page.

Frankly, I like the first version better, even though it doesn't typeset properly on my machine.

Are there any better alternatives?

3 Answers 3

5

The usual place at Comprehensive LaTeX Symbol List has the \upmodels symbol in the mnsymbol package, which looks more like the first symbol used in the Wikipedia article. The horizontal distance between the bars is be a bit smaller than the first version, though. See for yourself:

\documentclass{article}
\usepackage{MnSymbol}

\begin{document}

\def\ci{\perp\!\!\!\perp} % from Wikipedia
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}} % symbols-a4, p.106
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}} 

$\upmodels$ % mnsymbol
$\independent$
$\ci$
\end{document}
1
  • 1
    One thing to note is that the definition of \independenT needs a \mathsurround0pt as in \def\independenT#1#2{\mathrel{\rlap{$#1#2\mathsurround0pt$}\mkern2mu{#1#2}}} Alternatively, \m@th will do the trick. Of course, the best way to do this is to just use the mathtools package and use \mathrlap which takes care of this for you.
    – TH.
    Commented Sep 30, 2010 at 23:45
6

In Unicode this is:

⫫ U+2AEB DOUBLE UP TACK

If you have a working unicode-math installation, you can either use the symbol directly, or its alias \Vbar.

6

While this answer also imports the symbol from MnSymbol font, it offers two significant improvements.

First, as many have noted in other answers on this site, using the MnSymbol package changes many glyphs, which is often not wanted. So the approach often mentioned is to import just the desired glyphs from MnSymbol, leaving all the others intact.

The "value added" I provide here, since that approach seems to be used frequently, is to introduce three macros

\ImportFromMnSymbol{<family>}
\DeclareMnSymbol{<macro-name>}{<type>}{<family>}{<glyph-slot>}
\MnSymbolGlyphs{<family>}% EXECUTED IN THE PREAMBLE

The \DeclareMnSymbol macro is analogous to the \DeclareMathSymbol macro, except the 3rd argument is merely the MnSymbol family, such as A or B, etc. The Glyph slot can be given in decimal, 'octal, or "hexidecimal.

The \MnSymbolGlyphs macro, executed in the preamble, shows the font table for the desired MnSymbol family as the first thing in the document. This allows one to locate particular glyphs and their slot numbers.

So in this example, once the above macros are defined, if I wanted to use the MnSymbol glyph directly, the usage would be

\ImportFromMnSymbol{A}
\DeclareMnSymbol{\ConIndep}{\mathrel}{A}{225}

Multiple glyphs can be imported from a single family by repeated invocation of \DeclareMnSymbol. Of course, the \ImportFromMnSymbol macro must be invoked for the family, prior to declaring symbols from that family.

But here is the second improvement. The MnSymbol representing the desired glyph is too small vertically. So I use the scalerel package to scale the desired glyph to the proper size, while keeping it compatible with the current math style.

In the MWE below, I include the commented line employing \MnSymbolGlyphs, which can be uncommented/edited to explore the available glyphs of MnSymbol.

\documentclass{article}
\usepackage{scalerel}
\def\MnSymbolGlyphs#1{% IF ONE NEEDS TO LOCATE GLYPHS
  \usepackage{MnSymbol,fonttable}%
  \AtBeginDocument{\fonttable{MnSymbol#110}}%
}
\def\ImportFromMnSymbol#1{%
  \DeclareFontFamily{U} {MnSymbol#1}{}
  \DeclareFontShape{U}{MnSymbol#1}{m}{n}{
   <-6> MnSymbol#15
   <6-7> MnSymbol#16
   <7-8> MnSymbol#17
   <8-9> MnSymbol#18
   <9-10> MnSymbol#19
   <10-12> MnSymbol#110
   <12-> MnSymbol#112}{}
  \DeclareFontShape{U}{MnSymbol#1}{b}{n}{
   <-6> MnSymbol#1-Bold5
   <6-7> MnSymbol#1-Bold6
   <7-8> MnSymbol#1-Bold7
   <8-9> MnSymbol#1-Bold8
   <9-10> MnSymbol#1-Bold9
   <10-12> MnSymbol#1-Bold10
   <12-> MnSymbol#1-Bold12}{}
  \DeclareSymbolFont{MnSy#1} {U} {MnSymbol#1}{m}{n}
}
\newcommand\DeclareMnSymbol[4]{\DeclareMathSymbol{#1}{#2}{MnSy#3}{#4}}
\ImportFromMnSymbol{A}
\DeclareMnSymbol{\ConIndepNat}{\mathrel}{A}{225}
\def\ConIndep{\mathrel{\scalerel*{\ConIndepNat}{X}}}
%\MnSymbolGlyphs{A}
\begin{document}
$A \ConIndepNat B$ as imported from MnSymbol\par
$A \ConIndep B$ scaled to height of X\par
$A \ConIndep B\quad\scriptstyle A \ConIndep B\quad\scriptscriptstyle A \ConIndep B$
autoscaling to math style
\end{document}

enter image description here

1
  • 2
    This is a really nice solution to this problem, +1
    – HRSE
    Commented Mar 16, 2017 at 8:22

You must log in to answer this question.

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