10

Warning! This question is based on a mistake! Do not waste time on it!

Please note: this question arose from a mistake that I made. There is no need for an answer. The bounty will most likely not be awarded to anyone. I would delete it but I can't since it has (very good) answers. I am extremely sorry for the time people have put into writing answers as a result of my mistake.

I had made a file to test the various ways of writing a conditional independence symbol in LaTeX. Since one of those involves including the MnSymbol package, I had included that package. But this package redefines some of the math symbols, and \perp in particular, which made me think that all the solutions looked kind of stupid. But in fact they do not. The "usual" way of writing a conditional independence symbol, by doing \perp\!\!\!\perp, looks just fine as long as you don't include MnSymbol.

Below is my original question text, for reference.

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", at least for those using the Computer Modern fonts. 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.

0

3 Answers 3

13

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} 
0
9

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

0
8
+25

You do not need use \newcommand. Your symbol is part of the packages txfonts and pxfonts.

You must insert in the preamble:

\usepackage{txfonts} % https://www.ctan.org/tex-archive/fonts/txfonts

And insert in the text:

\textit{\textbf{Symmetry:}} $(X \Perp Y | Z) \Rightarrow (Y \Perp X | Z)$.

\textit{\textbf{Decomposition:}} $(X \Perp YW | Z) \Rightarrow (X \Perp Y | Z)$.

\textit{\textbf{Weak union:}} $(X \Perp YW | Z) \Rightarrow (X \Perp Y | ZW)$.

The result is:

Results

2
  • When I use this package, it changes the font of the entire document. How can I over come this?
    – TrungDung
    Mar 16, 2021 at 16:16
  • Try with \mathchardef\perp="323F. \perp is only a LaTeX math command. The package which I used only add \Perp. Mar 17, 2021 at 21:26

You must log in to answer this question.

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