Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to typeset some expressions involving conditional independence. Here is an example of what I'm aiming for (from Judea Pearl's classic text on causality):

enter image description here

In this question and its answer, three ways to generate this symbol are given. The first two are based on \perp:

\newcommand\ci{\perp\!\!\!\perp}

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

The third is the command \upmodels in the MnSymbol package. Here is what the three methods look like in practice:

enter image description here

To my eyes none of these look great. The problem is that \perp and \upmodels are designed for use in mathematical logic expressions, and haven't been designed to look harmonious with the \mid character. The top of the vertical lines is not level with the top of the \mid character, and I think this makes the symbol look too small.

I tried making my own conditional independence sign using |s and an underline, like this: (I'm sure this is not the best way to get the height of the underline right, but it seems to work.)

\newcommand\bigCI{\mathop{\underline{\raisebox{0pt}[0pt][1pt]{$\;||\;$}}}}

enter image description here

But it looks silly having it extend so far below the baseline. So my question is, how can I achieve something like this, but where the horizontal line is level with the letters' baseline (or possibly slightly below it), and the top of the vertical lines are level with the top of the \mid?

It's desirable to avoid extra packages as much as possible, because I hope a good solution to this can become somewhat "standard". If it's not possible to do it with standard commands then I guess I could try to draw it in Tikz, but that seems like overkill.

share|improve this question

2 Answers 2

Here is a not so elegant solution:

\documentclass{article}
\usepackage{amsmath,amssymb,graphicx}
\newcommand*{\bigCI}{%
  \mathrel{\text{%
    {\rotatebox[origin=c]{90}{\resizebox{2.25ex}{1.65ex}{$\vDash$}}}%
  }}%
}
\begin{document}
  \[\fboxsep=-0.9pt\fbox{$
    A \bigCI B \mid C
  $ }
  \] 
  \[
  A \bigCI B \mid C
  \]
  \[
  A \bigCI B_{\bigCI B \mid C_{\bigCI B \mid C}}
  \]
\end{document}

enter image description here

Another attempt with tikz:

\documentclass{article}
\usepackage{amsmath,tikz}
\newcommand*{\bigCI}{%
  \mathrel{\text{%
    {\begin{tikzpicture}[baseline = {(0,0)}]%
        \draw[line width = 0.1ex] (0,0) -- (0,1.7ex);
        \draw[line width = 0.1ex] (0.3ex,0) -- (0.3ex,1.7ex);
        \draw[line width = 0.1ex] (-0.8ex,0) -- (1.1ex,0);
     \end{tikzpicture}%
    }%
  }}%
}
\begin{document}
  \[\fboxsep=-0.9pt\fbox{$
    A \bigCI B \mid C
  $ }
  \]
  \[
  A \bigCI B \mid C
  \]
  \[
  A \bigCI B_{\bigCI B \mid C_{\bigCI B \mid C}}
  \]
\end{document}

enter image description here

share|improve this answer
    
It's nice (probably better than any of the ones in my question), but not quite perfect --- the lines are slightly thicker than the \mid, and have rounded rather than squared-off ends. (Both of these things are more obvious on my system than in your image.) –  Nathaniel Jan 17 at 9:44
    
@Nathaniel Actually \mid has rounded corners (if you magnify) :). Any way I added a tikz solution where you can change anything as you like. Add line cap = round if you like after line width = 0.1ex, and you can change line width too. –  Harish Kumar Jan 17 at 10:20
    
Note that by using symbols with such a complicated definition a lot, you can make your document run really slow... Maybe it would be a good idea to cache them in a box or something. –  Stephan Lehmke Jan 17 at 11:30
    
\text uses \mathchoice internally, so by adding \typeout{::bigCI::}% inside \text{ I get 20 occurrences of ::bigCI:: for the five symbols in your example. You can do the math (based on a estimation of how often the symbol will occur in your documents :-) –  Stephan Lehmke Jan 17 at 11:38
    
@StephanLehmke Thanks for the observation. You are right about the memory, boxes and \mathchoice :-). Some times I am obsessed and feel that I have lot of memory ;-) –  Harish Kumar Jan 17 at 22:45

What about this?

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\newcommand{\bigCI}{\mathrel{\text{\scalebox{1.07}{$\perp\mkern-10mu\perp$}}}}

\begin{document}

\[
 A \bigCI B_{A \bigCI B_{A \bigCI B}}
\]

\end{document} 
share|improve this answer
    
It looks nice, but on my system (pdflatex box via TexShop on a Mac) this comes out about the same size as the \perp based ones, much shorter than the \mid. I can increase the \scalebox size, but then the lines are too thick. –  Nathaniel Jan 18 at 3:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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